xref: /PHP-7.4/Zend/tests/bug37811.phpt (revision 0a6ddc77)
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, arrays or resources in %sbug37811.php on line %d
25
26Warning: Use of undefined constant Baz - assumed 'Baz' (this will throw an Error in a future version of PHP) in %sbug37811.php on line %d
27string(3) "Baz"
28===DONE===
29