xref: /PHP-8.0/Zend/tests/bug66811.phpt (revision 2d48d734)
1--TEST--
2Bug #66811: Cannot access static::class in lambda, written outside of a class
3--FILE--
4<?php
5class A {
6    public static function f() {
7        return function () {
8            var_dump(self::class);
9            var_dump(static::class);
10        };
11    }
12}
13
14class B extends A {}
15
16$f = B::f();
17$f();
18
19$g = $f->bindTo(null, A::class);
20$g();
21
22$foo = function () {
23    var_dump(self::class);
24    var_dump(static::class);
25};
26
27$bar = $foo->bindTo(null, A::class);
28$bar();
29
30?>
31--EXPECT--
32string(1) "A"
33string(1) "B"
34string(1) "A"
35string(1) "A"
36string(1) "A"
37string(1) "A"
38