summaryrefslogtreecommitdiff
path: root/Zend/tests/bug71572.phpt
blob: f4079e55f89a03c2d19cc280d155d9851ae3db6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
--TEST--
Bug #71572: String offset assignment from an empty string inserts null byte
--FILE--
<?php

$str = "abc";
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;
}
var_dump($str);
?>
--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
string(3) "abc"