Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.0.4

Bug #3396 Var_Dump::toString() sets object variables
Submitted: 2005-02-07 21:10 UTC
From: michael dot caplan at lechateau dot ca Assigned: fredericpoeydomenge
Status: Closed Package: Var_Dump
PHP Version: 5.0.3 OS: RHE 3
Roadmaps: (Not assigned)    
Subscription  


 [2005-02-07 21:10 UTC] michael dot caplan at lechateau dot ca
Description: ------------ Hi, when dumping an object, somewhere in Var_Dump::toString() my object gets assigned a bogus property. Specifically a protected string property which exists results in class::'name:protected' being set. I suppose this is an incompatibility with Var_Dump and PHP5. Is Var_Dump PHP5 ready (as in runable on PHP5 with out issue in non-strict mode)? Thanks, Michael Reproduce code: --------------- $profiles = Tracking_Profile::getInstance(); Var_Dump::display($profiles); Var_Dump::display($profiles); results in (note second dump): object(Tracking_Profile)#20 (7) id:protected int 18 module:protected string(4) name:protected string(4) owner_id:protected int 19923 global:protected bool true is_default:protected bool true tracking_id:protected int 12 object(Tracking_Profile)#20 (9) id:protected int 18 module:protected string(4) name:protected string(4) owner_id:protected int 19923 global:protected bool true is_default:protected bool true tracking_id:protected int 12 module:protected &NULL name:protected NULL Expected result: ---------------- object(Tracking_Profile)#20 (7) id:protected int 18 module:protected string(4) name:protected string(4) owner_id:protected int 19923 global:protected bool true is_default:protected bool true tracking_id:protected int 12 Actual result: -------------- object(Tracking_Profile)#20 (9) id:protected int 18 module:protected string(4) name:protected string(4) owner_id:protected int 19923 global:protected bool true is_default:protected bool true tracking_id:protected int 12 module:protected &NULL name:protected NULL

Comments

 [2005-02-08 09:23 UTC] fredericpoeydomenge
Var_Dump is PHP5 ready, even if not yet working in e_strict mode. It relies on the var_dump function to work, does the following code : $profiles = Tracking_Profile::getInstance(); var_dump($profiles); var_dump($profiles); provides the expected result ? If so, where is it possible to see the code for the Tracking_Profile class ?
 [2005-02-08 12:25 UTC] michael dot caplan at lechateau dot ca
Frederic, As requested, here are the results from the var_dumps: object(Tracking_Profile)#20 (7) { ["id:protected"]=> int(18) ["module:protected"]=> string(14) "something else" ["name:protected"]=> string(7) "testing" ["owner_id:protected"]=> int(19923) ["global:protected"]=> bool(false) ["is_default:protected"]=> bool(false) ["tracking_id:protected"]=> int(12) } object(Tracking_Profile)#20 (7) { ["id:protected"]=> int(18) ["module:protected"]=> string(14) "something else" ["name:protected"]=> string(7) "testing" ["owner_id:protected"]=> int(19923) ["global:protected"]=> bool(false) ["is_default:protected"]=> bool(false) ["tracking_id:protected"]=> int(12) } It works as expected. I'll zip up the class file and send it your way for testing. Thanks! Michael
 [2005-02-09 16:17 UTC] fredericpoeydomenge
Thank you for your bug report. This issue has been fixed in the latest released version of the package, which you can download at http://pear.php.net/get/Var_Dump