mirror of
https://github.com/php/php-src.git
synced 2025-01-09 12:34:14 +08:00
MFB: Fixed bug #37262 (var_export() does not escape \0 character).
This commit is contained in:
parent
31212f9c0b
commit
e8ccee4873
9
ext/standard/tests/strings/bug37262.phpt
Normal file
9
ext/standard/tests/strings/bug37262.phpt
Normal file
@ -0,0 +1,9 @@
|
||||
--TEST--
|
||||
Bug #37262 (var_export() does not escape \0 character)
|
||||
--FILE--
|
||||
<?php
|
||||
$func = create_function('$a', 'return $a;');
|
||||
var_export($func);
|
||||
?>
|
||||
--EXPECT--
|
||||
'\000lambda_1'
|
@ -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)
|
||||
|
@ -543,7 +543,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 ("'");
|
||||
|
Loading…
Reference in New Issue
Block a user