]> granicus.if.org Git - php/commitdiff
MFB: Fixed bug #43614 (incorrect processing of numerical string keys of array in...
authorFelipe Pena <felipe@php.net>
Wed, 19 Mar 2008 03:12:39 +0000 (03:12 +0000)
committerFelipe Pena <felipe@php.net>
Wed, 19 Mar 2008 03:12:39 +0000 (03:12 +0000)
ext/standard/tests/serialize/bug43614.phpt [new file with mode: 0644]
ext/standard/var_unserializer.c
ext/standard/var_unserializer.re

diff --git a/ext/standard/tests/serialize/bug43614.phpt b/ext/standard/tests/serialize/bug43614.phpt
new file mode 100644 (file)
index 0000000..127dfba
--- /dev/null
@@ -0,0 +1,21 @@
+--TEST--
+Bug #43614 (incorrect processing of numerical string keys of array in arbitrary serialized data)
+--FILE--
+<?php
+
+error_reporting(E_ALL);
+
+var_dump($a = unserialize('a:2:{s:2:"10";i:1;s:2:"01";i:2;}'));
+var_dump($a['10']);
+var_dump($a['01']);
+
+?>
+--EXPECT--
+array(2) {
+  [10]=>
+  int(1)
+  ["01"]=>
+  int(2)
+}
+int(1)
+int(2)
index 18fc14be163a7b3a13b8162fd87489b94cff9f00..21583553efe4ffb0b767c14f0ac352c6451ef926 100644 (file)
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.12.1 on Mon Aug  6 21:30:07 2007 */
+/* Generated by re2c 0.12.3 on Wed Mar 19 00:06:59 2008 */
 #line 1 "ext/standard/var_unserializer.re"
 /*
   +----------------------------------------------------------------------+
@@ -326,10 +326,10 @@ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, long
                                break;
                        case IS_STRING:
                        case IS_UNICODE:
-                               if (zend_u_hash_find(ht, Z_TYPE_P(key), Z_UNIVAL_P(key), Z_UNILEN_P(key) + 1, (void **)&old_data)==SUCCESS) {
+                               if (zend_u_symtable_find(ht, Z_TYPE_P(key), Z_UNIVAL_P(key), Z_UNILEN_P(key) + 1, (void **)&old_data)==SUCCESS) {
                                        var_push_dtor(var_hash, old_data);
                                }
-                               zend_u_hash_update(ht, Z_TYPE_P(key), Z_UNIVAL_P(key), Z_UNILEN_P(key) + 1, &data, sizeof(data), NULL);
+                               zend_u_symtable_update(ht, Z_TYPE_P(key), Z_UNIVAL_P(key), Z_UNILEN_P(key) + 1, &data, sizeof(data), NULL);
                                break;
                }
 
index b50e2e503224d4980c4b2656ac373e81ec179919..2f9041b5b1cd576d8ca5ab86246728aa355f5de5 100644 (file)
@@ -330,10 +330,10 @@ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, long
                                break;
                        case IS_STRING:
                        case IS_UNICODE:
-                               if (zend_u_hash_find(ht, Z_TYPE_P(key), Z_UNIVAL_P(key), Z_UNILEN_P(key) + 1, (void **)&old_data)==SUCCESS) {
+                               if (zend_u_symtable_find(ht, Z_TYPE_P(key), Z_UNIVAL_P(key), Z_UNILEN_P(key) + 1, (void **)&old_data)==SUCCESS) {
                                        var_push_dtor(var_hash, old_data);
                                }
-                               zend_u_hash_update(ht, Z_TYPE_P(key), Z_UNIVAL_P(key), Z_UNILEN_P(key) + 1, &data, sizeof(data), NULL);
+                               zend_u_symtable_update(ht, Z_TYPE_P(key), Z_UNIVAL_P(key), Z_UNILEN_P(key) + 1, &data, sizeof(data), NULL);
                                break;
                }