derick Tue Dec 18 10:53:26 2007 UTC Modified files: /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: - Fixed var_export() for array keys - Fixed broken explode() test http://cvs.php.net/viewvc.cgi/php-src/ext/standard/var.c?r1=1.272&r2=1.273&diff_format=u Index: php-src/ext/standard/var.c diff -u php-src/ext/standard/var.c:1.272 php-src/ext/standard/var.c:1.273 --- php-src/ext/standard/var.c:1.272 Sun Dec 9 16:54:30 2007 +++ php-src/ext/standard/var.c Tue Dec 18 10:53:25 2007 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: var.c,v 1.272 2007/12/09 16:54:30 derick Exp $ */ +/* $Id: var.c,v 1.273 2007/12/18 10:53:25 derick Exp $ */ /* {{{ includes */ @@ -480,12 +480,13 @@ if (hash_key->type == IS_UNICODE) { php_var_dump_unicode(hash_key->arKey.u, hash_key->nKeyLength-1, 0, "", 1 TSRMLS_CC); } else { - char *key; - int key_len; - + char *key, *tmp_str; + int key_len, tmp_len; key = php_addcslashes(hash_key->arKey.s, hash_key->nKeyLength - 1, &key_len, 0, "'\\", 2 TSRMLS_CC); - PHPWRITE(key, key_len); + tmp_str = php_str_to_str_ex(key, key_len, "\0", 1, "' . \"\\0\" . '", 12, &tmp_len, 0, NULL); + PHPWRITE(tmp_str, tmp_len); efree(key); + efree(tmp_str); } php_printf("' => "); } http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/bug26458.phpt?r1=1.2&r2=1.3&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.3&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.7&r2=1.8&diff_format=u Index: php-src/ext/standard/tests/strings/explode.phpt diff -u php-src/ext/standard/tests/strings/explode.phpt:1.7 php-src/ext/standard/tests/strings/explode.phpt:1.8 --- php-src/ext/standard/tests/strings/explode.phpt:1.7 Tue Mar 6 20:45:15 2007 +++ php-src/ext/standard/tests/strings/explode.phpt Tue Dec 18 10:53:25 2007 @@ -6,6 +6,7 @@ <?php /* From http://bugs.php.net/19865 */ $s = (binary) var_export(explode(b"\1", (binary)"a". chr(1). "b". chr(0). "d" . chr(1) . "f" . chr(1). "1" . chr(1) . "d"), TRUE); +echo $s; echo md5($s); echo "\n"; var_dump(@explode("", "")); @@ -30,7 +31,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) @@ -154,7 +161,13 @@ string(10) "a lazy dog" } --UEXPECTF-- -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