PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » PHP » Var_Dump » Bug #3396

Var_Dump::toString() sets object variables

Details

Submitted2005-02-07 21:10 UTC
Frommichael dot caplan at lechateau dot ca
Assignedfredericpoeydomenge
StatusClosed
PackageVar_Dump
PHP Version5.0.3
OSRHE 3
Roadmaps(Not assigned)

Comments

[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

[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