note 114094 added to function.var-export

From: Date: Fri, 10 Jan 2014 14:11:57 +0000
Subject: note 114094 added to function.var-export
Groups: php.notes 
Request: Send a blank email to php-notes+get-198192@lists.php.net to get a copy of this message
I found that my complex type was exporting with stdClass::__set_state() in places. Not only was that strange and messy, it cannot be eval()-ed back in at all. Fatal error. Doh! However a quick string-replace tidy-up of the result rendered it valid again. $macro = var_export($data, TRUE); $macro = str_replace("stdClass::__set_state", "(object)", $macro); $macro = '$data = ' . $macro . ';'; And now the string I output *can* be evaluated back in again. ---- Server IP: 72.52.91.14 Probable Submitter: 72.52.91.14 ---- Manual Page -- http://php.net/manual/en/function.var-export.php Edit -- https://master.php.net/note/edit/114094 Del: integrated -- https://master.php.net/note/delete/114094/integrated Del: useless -- https://master.php.net/note/delete/114094/useless Del: bad code -- https://master.php.net/note/delete/114094/bad+code Del: spam -- https://master.php.net/note/delete/114094/spam Del: non-english -- https://master.php.net/note/delete/114094/non-english Del: in docs -- https://master.php.net/note/delete/114094/in+docs Del: other reasons-- https://master.php.net/note/delete/114094 Reject -- https://master.php.net/note/reject/114094 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#198192) next »