php-src/Zend/tests/class_name_as_scalar_error_007.phpt
Nikita Popov 9b3fda4342 Don't replace self::class with __CLASS__ during const eval
Instead delay this until const expression compilation. Otherwise
self::class and [self::class] have different behavior...
2019-01-04 11:16:59 +01:00

21 lines
372 B
PHP

--TEST--
Cannot access self::class when no class scope is active
--FILE--
<?php
try {
var_dump(self::class);
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
var_dump([self::class]);
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Cannot use "self" when no class scope is active
Cannot use "self" when no class scope is active