xref: /PHP-8.0/Zend/tests/bug71841.phpt (revision 32315c24)
1--TEST--
2Bug #71841 (EG(error_zval) is not handled well)
3--FILE--
4<?php
5$z = unserialize('O:1:"A":0:{}');
6try {
7    var_dump($z->e.=0);
8} catch (Error $e) {
9    echo $e->getMessage(), "\n";
10}
11try {
12    var_dump(++$z->x);
13} catch (Error $e) {
14    echo $e->getMessage(), "\n";
15}
16try {
17    var_dump($z->y++);
18} catch (Error $e) {
19    echo $e->getMessage(), "\n";
20}
21
22$y = array(PHP_INT_MAX => 0);
23try {
24    var_dump($y[] .= 0);
25} catch (Error $e) {
26    echo $e->getMessage(), "\n";
27}
28try {
29    var_dump(++$y[]);
30} catch (Error $e) {
31    echo $e->getMessage(), "\n";
32}
33try {
34    var_dump($y[]++);
35} catch (Error $e) {
36    echo $e->getMessage(), "\n";
37}
38?>
39--EXPECT--
40The 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
41The 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
42The 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
43Cannot add element to the array as the next element is already occupied
44Cannot add element to the array as the next element is already occupied
45Cannot add element to the array as the next element is already occupied
46