derick Wed Dec 19 08:45:16 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/standard var.c /php-src/ext/standard/tests/array bug26458.phpt var_export2.phpt /php-src/ext/standard/tests/strings explode.phpt Log: - MFH: Fixed var_export() for array keys - MFH: Fixed broken explode() test http://cvs.php.net/viewvc.cgi/php-src/ext/standard/var.c?r1=1.203.2.7.2.20&r2=1.203.2.7.2.21&diff_format=u Index: php-src/ext/standard/var.c diff -u php-src/ext/standard/var.c:1.203.2.7.2.20 php-src/ext/standard/var.c:1.203.2.7.2.21 --- php-src/ext/standard/var.c:1.203.2.7.2.20 Sun Dec 9 16:55:46 2007 +++ php-src/ext/standard/var.c Wed Dec 19 08:45:15 2007 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: var.c,v 1.203.2.7.2.20 2007/12/09 16:55:46 derick Exp $ */ +/* $Id: var.c,v 1.203.2.7.2.21 2007/12/19 08:45:15 derick Exp $ */ @@ -355,13 +355,15 @@ if (hash_key->nKeyLength==0) { /* numeric key */ php_printf("%*c%ld => ", level + 1, ' ', hash_key->h); } else { /* string key */ - char *key; - int key_len; + char *key, *tmp_str; + int key_len, tmp_len; key = php_addcslashes(hash_key->arKey, hash_key->nKeyLength - 1, &key_len, 0, "'\\", 2 TSRMLS_CC); + tmp_str = php_str_to_str_ex(key, key_len, "\0", 1, "' . \"\\0\" . '", 12, &tmp_len, 0, NULL); php_printf("%*c'", level + 1, ' '); - PHPWRITE(key, key_len); + PHPWRITE(tmp_str, tmp_len); php_printf("' => "); efree(key); + efree(tmp_str); } php_var_export(zv, level + 2 TSRMLS_CC); PUTS (",\n"); http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/bug26458.phpt?r1=1.1&r2=1.1.8.1&diff_format=u Index: php-src/ext/standard/tests/array/bug26458.phpt http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/var_export2.phpt?r1=1.2&r2=1.2.4.1&diff_format=u Index: php-src/ext/standard/tests/array/var_export2.phpt http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/explode.phpt?r1=1.4.4.1&r2=1.4.4.2&diff_format=u Index: php-src/ext/standard/tests/strings/explode.phpt diff -u php-src/ext/standard/tests/strings/explode.phpt:1.4.4.1 php-src/ext/standard/tests/strings/explode.phpt:1.4.4.2 --- php-src/ext/standard/tests/strings/explode.phpt:1.4.4.1 Mon Oct 9 18:08:34 2006 +++ php-src/ext/standard/tests/strings/explode.phpt Wed Dec 19 08:45:16 2007 @@ -5,6 +5,7 @@ --FILE-- <?php /* From http://bugs.php.net/19865 */ +echo var_export(explode("\1", "a". chr(1). "b". chr(0). "d" . chr(1) . "f" . chr(1). "1" . chr(1) . "d"), TRUE); echo md5(var_export(explode("\1", "a". chr(1). "b". chr(0). "d" . chr(1) . "f" . chr(1). "1" . chr(1) . "d"), TRUE)); echo "\n"; var_dump(@explode("", "")); @@ -29,7 +30,13 @@ var_dump(explode(":^:","a lazy dog:^:jumps::over:^:",-2)); ?> --EXPECTF-- -6e5d59d5afd6693547a733219d079658 +array ( + 0 => 'a', + 1 => 'b' . "\0" . 'd', + 2 => 'f', + 3 => '1', + 4 => 'd', +)d6bee42a771449205344c0938ad4f035 bool(false) bool(false) bool(false)
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php