mirror of
https://github.com/php/php-src.git
synced 2026-03-24 16:22:37 +01:00
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.
47 lines
633 B
PHP
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"
|
|
}
|
|
}
|