php-src/Zend/tests/bug71841.phpt
Nikita Popov 32315c247f Promote incomplete class to modification to Error
In line with engine diagnostic promotions, property writes throw
an Error exception, while reads throw a warning.
2020-08-28 11:14:43 +02:00

46 lines
1.6 KiB
PHP

--TEST--
Bug #71841 (EG(error_zval) is not handled well)
--FILE--
<?php
$z = unserialize('O:1:"A":0:{}');
try {
var_dump($z->e.=0);
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
var_dump(++$z->x);
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
var_dump($z->y++);
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
$y = array(PHP_INT_MAX => 0);
try {
var_dump($y[] .= 0);
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
var_dump(++$y[]);
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
var_dump($y[]++);
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
The script tried to modify a property on an incomplete object. Please ensure that the class definition "A" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition
The script tried to modify a property on an incomplete object. Please ensure that the class definition "A" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition
The script tried to modify a property on an incomplete object. Please ensure that the class definition "A" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition
Cannot add element to the array as the next element is already occupied
Cannot add element to the array as the next element is already occupied
Cannot add element to the array as the next element is already occupied