summaryrefslogtreecommitdiff
path: root/Zend/tests/self_class_const_in_unknown_scope.phpt
blob: 2eb3a89d710c9745fb9b207830720abf0781c426 (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
26
--TEST--
Use of self::class inside a constant in an unknown scope
--FILE--
<?php

class Test {
    public function foobar() {
        eval("
            const FOO = self::class;
            var_dump(FOO);
        ");
    }
}
(new Test)->foobar();

const BAR = self::class;
var_dump(BAR);

?>
--EXPECTF--
string(4) "Test"

Fatal error: Uncaught Error: Cannot use "self" when no class scope is active in %s:%d
Stack trace:
#0 {main}
  thrown in %s on line %d