php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48557 Numeric string keys in Apache Hashmaps are not cast to integers
Submitted: 2009-06-15 10:34 UTC Modified: 2009-06-15 17:37 UTC
Votes:8
Avg. Score:5.0 ± 0.0
Reproduced:8 of 8 (100.0%)
Same Version:6 (75.0%)
Same OS:6 (75.0%)
From: kirila dot adamova at bitextender dot com Assigned: dmitry (profile)
Status: Closed Package: SOAP related
PHP Version: 5.3.0RC3 OS: ALL
Private report: No CVE-ID: None
 [2009-06-15 10:34 UTC] kirila dot adamova at bitextender dot com
Description:
------------
When receiving a SOAP response that contains an Apache "Map" encoded 
hashmap, PHP will not decode numeric string keys to integers. As a 
result, those items in the map are never accessible, because an array 
access with a numeric string key implicitly casts the value to an 
integer before doing a value lookup.

Reproduce code:
---------------
(test case and patch to be attached)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-06-15 10:38 UTC] kirila dot adamova at bitextender dot com
Test case: http://pastie.org/512338
WSDL for test: http://pastie.org/512339
Patch: http://pastie.org/512337
 [2009-06-15 14:11 UTC] kirila dot adamova at bitextender dot com
Patch updated to use zend_symtable_update() instead of 
is_numeric_string() checks.

Test case also updated to reflect the (now correct) handling of string 
keys with leading zeros.

All in all a better and simpler patch. Thanks to Matt Wilmas for 
pointing this out!
 [2009-06-15 14:16 UTC] david dot zuelke at bitextender dot com
FYI, the patch is against PHP_5_3
 [2009-06-15 17:37 UTC] felipe@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Fixed in 5.2, 5.3 and HEAD. Thanks for the patch. ;)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC