xref: /PHP-7.0/Zend/tests/bug37811.phpt (revision 0833fd46)
1--TEST--
2Bug #37811 (define not using toString on objects)
3--FILE--
4<?php
5
6class TestClass
7{
8	function __toString()
9	{
10		return "Foo";
11	}
12}
13
14define("Bar",new TestClass);
15var_dump(Bar);
16define("Baz",new stdClass);
17var_dump(Baz);
18
19?>
20===DONE===
21--EXPECTF--
22string(3) "Foo"
23
24Warning: Constants may only evaluate to scalar values or arrays in %sbug37811.php on line %d
25
26Notice: Use of undefined constant Baz - assumed 'Baz' in %sbug37811.php on line %d
27string(3) "Baz"
28===DONE===
29