bug38406.phpt 727 B

12345678910111213141516171819202122232425262728293031323334353637
  1. --TEST--
  2. Bug #38406 (crash when assigning objects to SimpleXML attributes)
  3. --EXTENSIONS--
  4. simplexml
  5. --FILE--
  6. <?php
  7. $item = new SimpleXMLElement('<something />');
  8. $item->attribute = 'something';
  9. var_dump($item->attribute);
  10. $item->otherAttribute = $item->attribute;
  11. var_dump($item->otherAttribute);
  12. $a = array();
  13. try {
  14. $item->$a = new stdclass;
  15. } catch (TypeError $exception) {
  16. echo $exception->getMessage() . "\n";
  17. }
  18. echo "Done\n";
  19. ?>
  20. --EXPECTF--
  21. object(SimpleXMLElement)#%d (1) {
  22. [0]=>
  23. string(9) "something"
  24. }
  25. object(SimpleXMLElement)#%d (1) {
  26. [0]=>
  27. string(9) "something"
  28. }
  29. Warning: Array to string conversion in %s on line %d
  30. It's not possible to assign a complex type to properties, stdClass given
  31. Done