1
0
mirror of https://github.com/php/php-src.git synced 2026-04-26 09:28:21 +02:00
Files
archived-php-src/Zend/tests/add_002.phpt
T
Nikita Popov cdaf35033d Improve "unsupported operands" error
By mentioning the operand types. We can do that now, as the
original operand types now remain available.

Closes GH-5330.
2020-04-01 11:26:43 +02:00

29 lines
461 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 + object
Fatal error: Uncaught TypeError: Unsupported operand types: array + object in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d