mirror of
https://github.com/php/php-src.git
synced 2026-03-30 20:22:36 +02:00
Access to undefined constants will now always result in an Error exception being thrown. This required quite a few test changes, because there were many buggy tests that unintentionally used bareword fallback in combination with error suppression.
30 lines
489 B
PHP
30 lines
489 B
PHP
--TEST--
|
|
Bug #37811 (define not using toString on objects)
|
|
--FILE--
|
|
<?php
|
|
|
|
class TestClass
|
|
{
|
|
function __toString()
|
|
{
|
|
return "Foo";
|
|
}
|
|
}
|
|
|
|
define("Bar",new TestClass);
|
|
var_dump(Bar);
|
|
define("Baz",new stdClass);
|
|
var_dump(Baz);
|
|
|
|
?>
|
|
===DONE===
|
|
--EXPECTF--
|
|
string(3) "Foo"
|
|
|
|
Warning: Constants may only evaluate to scalar values, arrays or resources in %sbug37811.php on line %d
|
|
|
|
Fatal error: Uncaught Error: Undefined constant 'Baz' in %s:%d
|
|
Stack trace:
|
|
#0 {main}
|
|
thrown in %s on line %d
|