bug75921.phpt 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. --TEST--
  2. Bug #75921: Inconsistent error when creating stdObject from empty variable
  3. --FILE--
  4. <?php
  5. try {
  6. $null->a = 42;
  7. } catch (Error $e) {
  8. echo $e->getMessage(), "\n";
  9. }
  10. var_dump($null);
  11. unset($null);
  12. try {
  13. $null->a['hello'] = 42;
  14. } catch (Error $e) {
  15. echo $e->getMessage(), "\n";
  16. }
  17. var_dump($null);
  18. unset($null);
  19. try {
  20. $null->a->b = 42;
  21. } catch (Error $e) {
  22. echo $e->getMessage(), "\n";
  23. }
  24. var_dump($null);
  25. unset($null);
  26. try {
  27. $null->a['hello']->b = 42;
  28. } catch (Error $e) {
  29. echo $e->getMessage(), "\n";
  30. }
  31. var_dump($null);
  32. unset($null);
  33. try {
  34. $null->a->b['hello'] = 42;
  35. } catch (Error $e) {
  36. echo $e->getMessage(), "\n";
  37. }
  38. var_dump($null);
  39. unset($null);
  40. ?>
  41. --EXPECTF--
  42. Attempt to assign property "a" on null
  43. Warning: Undefined variable $null in %s on line %d
  44. NULL
  45. Attempt to modify property "a" on null
  46. Warning: Undefined variable $null in %s on line %d
  47. NULL
  48. Attempt to modify property "a" on null
  49. Warning: Undefined variable $null in %s on line %d
  50. NULL
  51. Attempt to modify property "a" on null
  52. Warning: Undefined variable $null in %s on line %d
  53. NULL
  54. Attempt to modify property "a" on null
  55. Warning: Undefined variable $null in %s on line %d
  56. NULL