xref: /PHP-7.4/Zend/tests/bug71572.phpt (revision d574df63)
1--TEST--
2Bug #71572: String offset assignment from an empty string inserts null byte
3--FILE--
4<?php
5
6$str = "abc";
7var_dump($str[0] = "");
8var_dump($str[1] = "");
9var_dump($str[3] = "");
10var_dump($str[10] = "");
11var_dump($str);
12?>
13==DONE==
14--EXPECTF--
15Warning: Cannot assign an empty string to a string offset in %s on line %d
16NULL
17
18Warning: Cannot assign an empty string to a string offset in %s on line %d
19NULL
20
21Warning: Cannot assign an empty string to a string offset in %s on line %d
22NULL
23
24Warning: Cannot assign an empty string to a string offset in %s on line %d
25NULL
26string(3) "abc"
27==DONE==
28