This isn't the right fix. You should just fix the if() statement only return 0 if hash_key->arKey[0] == '\0' && hash_key->nKeyLength > 1.
No?


Andi

At 02:40 PM 12/17/2004 +0000, Derick Rethans wrote:
derick          Fri Dec 17 09:40:39 2004 EDT

Modified files:
/php-src/ext/standard var.c
/php-src/ext/standard/tests/array var_export2.phpt
Log:
- MF43: Fixed bug #31072 (var_export() does not output an array element with an
empty string key). (Derick)



http://cvs.php.net/diff.php/php-src/ext/standard/var.c?r1=1.196&r2=1.197&ty=u Index: php-src/ext/standard/var.c diff -u php-src/ext/standard/var.c:1.196 php-src/ext/standard/var.c:1.197 --- php-src/ext/standard/var.c:1.196 Fri Oct 8 15:02:00 2004 +++ php-src/ext/standard/var.c Fri Dec 17 09:40:39 2004 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */

-/* $Id: var.c,v 1.196 2004/10/08 19:02:00 helly Exp $ */
+/* $Id: var.c,v 1.197 2004/12/17 14:40:39 derick Exp $ */


/* {{{ includes
@@ -319,20 +319,13 @@
if (hash_key->nKeyLength==0) { /* numeric key */
php_printf("%*c%ld => ", level + 1, ' ', hash_key->h);
} else { /* string key */
- /* XXX: perphaps when we are inside the class we should permit access to
- * private & protected values
- */
- if (va_arg(args, int) && hash_key->arKey[0] == '\0') {
- return 0;
- } else {
- char *key;
- int key_len;
- key = php_addcslashes(hash_key->arKey, hash_key->nKeyLength - 1, &key_len, 0, "'\\", 2 TSRMLS_CC);
- php_printf("%*c'", level + 1, ' ');
- PHPWRITE(key, key_len);
- php_printf("' => ");
- efree(key);
- }
+ char *key;
+ int key_len;
+ key = php_addcslashes(hash_key->arKey, hash_key->nKeyLength - 1, &key_len, 0, "'\\", 2 TSRMLS_CC);
+ php_printf("%*c'", level + 1, ' ');
+ PHPWRITE(key, key_len);
+ php_printf("' => ");
+ efree(key);
}
php_var_export(zv, level + 2 TSRMLS_CC);
PUTS (",\n");
http://cvs.php.net/diff.php/php-src/ext/standard/tests/array/var_export2.phpt?r1=1.1&r2=1.2&ty=u
Index: php-src/ext/standard/tests/array/var_export2.phpt


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to