Giter Club home page Giter Club logo

Comments (13)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
Here is a proof of concept using var_export().

<?php

class Dumper
{
  public static function __set_state($class, $members)
  {    
    $dump = array('__className'=>$class);
    foreach( $members as $name => $value ) {
      $dump[$name] = $value;
    }
    return $dump;
  }
}

class TestObject
{
  var $publicVar = 'Public Var';
  protected $protectedVar = 'Protected Var';
  private $privateVar = 'PrivateVar';
}

$obj = new TestObject();

$code = var_export($obj, true);

$code = str_replace('TestObject::__set_state(',
                    'Dumper::__set_state(\'TestObject\',', $code);

echo '<pre>';
echo $code;
echo '</pre>';

eval('$dump = ' . $code . ';');

echo '<pre>';
var_dump($dump);
echo '</pre>';

?>

Original comment by [email protected] on 16 Sep 2008 at 8:29

from firephp.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
This will be included in the next beta release.

Original comment by [email protected] on 6 Oct 2008 at 8:36

  • Changed state: Accepted
  • Added labels: release-0.2

from firephp.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
hi Cristoph,
I suggest using the parseObject() function in the comments here:
http://es2.php.net/manual/en/function.get-object-vars.php

Original comment by [email protected] on 7 Oct 2008 at 9:50

from firephp.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
Take a look at:

http://code.google.com/p/firephp/source/browse/trunk/DevApp/application/bootstra
p/plain/LogPrivateObjectMembers.php

That is my planned implementation.

I think it will do the job just fine. I don't quite like parsing the output of 
print_r.

Original comment by [email protected] on 7 Oct 2008 at 10:42

from firephp.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024

Original comment by [email protected] on 7 Oct 2008 at 12:34

  • Changed state: Started

from firephp.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
Hi Christoph. I just tried the new 0.2.b.2.
You export the object via var_export. Thats fine, but does not work with bigger 
vars
and does not handle recursions. Perhaps its possible to parse the ouptut of
serialize()? I think thats the only working solution for every case. Otherwise 
it is
not possible to use it with big objects.

Original comment by [email protected] on 8 Oct 2008 at 3:44

from firephp.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
I found a better solution using a cast to array. (array)$obj

I'll have an update available ASAP.

Original comment by [email protected] on 8 Oct 2008 at 8:24

from firephp.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
Please try 0.2.b.3

Original comment by [email protected] on 8 Oct 2008 at 11:15

from firephp.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
Using the following code:
<?php
require_once 'FirePHPCore/fb.php';
$obj1 = new stdClass;
$obj2 = new stdClass;
$obj1->p = $obj2;
$obj2->p = $obj1;
FB::log($obj1);

I'm getting a PHP error:
Fatal error: Nesting level too deep - recursive dependency? in
/usr/share/php/FirePHPCore/FirePHP.class.php on line 680
Call Stack
#   Time    Memory  Function    Location
1   0.0529  55784   {main}( )   ../test.php:0
2   0.2829  312464  FB::log( )  ../test.php:7
3   0.2829  312800  FB::send( ) ../fb.php:115
4   0.2831  314204  call_user_func_array ( )    ../fb.php:81
5   0.2831  314844  FirePHP->fb( )  ../fb.php:0
6   0.3384  318636  FirePHP->jsonEncode( )  ../FirePHP.class.php:549
7   0.3385  318636  FirePHP->encodeObject( )    ../FirePHP.class.php:657
8   0.3768  319372  FirePHP->encodeObject( )    ../FirePHP.class.php:740
9   0.3768  319720  in_array ( )    ../FirePHP.class.php:680

Original comment by [email protected] on 8 Oct 2008 at 11:23

from firephp.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
Are you using version 0.2.b.3 of the FirePHPCore library?

Original comment by [email protected] on 8 Oct 2008 at 11:46

from firephp.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
Never mind. I can reproduce it. Working on a fix.

Original comment by [email protected] on 8 Oct 2008 at 11:50

from firephp.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
Please try 0.2.b.4

Original comment by [email protected] on 9 Oct 2008 at 12:10

from firephp.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024

Original comment by [email protected] on 22 Oct 2008 at 5:11

  • Changed state: Fixed

from firephp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.