|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-07-24 00:14 UTC] 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 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 06:00:01 2025 UTC |
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'; }, );