php-src/tests/lang/bug44827.phpt
Nikita Popov 7ce531f2c2 Make constant() error handling consistent with plain const lookup
This means we get an Error exception and a much better error
message indicating the root cause (e.g. accessing a private class
constant).
2020-01-10 13:39:56 +01:00

20 lines
403 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
define('::', true);
try {
var_dump(constant('::'));
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECTF--
Warning: Class constants cannot be defined or redefined in %s on line %d
Fatal error: Class '' not found in %s on line %d