1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00
Files
archived-php-src/tests/lang/bug44827.phpt
Christoph M. Becker b2186ca7c4 Fix GH-9905: constant() behaves inconsistent when class is undefined
Directly referring to a constant of an undefined throws an exception;
there is not much point in `constant()` raising a fatal error in this
case.

Closes GH-9907.
2022-11-09 15:21:50 +01:00

25 lines
428 B
PHP

--TEST--
Bug #44827 (Class error when trying to access :: as constant)
--CREDITS--
Sebastian Schürmann
sebs@php.net
Testfest Munich 2009
--FILE--
<?php
try {
define('::', true);
} catch (ValueError $e) {
echo $e->getMessage(), "\n";
}
try {
constant('::');
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECTF--
define(): Argument #1 ($constant_name) cannot be a class constant
Class "" not found