xref: /PHP-8.1/Zend/tests/bug38461.phpt (revision 782352c5)
1--TEST--
2Bug #38461 (setting private attribute with __set() produces segfault)
3--FILE--
4<?php
5
6class Operation
7{
8    function __set( $var, $value )
9    {
10        $this->$var = $value;
11    }
12}
13
14class ExtOperation extends Operation
15{
16    private $x;
17}
18
19$op = new ExtOperation;
20$op->x = 'test';
21
22echo "Done\n";
23?>
24--EXPECTF--
25Fatal error: Uncaught Error: Cannot access private property ExtOperation::$x in %s:%d
26Stack trace:
27#0 %s(%d): Operation->__set('x', 'test')
28#1 {main}
29  thrown in %s on line %d
30