1
0
mirror of https://github.com/php/php-src.git synced 2026-04-18 05:21:02 +02:00
Files
archived-php-src/ext/standard/tests/strings/bug40915.phpt
Nikita Popov ea256a218b Add %0 format to run-tests.php
This format matches against null bytes, and prevents the test
expectation from being interpreted as binary data.

bless_tests.php will automatically replace \0 with %0 as well.
2021-05-29 11:33:13 +02:00

21 lines
347 B
PHP

--TEST--
Bug #40915 (addcslashes unexpected behavior with binary input)
--FILE--
<?php
$str = "a\000z";
var_dump(addslashes($str));
var_dump(addcslashes($str, ""));
var_dump(addcslashes($str, "\000z"));
var_dump(addcslashes($str, "z"));
echo "Done\n";
?>
--EXPECTF--
string(4) "a\0z"
string(3) "a%0z"
string(7) "a\000\z"
string(4) "a%0\z"
Done