xref: /PHP-7.1/Zend/tests/add_003.phpt (revision 7af945e2)
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--
23Notice: Object of class stdClass could not be converted to int in %sadd_003.php on line %d
24
25Exception: Unsupported operand types
26
27Notice: Object of class stdClass could not be converted to int 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