note 59021 added to function.wddx-deserialize
| From: | php dot net at werner-ott dot de | Date: | Thu, 24 Nov 2005 08:20:20 +0000 |
| Subject: | note 59021 added to function.wddx-deserialize | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-99009@lists.php.net to get a copy of this message | ||
On migrating wddx_deserialize() from PHP 4.x to PHP 5.1 (5.1.0RC6):
While
$buffer = wddx_serialize_vars($some_array);
$some_array = wddx_deserialize($buffer);
worked fine with PHP 4.x, the deserialization failed with PHP 5.1. In the above example $some_array
will just be an empty string under 5.1
While wddx_serialize_vars() seems to behave identical in 4.x and 5.1, wddx_deserialize() does NOT.
Prepending XML encoding information to the buffer turned out to be at least a workaround. So, the
following works with PHP 5.1:
$buffer = wddx_serialize_vars($some_array);
$buffer = '<?xml version="1.0"
encoding="ISO-8859-1"?>'.
$buffer;
$some_array = wddx_deserialize($buffer);
NB: It may well be, that the behavioural difference between 4.x and 5.1 described above can only be
observed if the array contains certain characters, i.e. german Umlaute (äöüÄÖÜ). So this
workaround may not be necessary in each and every case.
----
Manual Page -- http://www.php.net/manual/en/function.wddx-deserialize.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+59021
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+59021&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+59021&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+59021&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+59021&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+59021&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+59021&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+59021&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+59021&report=yes
Search -- http://master.php.net/manage/user-notes.php