Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.0.2

Bug #2118 PEAR Wddx is wrong with associative arrays
Submitted: 2004-08-13 00:01 UTC
From: ez at daoldskool dot org Assigned: alan_k
Status: Closed Package: XML_Wddx
PHP Version: 4.3.6 OS: Windows / Linux
Roadmaps: (Not assigned)    
Subscription  


 [2004-08-13 00:01 UTC] ez at daoldskool dot org
Description: ------------ PEAR Wddx library has a buggy data types handler when serializing associative php arrays (collections/hash tables/dictionnaries...) with non strictly sequential numeric keys it is interpreting keys as indexes for normal real php arrays as a result keys are lost another minor bug is when dealing with numeric string http://www.peoplemode.com/__dev/test/XML_wddx/PEAR/ Reproduce code: --------------- http://www.peoplemode.com/__dev/test/XML_wddx/PEAR/ Expected result: ---------------- should have struct nodes Actual result: -------------- got array nodes instead and numeric keys are lost

Comments

 [2004-08-13 01:07 UTC] alan_k
Can you try the CVS version - I've added the fixes that I spotted. Regards Alan
 [2004-08-13 01:31 UTC] ez at daoldskool dot org
sure Alan but you forgot the most important: _serializeValue did you carefully take a look at the diff : http://www.peoplemode.com/__dev/test/XML_wddx/PEAR/index.php?debug=2&libdiff what's the use of adding _isInt and _isAssoc private methods if you don't call them somewhere besides your swith/case tests are always wrong: switch (gettype($value)) { case 'string': ... you should have this instead: switch (strtolower(gettype($value))) { case 'string': ... anyway my fixes in _serializeValue private methods don't need gettype anymore as it is not strictly reliable best regards Antonin
 [2004-08-13 01:36 UTC] alan_k
have a look at this. http://cvs.php.net/diff.php/pear/XML_Wddx/Wddx.php?ws=0&r1=1.2&r2=1.4&ty=u It should do the same thing. Regards Alan
 [2004-08-13 01:53 UTC] ez at daoldskool dot org
OK we do agree now. Thanx for considering my bug submission. Will you commit the changes in your next release ?
 [2004-08-13 01:54 UTC] alan_k
can you do a quick test to make sure it works, then I'll fire of a release Thanks Alan
 [2004-08-13 02:01 UTC] ez at daoldskool dot org
sure Alan here is the test: http://www.peoplemode.com/__dev/test/XML_wddx/PEAR/#code2 no more diffs the array is now correctly serialized and when re-serialize it again i got the full array back ;) best regards Antonin
 [2004-08-13 02:10 UTC] alan_k
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on pear.php.net. In case this was a pear.php.net website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better. and released Thanks Alan