summaryrefslogtreecommitdiff
path: root/Zend/tests/constants_002.phpt
blob: 309b9c7f9c77602472b7fce939843e196e2cae41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
--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)