mirror of
https://github.com/php/php-src.git
synced 2024-11-23 18:04:36 +08:00
fbe30592d6
From now on, we always display the given object's type instead of just reporting "object". Additionally, make the format of return type errors match the format of argument errors. Closes GH-5625
29 lines
465 B
PHP
29 lines
465 B
PHP
--TEST--
|
|
adding objects to arrays
|
|
--FILE--
|
|
<?php
|
|
|
|
$a = array(1,2,3);
|
|
|
|
$o = new stdclass;
|
|
$o->prop = "value";
|
|
|
|
try {
|
|
var_dump($a + $o);
|
|
} catch (Error $e) {
|
|
echo "\nException: " . $e->getMessage() . "\n";
|
|
}
|
|
|
|
$c = $a + $o;
|
|
var_dump($c);
|
|
|
|
echo "Done\n";
|
|
?>
|
|
--EXPECTF--
|
|
Exception: Unsupported operand types: array + stdClass
|
|
|
|
Fatal error: Uncaught TypeError: Unsupported operand types: array + stdClass in %s:%d
|
|
Stack trace:
|
|
#0 {main}
|
|
thrown in %s on line %d
|