php-src/Zend/tests/string_offset_as_object.phpt
Nikita Popov b743cd72d0 Fix inference if FETCH_DIM_W user optimized away
In this case the user may be a FREE.

Also add the test file that I forgot in
3ce472d1a6.
2021-10-21 09:58:07 +02:00

64 lines
1.2 KiB
PHP

--TEST--
Using string offset as object
--FILE--
<?php
$str = "x";
try {
$str[0]->bar = "xyz";
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
$str[0]->bar[1] = "bang";
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
$str[0]->bar += 1;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
$str[0]->bar = &$b;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
++$str[0]->bar;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
--$str[0]->bar;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
$str[0]->bar++;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
$str[0]->bar--;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
unset($str[0]->bar);
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Cannot use string offset as an object
Cannot use string offset as an object
Cannot use string offset as an object
Cannot use string offset as an object
Cannot use string offset as an object
Cannot use string offset as an object
Cannot use string offset as an object
Cannot use string offset as an object
Cannot use string offset as an object