#25837 [Opn->WFx]: var-exports fails to produce valid PHP in some cases

From: Date: Sat, 17 Jan 2004 18:19:21 +0000
Subject: #25837 [Opn->WFx]: var-exports fails to produce valid PHP in some cases
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-53494@lists.php.net to get a copy of this message
ID: 25837 Updated by: derick@php.net Reported By: manu at chasqui dot cu -Status: Open +Status: Wont fix Bug Type: Variables related Operating System: Windows Xp-Pro/Apache 1.3.24 PHP Version: 4.3.3 New Comment: Nah, it's not a bug. Just don't do it Previous Comments: ------------------------------------------------------------------------ [2004-01-17 10:06:29] andrey@php.net Well, var_export() is almost meaningless for objects since it gives you the internal representation by "class fubar ..." however in a runnning system a class can be defined only once - so the usage of var_export() with objects is quite limited. Additionally circular references are hardly handled by most of the PHP functions and even by the core (see PHP5 which currently does not destruct objects if there is a circular reference). However moving that to bug, since var_export() should fail if some of the member variables is an object itself. ------------------------------------------------------------------------ [2003-10-11 10:26:29] manu at chasqui dot cu Description: ------------ var_export fails to reproduce valid code when dumping several nested objects. Reproduce code: --------------- <?php class VE_Test { var $child; } $ve_child = new VE_Test(); $ve_child->child = NULL; $ve_parent = new VE_Test(); $ve_parent->child = &$ve_child; var_export($ve_parent); ?> Expected result: ---------------- Actually I can't make a proposal without requiring more from PHP: with (new VE_Test()){ child = with (new VE_Test()){ child = NULL; } } This is just a proposal, there can be other better ways. Actual result: -------------- class ve_test { var $child = class ve_test { var $child = NULL; }; } Which fails to compile: Parse error: parse error, unexpected T_CLASS in d:\inetpub\tests\tests\php\vd.php on line 4 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=25837&edit=1

« previous php.bugs (#53494) next »