xref: /PHP-8.3/Zend/tests/add_002.phpt (revision fbe30592)
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--
23Exception: Unsupported operand types: array + stdClass
24
25Fatal error: Uncaught TypeError: Unsupported operand types: array + stdClass in %s:%d
26Stack trace:
27#0 {main}
28  thrown in %s on line %d
29