andrei Fri Jul 21 23:47:40 2006 UTC
Modified files:
/php-src/ext/standard array.c
Log:
Apply Matt W's patch (with a fix) for array_combine() binary key safety.
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.374&r2=1.375&diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.374 php-src/ext/standard/array.c:1.375
--- php-src/ext/standard/array.c:1.374 Fri Jul 21 23:29:25 2006
+++ php-src/ext/standard/array.c Fri Jul 21 23:47:40 2006
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: array.c,v 1.374 2006/07/21 23:29:25 andrei Exp $ */
+/* $Id: array.c,v 1.375 2006/07/21 23:47:40 andrei Exp $ */
#include "php.h"
#include "php_ini.h"
@@ -4459,7 +4459,7 @@
/* }}} */
/* {{{ proto array array_combine(array keys, array values) U
- Creates an array by using the elements of the first parameter as keys and
the elements of the second as the correspoding values */
+ Creates an array by using the elements of the first parameter as keys and
the elements of the second as the corresponding values */
PHP_FUNCTION(array_combine)
{
zval *values, *keys;
@@ -4475,7 +4475,7 @@
num_values = zend_hash_num_elements(Z_ARRVAL_P(values));
if (num_keys != num_values) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Both parameters
should have equal number of elements");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Both parameters
should have an equal number of elements");
RETURN_FALSE;
}
@@ -4507,7 +4507,7 @@
}
zval_add_ref(entry_values);
- add_u_assoc_zval(return_value, Z_TYPE_P(key_ptr),
Z_UNIVAL_P(key_ptr), *entry_values);
+ add_u_assoc_zval_ex(return_value, Z_TYPE_P(key_ptr),
Z_UNIVAL_P(key_ptr), Z_UNILEN_P(key_ptr)+1, *entry_values);
if (key_ptr != *entry_keys) {
zval_dtor(&key);
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php