#29361 [Opn->WFx]: var_export producing invalid code
| From: | derick@php.net | Date: | Mon, 02 Aug 2004 10:57:03 +0000 |
| Subject: | #29361 [Opn->WFx]: var_export producing invalid code | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-63918@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: Open
+Status: Wont fix
Bug Type: Class/Object related
Operating System: XP
PHP Version: 4.3.8
New Comment:
THere is no way how this can be fixed; if you can think of something
how this should work, please provide a patch.
Previous Comments:
------------------------------------------------------------------------
[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