xref: /PHP-7.4/Zend/tests/add_002.phpt (revision 782352c5)
1--TEST--
2adding objects to arrays
3--FILE--
4<?php
5
6$a = array(1,2,3);
7
8$o = new stdclass;
9$o->prop = "value";
10
11try {
12	var_dump($a + $o);
13} catch (Error $e) {
14	echo "\nException: " . $e->getMessage() . "\n";
15}
16
17$c = $a + $o;
18var_dump($c);
19
20echo "Done\n";
21?>
22--EXPECTF--
23Notice: Object of class stdClass could not be converted to number in %sadd_002.php on line %d
24
25Exception: Unsupported operand types
26
27Notice: Object of class stdClass could not be converted to number in %s on line %d
28
29Fatal error: Uncaught Error: Unsupported operand types in %s:%d
30Stack trace:
31#0 {main}
32  thrown in %s on line %d
33