php-src/Zend/tests/bug38461.phpt
Nikita Popov 5a4cb3edde Fix missing access errors for guarded properties
If a property access would normally result in a magic method call,
but the property is subject to an active recursion guard, the
access should behave as if the magic method does not exist.

This commit fixes one instance where this was not the case -- we
should have been generating a property access error, but instead
the operation simply did not do anything.
2018-09-27 14:58:26 +02:00

30 lines
499 B
PHP

--TEST--
Bug #38461 (setting private attribute with __set() produces segfault)
--FILE--
<?php
class Operation
{
function __set( $var, $value )
{
$this->$var = $value;
}
}
class ExtOperation extends Operation
{
private $x;
}
$op = new ExtOperation;
$op->x = 'test';
echo "Done\n";
?>
--EXPECTF--
Fatal error: Uncaught Error: Cannot access private property ExtOperation::$x in %s:%d
Stack trace:
#0 %s(%d): Operation->__set('x', 'test')
#1 {main}
thrown in %s on line %d