mirror of
https://github.com/php/php-src.git
synced 2026-04-22 07:28:09 +02:00
aad39879f2
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.
21 lines
392 B
PHP
21 lines
392 B
PHP
--TEST--
|
|
Defining constants with non-scalar values
|
|
--FILE--
|
|
<?php
|
|
|
|
define('foo', new stdClass);
|
|
try {
|
|
var_dump(foo);
|
|
} catch (Error $e) {
|
|
echo $e->getMessage(), "\n";
|
|
}
|
|
|
|
define('foo', fopen(__FILE__, 'r'));
|
|
var_dump(foo);
|
|
|
|
?>
|
|
--EXPECTF--
|
|
Warning: Constants may only evaluate to scalar values, arrays or resources in %s on line %d
|
|
Undefined constant 'foo'
|
|
resource(5) of type (stream)
|