xref: /PHP-7.3/Zend/tests/bug75079_2.phpt (revision 782352c5)
1--TEST--
2Bug #75079 variation without traits
3--FILE--
4<?php
5
6class Foo
7{
8    private static $bar = 123;
9
10    static function test(){
11        return function(){
12            return function(){
13                return Foo::$bar;
14            };
15        };
16    }
17}
18
19
20$f = Foo::test();
21
22var_dump($f()());
23
24class A{}
25$a = new A;
26var_dump($f->bindTo($a, A::CLASS)()());
27
28?>
29--EXPECTF--
30int(123)
31
32Fatal error: Uncaught Error: Cannot access private property Foo::$bar in %s:%d
33Stack trace:
34#0 %s(%d): A->{closure}()
35#1 {main}
36  thrown in %s on line %d
37