xref: /PHP-8.0/Zend/tests/add_003.phpt (revision fbe30592)
1--TEST--
2adding arrays to objects
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($o + $a);
13} catch (Error $e) {
14    echo "\nException: " . $e->getMessage() . "\n";
15}
16
17$c = $o + $a;
18var_dump($c);
19
20echo "Done\n";
21?>
22--EXPECTF--
23Exception: Unsupported operand types: stdClass + array
24
25Fatal error: Uncaught TypeError: Unsupported operand types: stdClass + array in %s:%d
26Stack trace:
27#0 {main}
28  thrown in %s on line %d
29