bug78531.phpt 802 B

12345678910111213141516171819202122232425262728293031323334353637
  1. --TEST--
  2. Bug #78531 (Crash when using undefined variable as object)
  3. --FILE--
  4. <?php
  5. try {
  6. $u1->a += 5;
  7. } catch (Error $e) {
  8. echo $e->getMessage(), "\n";
  9. }
  10. try {
  11. $x = ++$u2->a;
  12. } catch (Error $e) {
  13. echo $e->getMessage(), "\n";
  14. }
  15. try {
  16. $x = $u3->a++;
  17. } catch (Error $e) {
  18. echo $e->getMessage(), "\n";
  19. }
  20. try {
  21. $u4->a->a += 5;
  22. } catch (Error $e) {
  23. echo $e->getMessage(), "\n";
  24. }
  25. ?>
  26. --EXPECTF--
  27. Warning: Undefined variable $u1 in %s on line %d
  28. Attempt to assign property "a" on null
  29. Warning: Undefined variable $u2 in %s on line %d
  30. Attempt to increment/decrement property "a" on null
  31. Warning: Undefined variable $u3 in %s on line %d
  32. Attempt to increment/decrement property "a" on null
  33. Warning: Undefined variable $u4 in %s on line %d
  34. Attempt to modify property "a" on null