Comments (13)
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.
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.
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.
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.
Original comment by [email protected]
on 7 Oct 2008 at 12:34
- Changed state: Started
from firephp.
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.
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.
Please try 0.2.b.3
Original comment by [email protected]
on 8 Oct 2008 at 11:15
from firephp.
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.
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.
Never mind. I can reproduce it. Working on a fix.
Original comment by [email protected]
on 8 Oct 2008 at 11:50
from firephp.
Please try 0.2.b.4
Original comment by [email protected]
on 9 Oct 2008 at 12:10
from firephp.
Original comment by [email protected]
on 22 Oct 2008 at 5:11
- Changed state: Fixed
from firephp.
Related Issues (20)
- FirePHP fails to interpret Responses if window.open is called during pageload HOT 6
- Extension not appending "FirePHP" to user-agent header in Firefox 10 on Mac OS X HOT 11
- Group dumps HOT 2
- Problem w/ FirePHP after update to FF13 HOT 5
- TypeError: firephp.app is undefined HOT 4
- Enhancement: a index.php test-page to the package
- FirePHP does not log primitives correctly (TRUE,FALSE,NULL, etc) HOT 1
- Right Click on link and clicking "Open Link in New Tab" doesn't work HOT 1
- array elements displayed in wrong order HOT 1
- Output fails to show correct log items when page redirects HOT 4
- [deleted issue]
- Update the source location HOT 1
- Variable Viewer for TABLE messages HOT 1
- Collapsed group isn't working with FireBug 1.13
- navigator.userAgent unmodified HOT 1
- Redirect to the same URL shows last log twice
- Missing icon when running with Firebug 2.0 HOT 8
- Table log HOT 3
- firephp icon lost
- FirePHP not working
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from firephp.