derick Sun Dec 9 16:55:47 2007 UTC Added files: (Branch: PHP_5_2) /php-src/ext/standard/tests/general_functions bug42272.phpt
Modified files: /php-src NEWS /php-src/ext/standard var.c /php-src/ext/standard/tests/general_functions var_export-locale.phpt var_export.phpt /php-src/ext/standard/tests/strings bug37262.phpt Log: - MFH: Fixed Bug #42272 (var_export() incorrectly escapes char(0)). http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1030&r2=1.2027.2.547.2.1031&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.1030 php-src/NEWS:1.2027.2.547.2.1031 --- php-src/NEWS:1.2027.2.547.2.1030 Sun Dec 9 16:37:01 2007 +++ php-src/NEWS Sun Dec 9 16:55:46 2007 @@ -43,6 +43,7 @@ - Fixed bug #42736 (xmlrpc_server_call_method() crashes). (Tony) - Fixed bug #42692 (Procedure 'int1' not present with doc/lit SoapServer). (Dmitry) +- Fixed bug #42272 (var_export() incorrectly escapes char(0)). (Derick) - Fixed bug #42261 (Incorrect lengths for date and boolean data types). (Ilia) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/var.c?r1=1.203.2.7.2.19&r2=1.203.2.7.2.20&diff_format=u Index: php-src/ext/standard/var.c diff -u php-src/ext/standard/var.c:1.203.2.7.2.19 php-src/ext/standard/var.c:1.203.2.7.2.20 --- php-src/ext/standard/var.c:1.203.2.7.2.19 Thu Oct 4 13:31:11 2007 +++ php-src/ext/standard/var.c Sun Dec 9 16:55:46 2007 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: var.c,v 1.203.2.7.2.19 2007/10/04 13:31:11 jani Exp $ */ +/* $Id: var.c,v 1.203.2.7.2.20 2007/12/09 16:55:46 derick Exp $ */ @@ -389,8 +389,8 @@ PHPAPI void php_var_export(zval **struc, int level TSRMLS_DC) { HashTable *myht; - char* tmp_str; - int tmp_len; + char *tmp_str, *tmp_str2; + int tmp_len, tmp_len2; char *class_name; zend_uint class_name_len; @@ -408,11 +408,13 @@ php_printf("%.*H", (int) EG(precision), Z_DVAL_PP(struc)); break; case IS_STRING: - tmp_str = php_addcslashes(Z_STRVAL_PP(struc), Z_STRLEN_PP(struc), &tmp_len, 0, "'\\\0", 3 TSRMLS_CC); + tmp_str = php_addcslashes(Z_STRVAL_PP(struc), Z_STRLEN_PP(struc), &tmp_len, 0, "'\\", 2 TSRMLS_CC); + tmp_str2 = php_str_to_str_ex(tmp_str, tmp_len, "\0", 1, "' . \"\\0\" . '", 12, &tmp_len2, 0, NULL); PUTS ("'"); - PHPWRITE(tmp_str, tmp_len); + PHPWRITE(tmp_str2, tmp_len2); PUTS ("'"); - efree (tmp_str); + efree(tmp_str2); + efree(tmp_str); break; case IS_ARRAY: myht = Z_ARRVAL_PP(struc); http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/var_export-locale.phpt?r1=1.1.2.2&r2=1.1.2.3&diff_format=u Index: php-src/ext/standard/tests/general_functions/var_export-locale.phpt diff -u php-src/ext/standard/tests/general_functions/var_export-locale.phpt:1.1.2.2 php-src/ext/standard/tests/general_functions/var_export-locale.phpt:1.1.2.3 --- php-src/ext/standard/tests/general_functions/var_export-locale.phpt:1.1.2.2 Tue Jun 19 12:20:50 2007 +++ php-src/ext/standard/tests/general_functions/var_export-locale.phpt Sun Dec 9 16:55:46 2007 @@ -572,9 +572,9 @@ Iteration 12 -'\000' -'\000' -string(6) "'\000'" +'' . "\0" . '' +'' . "\0" . '' +string(14) "'' . "\0" . ''" Iteration 13 http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/var_export.phpt?r1=1.1.2.2&r2=1.1.2.3&diff_format=u Index: php-src/ext/standard/tests/general_functions/var_export.phpt diff -u php-src/ext/standard/tests/general_functions/var_export.phpt:1.1.2.2 php-src/ext/standard/tests/general_functions/var_export.phpt:1.1.2.3 --- php-src/ext/standard/tests/general_functions/var_export.phpt:1.1.2.2 Tue May 29 10:25:33 2007 +++ php-src/ext/standard/tests/general_functions/var_export.phpt Sun Dec 9 16:55:46 2007 @@ -565,9 +565,9 @@ Iteration 12 -'\000' -'\000' -string(6) "'\000'" +'' . "\0" . '' +'' . "\0" . '' +string(14) "'' . "\0" . ''" Iteration 13 http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/bug37262.phpt?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-src/ext/standard/tests/strings/bug37262.phpt diff -u php-src/ext/standard/tests/strings/bug37262.phpt:1.1.2.1 php-src/ext/standard/tests/strings/bug37262.phpt:1.1.2.2 --- php-src/ext/standard/tests/strings/bug37262.phpt:1.1.2.1 Mon Oct 9 18:08:34 2006 +++ php-src/ext/standard/tests/strings/bug37262.phpt Sun Dec 9 16:55:46 2007 @@ -6,4 +6,4 @@ var_export($func); ?> --EXPECT-- -'\000lambda_1' +'' . "\0" . 'lambda_1' http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/bug42272.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/general_functions/bug42272.phpt +++ php-src/ext/standard/tests/general_functions/bug42272.phpt --TEST-- Bug #42272: var_export() incorrectly escapes char(0). --FILE-- <?php $foo = var_export("\0", true ); echo $foo, "\n"; var_export("a\0b"); ?> --EXPECT-- '' . "\0" . '' 'a' . "\0" . 'b' -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php