#29361 [Asn->Csd]: var_export producing invalid code

From: Date: Mon, 17 Oct 2005 15:03:37 +0000
Subject: #29361 [Asn->Csd]: var_export producing invalid code
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-86651@lists.php.net to get a copy of this message
ID: 29361 Updated by: derick@php.net Reported By: Knightking at smempire dot org -Status: Assigned +Status: Closed Bug Type: Class/Object related Operating System: XP PHP Version: 4.3.8 Assigned To: derick New Comment: This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Fixed for PHP 5.1.0 and 6.0.0 (and higher). Previous Comments: ------------------------------------------------------------------------ [2005-10-17 10:55:54] derick@php.net I found a way myself now, assigning. ------------------------------------------------------------------------ [2004-08-02 12:57:01] derick@php.net THere is no way how this can be fixed; if you can think of something how this should work, please provide a patch. ------------------------------------------------------------------------ [2004-07-29 09:39:55] degusta at yahoo dot com A similar, perhaps identical problem also occurs with arrays that contain objects. In that case the code produced by var_export causes an unexpected T_CLASS parse error. Here's the code produced by var_export for the array with an object: array ( 0 => class myclass { var $myProperty = 'myValue'; }, ); ------------------------------------------------------------------------ [2004-07-24 00:14:37] Knightking at smempire dot org Description: ------------ When var_export is called on an object which has another object as one of its members, it does not produce valid code. Reproduce code: --------------- $a->b = 1; eval(var_export($a, 1) . ';'); Actual result: -------------- Fatal error: Cannot redeclare class stdclass in test.php(3) : eval()'d code on line 1 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29361&edit=1

« previous php.bugs (#86651) next »