mirror of
https://github.com/php/php-src.git
synced 2026-04-21 23:18:13 +02:00
41af1e6781
Previously this triggered an assertion failure. The behavior is not quite correct, in that self::class should generate an exception if there is no self, but returns an empty string here. Fixing that would be a bit too intrusive for the 7.2 branch.
24 lines
367 B
PHP
24 lines
367 B
PHP
--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();
|
|
|
|
// This should error, but doesn't
|
|
const BAR = self::class;
|
|
var_dump(BAR);
|
|
|
|
?>
|
|
--EXPECT--
|
|
string(4) "Test"
|
|
string(0) ""
|