1
0
mirror of https://github.com/php/php-src.git synced 2026-04-20 22:41:20 +02:00
Files
archived-php-src/Zend/tests/constants_002.phpt
2020-07-21 14:47:03 +02:00

26 lines
454 B
PHP

--TEST--
Defining constants with non-scalar values
--FILE--
<?php
try {
define('foo', new stdClass);
} catch (TypeError $exception) {
echo $exception->getMessage() . "\n";
}
try {
var_dump(foo);
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
define('foo', fopen(__FILE__, 'r'));
var_dump(foo);
?>
--EXPECT--
define(): Argument #2 ($value) cannot be an object, stdClass given
Undefined constant "foo"
resource(5) of type (stream)