1--TEST--
2Use of self::class inside a constant in an unknown scope
3--FILE--
4<?php
5
6class Test {
7    public function foobar() {
8        eval("
9            const FOO = self::class;
10            var_dump(FOO);
11        ");
12    }
13}
14(new Test)->foobar();
15
16const BAR = self::class;
17var_dump(BAR);
18
19?>
20--EXPECTF--
21string(4) "Test"
22
23Fatal error: Uncaught Error: Cannot use "self" when no class scope is active in %s:%d
24Stack trace:
25#0 {main}
26  thrown in %s on line %d
27