moriyoshi Fri Oct 3 18:41:44 2003 EDT
Modified files:
/ZendEngine2 zend_API.c
/php-src/ext/standard/tests/array bug24766.phpt
Log:
Fixed bug #24766 (strange result array from unpack())
Index: ZendEngine2/zend_API.c
diff -u ZendEngine2/zend_API.c:1.218 ZendEngine2/zend_API.c:1.219
--- ZendEngine2/zend_API.c:1.218 Thu Sep 18 06:21:38 2003
+++ ZendEngine2/zend_API.c Fri Oct 3 18:41:42 2003
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_API.c,v 1.218 2003/09/18 10:21:38 helly Exp $ */
+/* $Id: zend_API.c,v 1.219 2003/10/03 22:41:42 moriyoshi Exp $ */
#include "zend.h"
#include "zend_execute.h"
@@ -745,7 +745,7 @@
MAKE_STD_ZVAL(tmp);
ZVAL_LONG(tmp, n);
- return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp,
sizeof(zval *), NULL);
+ return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp,
sizeof(zval *), NULL);
}
ZEND_API int add_assoc_null_ex(zval *arg, char *key, uint key_len)
@@ -755,7 +755,7 @@
MAKE_STD_ZVAL(tmp);
ZVAL_NULL(tmp);
- return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp,
sizeof(zval *), NULL);
+ return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp,
sizeof(zval *), NULL);
}
ZEND_API int add_assoc_bool_ex(zval *arg, char *key, uint key_len, int b)
@@ -765,7 +765,7 @@
MAKE_STD_ZVAL(tmp);
ZVAL_BOOL(tmp, b);
- return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp,
sizeof(zval *), NULL);
+ return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp,
sizeof(zval *), NULL);
}
ZEND_API int add_assoc_resource_ex(zval *arg, char *key, uint key_len, int r)
@@ -775,7 +775,7 @@
MAKE_STD_ZVAL(tmp);
ZVAL_RESOURCE(tmp, r);
- return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp,
sizeof(zval *), NULL);
+ return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp,
sizeof(zval *), NULL);
}
@@ -786,7 +786,7 @@
MAKE_STD_ZVAL(tmp);
ZVAL_DOUBLE(tmp, d);
- return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp,
sizeof(zval *), NULL);
+ return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp,
sizeof(zval *), NULL);
}
@@ -797,7 +797,7 @@
MAKE_STD_ZVAL(tmp);
ZVAL_STRING(tmp, str, duplicate);
- return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp,
sizeof(zval *), NULL);
+ return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp,
sizeof(zval *), NULL);
}
@@ -808,12 +808,12 @@
MAKE_STD_ZVAL(tmp);
ZVAL_STRINGL(tmp, str, length, duplicate);
- return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp,
sizeof(zval *), NULL);
+ return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp,
sizeof(zval *), NULL);
}
ZEND_API int add_assoc_zval_ex(zval *arg, char *key, uint key_len, zval *value)
{
- return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &value,
sizeof(zval *), NULL);
+ return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &value,
sizeof(zval *), NULL);
}
@@ -989,7 +989,7 @@
MAKE_STD_ZVAL(tmp);
ZVAL_STRING(tmp, str, duplicate);
- return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp,
sizeof(zval *), dest);
+ return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp,
sizeof(zval *), dest);
}
@@ -1000,7 +1000,7 @@
MAKE_STD_ZVAL(tmp);
ZVAL_STRINGL(tmp, str, length, duplicate);
- return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp,
sizeof(zval *), dest);
+ return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp,
sizeof(zval *), dest);
}
Index: php-src/ext/standard/tests/array/bug24766.phpt
diff -u php-src/ext/standard/tests/array/bug24766.phpt:1.1
php-src/ext/standard/tests/array/bug24766.phpt:1.2
--- php-src/ext/standard/tests/array/bug24766.phpt:1.1 Fri Oct 3 01:47:07 2003
+++ php-src/ext/standard/tests/array/bug24766.phpt Fri Oct 3 18:41:43 2003
@@ -5,15 +5,16 @@
error_reporting(E_ALL);
-$a=unpack('C2', "\0224V");
-debug_zval_dump($a);
-$k=array_keys($a);
-debug_zval_dump($k);
-
+$a = unpack('C2', "\0224V");
+$b = array(1 => 18, 2 => 52);
+debug_zval_dump($a, $b);
+$k = array_keys($a);
+$l = array_keys($b);
+debug_zval_dump($k, $l);
$i=$k[0];
-
-echo $a[$i],"\n";
-
+var_dump($a[$i]);
+$i=$l[0];
+var_dump($b[$i]);
?>
--EXPECT--
array(2) refcount(2){
@@ -23,9 +24,22 @@
long(52) refcount(1)
}
array(2) refcount(2){
+ [1]=>
+ long(18) refcount(1)
+ [2]=>
+ long(52) refcount(1)
+}
+array(2) refcount(2){
+ [0]=>
+ long(1) refcount(1)
+ [1]=>
+ long(2) refcount(1)
+}
+array(2) refcount(2){
[0]=>
long(1) refcount(1)
[1]=>
long(2) refcount(1)
}
-18
+int(18)
+int(18)
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php