bug52041.phpt 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. --TEST--
  2. Bug #52041 (Memory leak when writing on uninitialized variable returned from function)
  3. --FILE--
  4. <?php
  5. function foo() {
  6. return $x;
  7. }
  8. foo()->a = 1;
  9. foo()->a->b = 2;
  10. foo()->a++;
  11. foo()->a->b++;
  12. foo()->a += 2;
  13. foo()->a->b += 2;
  14. foo()[0] = 1;
  15. foo()[0][0] = 2;
  16. foo()[0]++;
  17. foo()[0][0]++;
  18. foo()[0] += 2;
  19. foo()[0][0] += 2;
  20. var_dump(foo());
  21. ?>
  22. --EXPECTF--
  23. Notice: Undefined variable: x in %sbug52041.php on line 3
  24. Warning: Creating default object from empty value in %sbug52041.php on line 6
  25. Notice: Undefined variable: x in %sbug52041.php on line 3
  26. Warning: Creating default object from empty value in %sbug52041.php on line 7
  27. Notice: Undefined variable: x in %sbug52041.php on line 3
  28. Warning: Creating default object from empty value in %sbug52041.php on line 8
  29. Notice: Undefined property: stdClass::$a in %sbug52041.php on line 8
  30. Notice: Undefined variable: x in %sbug52041.php on line 3
  31. Notice: Undefined property: stdClass::$a in %sbug52041.php on line 9
  32. Warning: Creating default object from empty value in %sbug52041.php on line 9
  33. Notice: Undefined property: stdClass::$b in %sbug52041.php on line 9
  34. Notice: Undefined variable: x in %sbug52041.php on line 3
  35. Warning: Creating default object from empty value in %sbug52041.php on line 10
  36. Notice: Undefined property: stdClass::$a in %sbug52041.php on line 10
  37. Notice: Undefined variable: x in %sbug52041.php on line 3
  38. Notice: Undefined property: stdClass::$a in %sbug52041.php on line 11
  39. Warning: Creating default object from empty value in %sbug52041.php on line 11
  40. Notice: Undefined property: stdClass::$b in %sbug52041.php on line 11
  41. Notice: Undefined variable: x in %sbug52041.php on line 3
  42. Notice: Undefined variable: x in %sbug52041.php on line 3
  43. Notice: Undefined variable: x in %sbug52041.php on line 3
  44. Notice: Undefined offset: 0 in %sbug52041.php on line 15
  45. Notice: Undefined variable: x in %sbug52041.php on line 3
  46. Notice: Undefined offset: 0 in %sbug52041.php on line 16
  47. Notice: Undefined offset: 0 in %sbug52041.php on line 16
  48. Notice: Undefined variable: x in %sbug52041.php on line 3
  49. Notice: Undefined offset: 0 in %sbug52041.php on line 17
  50. Notice: Undefined variable: x in %sbug52041.php on line 3
  51. Notice: Undefined offset: 0 in %sbug52041.php on line 18
  52. Notice: Undefined offset: 0 in %sbug52041.php on line 18
  53. Notice: Undefined variable: x in %sbug52041.php on line 3
  54. NULL