#29323 [Com]: php5 cannot deserialize greater wddx packets
| From: | php at stew dot org | Date: | Sat, 16 Oct 2004 20:39:56 +0000 |
| Subject: | #29323 [Com]: php5 cannot deserialize greater wddx packets | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-67668@lists.php.net to get a copy of this message | ||
ID: 29323
Comment by: php at stew dot org
Reported By: ralf dot praschak at gmx dot net
Status: Open
Bug Type: WDDX related
Operating System: windows 2000 professional sp4
PHP Version: 5.0.0
New Comment:
I am also having difficulty with deserialize.
If I take an array and run wddx_serialize_vars("thisarr"). Then take
the result and deserialize it, any array keys that are numbers produce
a "no such index" when dereferencing. I was able to work around the
problem with the following:
function SanitizeArray ($arr) {
if (!is_array($arr)) { return $arr; };
while (list($key,$val) = each($arr) ){
if (is_array($val)) { $val = SanitizeArray($val); };
$rtn[$key] = $val;
};
return $rtn;
};
array keys that were strings did not have any problems.
Previous Comments:
------------------------------------------------------------------------
[2004-09-06 17:43:51] s dot lemke at infoworxx dot de
I experienced the same behaviour with php 5.0.1 running on
linux/apache.
------------------------------------------------------------------------
[2004-07-22 11:56:01] ralf dot praschak at gmx dot net
Description:
------------
for exchanging a screenshot gallery i decode every exif information in
a wddx packet. worked without problems in php4.3.x under win32 and
linux.
now with php5.0.0, the wddx is generated proberly but cannot
deserialized. if i reduce the size of the hash, it works, but that is
not a solution. the error.log from apache shows nothing hintful.
Reproduce code:
---------------
1. the wddx generation
// save the cache file
$wddx = wddx_packet_start("Screenshots");
wddx_add_vars($wddx, "sort");
$wddx = wddx_packet_end($wddx);
$wddx = addslashes($wddx);
$file = $_cache."_includes/screenshots.wddx.php";
$fp = fopen($file, "w");
fwrite($fp, $wddx);
fclose($fp);
2. the deserialize process
// read wddx cache file
$wddx = file_get_contents($_cache."_includes/screenshots.wddx.php");
$wddx = stripslashes($wddx);
$wddx = wddx_deserialize($wddx);
$wddx = $wddx["sort"];
Expected result:
----------------
an array with the original hash
Actual result:
--------------
an empty result
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29323&edit=1