2016-02-12 07:01:59 +08:00
|
|
|
--TEST--
|
|
|
|
Bug #71572: String offset assignment from an empty string inserts null byte
|
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
|
|
|
|
$str = "abc";
|
2020-01-08 04:51:34 +08:00
|
|
|
try {
|
|
|
|
var_dump($str[0] = "");
|
|
|
|
} catch (\Error $e) {
|
|
|
|
echo $e->getMessage() . \PHP_EOL;
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
var_dump($str[1] = "");
|
|
|
|
} catch (\Error $e) {
|
|
|
|
echo $e->getMessage() . \PHP_EOL;
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
var_dump($str[3] = "");
|
|
|
|
} catch (\Error $e) {
|
|
|
|
echo $e->getMessage() . \PHP_EOL;
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
var_dump($str[10] = "");
|
|
|
|
} catch (\Error $e) {
|
|
|
|
echo $e->getMessage() . \PHP_EOL;
|
|
|
|
}
|
2016-02-12 07:01:59 +08:00
|
|
|
var_dump($str);
|
|
|
|
?>
|
2020-01-08 04:51:34 +08:00
|
|
|
--EXPECT--
|
|
|
|
Cannot assign an empty string to a string offset
|
|
|
|
Cannot assign an empty string to a string offset
|
|
|
|
Cannot assign an empty string to a string offset
|
|
|
|
Cannot assign an empty string to a string offset
|
2016-02-12 07:01:59 +08:00
|
|
|
string(3) "abc"
|