1
0
mirror of https://github.com/php/php-src.git synced 2026-04-26 17:38:14 +02:00
Files
archived-php-src/ext/standard/tests/serialize/incomplete_class.phpt
T
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

31 lines
1.2 KiB
PHP

--TEST--
(un)serializing __PHP_Incomplete_Class instance
--FILE--
<?php
$d = serialize(new __PHP_Incomplete_Class);
$o = unserialize($d);
var_dump($o);
try {
$o->test = "a";
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
var_dump($o->test);
var_dump($o->test2);
echo "Done\n";
?>
--EXPECTF--
object(__PHP_Incomplete_Class)#%d (0) {
}
The script tried to modify a property on an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition
Warning: main(): The script tried to access a property on an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
NULL
Warning: main(): The script tried to access a property on an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
NULL
Done