1
0
mirror of https://github.com/php/php-src.git synced 2026-04-27 18:23:26 +02:00
Files
archived-php-src/Zend/tests/bug78531.phpt
T
Máté Kocsis 1179686f62 Improve error messages for invalid property access
Closes GH-5446
Co-authored-by:  Nikita Popov <nikita.ppv@gmail.com>
2020-05-18 08:27:00 +02:00

38 lines
802 B
PHP

--TEST--
Bug #78531 (Crash when using undefined variable as object)
--FILE--
<?php
try {
$u1->a += 5;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
$x = ++$u2->a;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
$x = $u3->a++;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
$u4->a->a += 5;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECTF--
Warning: Undefined variable $u1 in %s on line %d
Attempt to assign property 'a' on null
Warning: Undefined variable $u2 in %s on line %d
Attempt to increment/decrement property 'a' on null
Warning: Undefined variable $u3 in %s on line %d
Attempt to increment/decrement property 'a' on null
Warning: Undefined variable $u4 in %s on line %d
Attempt to modify property 'a' on null