add_003.phpt 598 B

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