mirror of
https://github.com/php/php-src.git
synced 2024-12-18 14:30:35 +08:00
7ce531f2c2
This means we get an Error exception and a much better error message indicating the root cause (e.g. accessing a private class constant).
25 lines
340 B
PHP
25 lines
340 B
PHP
--TEST--
|
|
constant() tests
|
|
--FILE--
|
|
<?php
|
|
|
|
try {
|
|
var_dump(constant(""));
|
|
} catch (Error $e) {
|
|
echo $e->getMessage(), "\n";
|
|
}
|
|
|
|
define("TEST_CONST", 1);
|
|
var_dump(constant("TEST_CONST"));
|
|
|
|
define("TEST_CONST2", "test");
|
|
var_dump(constant("TEST_CONST2"));
|
|
|
|
echo "Done\n";
|
|
?>
|
|
--EXPECT--
|
|
Undefined constant ''
|
|
int(1)
|
|
string(4) "test"
|
|
Done
|