diff options
author | Derick Rethans <derick@php.net> | 2004-12-17 14:40:39 +0000 |
---|---|---|
committer | Derick Rethans <derick@php.net> | 2004-12-17 14:40:39 +0000 |
commit | 13c2cbb515d3fbf4afe010f087c366450edb2371 (patch) | |
tree | d8ef440653c4d4d67062a852d4832639083d5d1e | |
parent | 4394c6f441e8d693bd3c59b7510fd1e5d33b3e68 (diff) | |
download | php-git-13c2cbb515d3fbf4afe010f087c366450edb2371.tar.gz |
- MF43: Fixed bug #31072 (var_export() does not output an array element with an
empty string key). (Derick)
-rw-r--r-- | ext/standard/tests/array/var_export2.phpt | bin | 0 -> 204 bytes | |||
-rw-r--r-- | ext/standard/var.c | 21 |
2 files changed, 7 insertions, 14 deletions
diff --git a/ext/standard/tests/array/var_export2.phpt b/ext/standard/tests/array/var_export2.phpt Binary files differnew file mode 100644 index 0000000000..2b8a1f97ef --- /dev/null +++ b/ext/standard/tests/array/var_export2.phpt diff --git a/ext/standard/var.c b/ext/standard/var.c index be164c151d..c07696aabe 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -319,20 +319,13 @@ static int php_array_element_export(zval **zv, int num_args, va_list args, zend_ 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"); |