1
0
mirror of https://github.com/php/php-src.git synced 2026-03-29 19:52:20 +02:00
Files
archived-php-src/tests/classes/constants_scope_001.phpt
Nikita Popov aad39879f2 Remove bareword fallback for constants
Access to undefined constants will now always result in an Error
exception being thrown.

This required quite a few test changes, because there were many
buggy tests that unintentionally used bareword fallback in combination
with error suppression.
2019-01-31 13:52:06 +01:00

33 lines
730 B
PHP

--TEST--
ZE2 class constants and scope
--FILE--
<?php
class ErrorCodes {
const FATAL = "Fatal error\n";
const WARNING = "Warning\n";
const INFO = "Informational message\n";
static function print_fatal_error_codes() {
echo "self::FATAL = " . self::FATAL;
}
}
class ErrorCodesDerived extends ErrorCodes {
const FATAL = "Worst error\n";
static function print_fatal_error_codes() {
echo "self::FATAL = " . self::FATAL;
echo "parent::FATAL = " . parent::FATAL;
}
}
/* Call the static function and move into the ErrorCodes scope */
ErrorCodes::print_fatal_error_codes();
ErrorCodesDerived::print_fatal_error_codes();
?>
--EXPECT--
self::FATAL = Fatal error
self::FATAL = Worst error
parent::FATAL = Fatal error