mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00

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
28 lines
465 B
PHP
28 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
|