cvs: php4 /ext/standard array.c
| From: | Derick Rethans | Date: | Mon, 08 Jul 2002 07:02:57 +0000 |
| Subject: | cvs: php4 /ext/standard array.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-12745@lists.php.net to get a copy of this message | ||
derick Mon Jul 8 03:02:57 2002 EDT
Modified files:
/php4/ext/standard array.c
Log:
- Fix for bug #14580: Made key() binary safe
Index: php4/ext/standard/array.c
diff -u php4/ext/standard/array.c:1.169 php4/ext/standard/array.c:1.170
--- php4/ext/standard/array.c:1.169 Sat Jun 29 11:39:41 2002
+++ php4/ext/standard/array.c Mon Jul 8 03:02:55 2002
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: array.c,v 1.169 2002/06/29 15:39:41 derick Exp $ */
+/* $Id: array.c,v 1.170 2002/07/08 07:02:55 derick Exp $ */
#include "php.h"
#include "php_ini.h"
@@ -810,6 +810,7 @@
{
pval **array;
char *string_key;
+ uint string_length;
ulong num_key;
HashTable *target_hash;
@@ -818,12 +819,12 @@
}
target_hash = HASH_OF(*array);
if (!target_hash) {
- php_error(E_WARNING, "Variable passed to key() is not an array or object");
+ php_error(E_WARNING, "%s(): Variable passed is not an array or object",
get_active_function_name (TSRMLS_C));
RETURN_FALSE;
}
- switch (zend_hash_get_current_key(target_hash, &string_key, &num_key, 1)) {
+ switch (zend_hash_get_current_key_ex(target_hash, &string_key, &string_length,
&num_key, 0, NULL)) {
case HASH_KEY_IS_STRING:
- RETVAL_STRING(string_key, 0);
+ RETVAL_STRINGL(string_key, string_length - 1, 1);
break;
case HASH_KEY_IS_LONG:
RETVAL_LONG(num_key);