zend_hash_update question
| From: | David Zülke | Date: | Mon, 15 Jun 2009 13:13:57 +0000 |
| Subject: | zend_hash_update question | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-44283@lists.php.net to get a copy of this message | ||
Hi folks,
while fixing http://bugs.php.net/bug.php?id=48557 I was wondering why zend_hash_update doesn't automatically convert numeric strings to integers.
Doing $foo = array('1' => 'bar'); actually results in an integer key with value 1, not in a string. The problem in the bug above was that when ext/soap decodes keys from a hashmap, it won't convert numeric string keys to integers. As a result, such items in an array were never accessible from PHP code (that is, unless you did some array_keys()/array_values() stunts, of course).
Is this intentional? It seems that every internal feature that would like to deal with hashes needs to implement this string->int casting behavior of PHP itself. Why doesn't zend_hash_update() do it automatically?
Cheers,
David
Attachment: [application/pkcs7-signature] smime.p7s
Attachment: [application/pkcs7-signature] smime.p7s