mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
5770b66722
Closes GH-5847
34 lines
540 B
PHP
34 lines
540 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);
|
|
|
|
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"
|