1
0
mirror of https://github.com/php/php-src.git synced 2026-04-03 22:22:18 +02:00
Files
archived-php-src/tests/classes/static_properties_003_error4.phpt
Nikita Popov 5a076e670a Return error_zval form get_property_ptr_ptr on exception
This goes in the reverse direction of 4463acb951.
After looking around a bit, it seems that we already check for
Z_ISERROR_P() on the get_property_ptr_ptr return value in other places.
So do this in zend_fetch_property_address() as well, and also make
sure that EG(error_zval) is indeed returned on exception in
get_property_ptr_ptr.

In particular, this fixes the duplicate exceptions that we used to
get because first get_property_ptr_ptr threw one and then
read_property throws the same exception again.
2019-10-10 15:14:04 +02:00

24 lines
454 B
PHP

--TEST--
Attempting to access static properties using instance property syntax
--FILE--
<?php
class C {
protected static $y = 'C::$y';
}
$c = new C;
echo "\n--> Access non-visible static prop like instance prop:\n";
try {
$c->y =& $ref;
} catch (Error $e) {
echo $e, "\n";
}
?>
==Done==
--EXPECTF--
--> Access non-visible static prop like instance prop:
Error: Cannot access protected property C::$y in %s:%d
Stack trace:
#0 {main}
==Done==