From: Ilia Alshanetsky Date: Mon, 9 Oct 2006 18:08:34 +0000 (+0000) Subject: Fixed bug #37262 (var_export() does not escape \0 character). X-Git-Tag: php-5.2.0RC6~63 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7b77d536c32fb560a47eab8aa9f0acd21957f9e0;p=php Fixed bug #37262 (var_export() does not escape \0 character). --- diff --git a/NEWS b/NEWS index 7d2c60a04f..d5bc2d0d5d 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,7 @@ PHP NEWS - Fixed PECL bug #8816 (issue in php_oci_statement_fetch with more than one piecewise column) (jeff at badtz-maru dot com, Tony) - Fixed bug #39067 (getDeclaringClass() and private properties). (Tony) +- Fixed bug #37262 (var_export() does not escape \0 character). (Ilia) 05 Oct 2006, PHP 5.2.0RC5 - Updated bundled OpenSSL to version 0.9.8d in the Windows distro. (Edin) diff --git a/ext/standard/tests/strings/bug37262.phpt b/ext/standard/tests/strings/bug37262.phpt new file mode 100644 index 0000000000..474251a816 --- /dev/null +++ b/ext/standard/tests/strings/bug37262.phpt @@ -0,0 +1,9 @@ +--TEST-- +Bug #37262 (var_export() does not escape \0 character) +--FILE-- + +--EXPECT-- +'\000lambda_1' diff --git a/ext/standard/tests/strings/explode.phpt b/ext/standard/tests/strings/explode.phpt index 1198a09a97..defb79c229 100644 --- a/ext/standard/tests/strings/explode.phpt +++ b/ext/standard/tests/strings/explode.phpt @@ -29,7 +29,7 @@ var_dump(explode(":^:","a lazy dog:^:jumps::over:^:",-1)); var_dump(explode(":^:","a lazy dog:^:jumps::over:^:",-2)); ?> --EXPECTF-- -26d4e18734cb2582df5055e2175223df +6e5d59d5afd6693547a733219d079658 bool(false) bool(false) bool(false) diff --git a/ext/standard/var.c b/ext/standard/var.c index 1292d6b536..32ce4daa2b 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -416,7 +416,7 @@ PHPAPI void php_var_export(zval **struc, int level TSRMLS_DC) php_printf("%.*G", (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, "'\\", 2 TSRMLS_CC); + tmp_str = php_addcslashes(Z_STRVAL_PP(struc), Z_STRLEN_PP(struc), &tmp_len, 0, "'\\\0", 3 TSRMLS_CC); PUTS ("'"); PHPWRITE(tmp_str, tmp_len); PUTS ("'");