1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 16:22:37 +01:00
Files
archived-php-src/ext/spl/tests/array_018.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

47 lines
633 B
PHP

--TEST--
SPL: ArrayObject and \0
--FILE--
<?php
try
{
$foo = new ArrayObject();
$foo->offsetSet("\0", "Foo");
}
catch (Exception $e)
{
var_dump($e->getMessage());
}
var_dump($foo);
try
{
$foo = new ArrayObject();
$data = explode("=", "=Foo");
$foo->offsetSet($data[0], $data[1]);
}
catch (Exception $e)
{
var_dump($e->getMessage());
}
var_dump($foo);
?>
--EXPECTF--
object(ArrayObject)#1 (1) {
["storage":"ArrayObject":private]=>
array(1) {
["%0"]=>
string(3) "Foo"
}
}
object(ArrayObject)#2 (1) {
["storage":"ArrayObject":private]=>
array(1) {
[""]=>
string(3) "Foo"
}
}