note 87291 added to function.wddx-deserialize

From: Date: Fri, 28 Nov 2008 13:13:25 +0000
Subject: note 87291 added to function.wddx-deserialize
Groups: php.notes 
Request: Send a blank email to php-notes+get-147064@lists.php.net to get a copy of this message
When deserializing objects make sure you have the class definition loaded. wddx_deserialize() doesn't call the class itself, so you will receive a fatal error. Nevertheless you can look for the class manually and delegate it to __autoload(). <?php // $wddx_string needs to be valid XML to be loaded by SimpleXML. // class_exists() will call the __autoload() function. if you don't // want to use __autoloload(), use require_once() function loadClassesFromWDDX($wddx_string) { $xml = new SimpleXMLElement($wddx_string); foreach ($xml->xpath('//var') as $var) { if ($var['name'] == 'php_class_name') { if (!class_exists($var->string)) { throw new Exception('Class '" . $var->string . "'not available.'); // trigger_error('Class '" . $var->string . "'not available.', E_USER_ERROR); } } } } ?> ---- Server IP: 69.147.83.197 Probable Submitter: 84.183.62.253 ---- Manual Page -- http://www.php.net/manual/en/function.wddx-deserialize.php Edit -- https://master.php.net/note/edit/87291 Del: integrated -- https://master.php.net/note/delete/87291/integrated Del: useless -- https://master.php.net/note/delete/87291/useless Del: bad code -- https://master.php.net/note/delete/87291/bad+code Del: spam -- https://master.php.net/note/delete/87291/spam Del: non-english -- https://master.php.net/note/delete/87291/non-english Del: in docs -- https://master.php.net/note/delete/87291/in+docs Del: other reasons-- https://master.php.net/note/delete/87291 Reject -- https://master.php.net/note/reject/87291 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#147064) next »