blob: ddb2e67307c0713f096813f72be9fc6b59f2c5ca (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
--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)
|