summaryrefslogtreecommitdiff
path: root/Zend/tests/no_class_const_propagation_in_closures.phpt
blob: 89d48e2d8359186266f7851fb1b3bb1f4412f866 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
--TEST--
self:: class constants should not be propagated into closures, due to scope rebinding
--FILE--
<?php

class A {
    const C = 'A::C';

    public function f() {
        return function() {
            return self::C;
        };
    }
}

class B {
    const C = 'B::C';
}

$f = (new A)->f();
var_dump($f->bindTo(new B, 'B')());

?>
--EXPECT--
string(4) "B::C"