xref: /PHP-8.2/Zend/tests/bug65372.phpt (revision 782352c5)
1--TEST--
2Bug #65372 (Segfault in gc_zval_possible_root when return reference fails)
3--FILE--
4<?php
5
6class ParentClass
7{
8    private static $_OBJECTS;
9
10    public static function Get()
11    {
12        self::$_OBJECTS[1] = new ChildClass();
13        return self::$_OBJECTS[1];
14    }
15}
16
17class ChildClass extends ParentClass
18{
19    public $Manager;
20
21    function __construct()
22    {
23        $this->Manager = $this;
24    }
25
26    public static function &GetCurrent()
27    {
28        return ChildClass::Get();
29    }
30
31    public static function &Get()
32    {
33        return parent::Get();
34    }
35}
36
37$staff = ChildClass::GetCurrent();
38?>
39--EXPECTF--
40Notice: Only variable references should be returned by reference in %sbug65372.php on line 30
41