blob: 3e433a0da6d7e18cb469177e5cd8534ee4afd7b3 (
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
26
27
28
29
30
31
32
33
|
--TEST--
Bug #37811 (define not using toString on objects)
--FILE--
<?php
class TestClass
{
function __toString()
{
return "Foo";
}
}
define("Bar", new TestClass);
var_dump(Bar);
try {
define("Baz", new stdClass);
} catch (TypeError $exception) {
echo $exception->getMessage() . "\n";
}
try {
var_dump(Baz);
} catch (Error $exception) {
echo $exception->getMessage() . "\n";
}
?>
--EXPECT--
string(3) "Foo"
define(): Argument #2 ($value) cannot be an object, stdClass given
Undefined constant "Baz"
|