bug71859.phpt 805 B

12345678910111213141516171819202122232425262728
  1. --TEST--
  2. Bug #71859 (zend_objects_store_call_destructors operates on realloced memory, crashing)
  3. --FILE--
  4. <?php
  5. class constructs_in_destructor {
  6. public function __destruct() {
  7. //We are now in zend_objects_store_call_destructors
  8. //This causes a realloc in zend_objects_store_put
  9. for ($i = 0; $i < 10000; ++$i) {
  10. $GLOBALS["a$i"] = new stdClass;
  11. }
  12. //Returns to zend_objects_store_call_destructors, to access freed memory.
  13. }
  14. }
  15. $a = new constructs_in_destructor;
  16. //Create cycle so destructors are ran only in zend_objects_store_call_destructors
  17. $a->a = $a;
  18. // Create some objects so zend_objects_store_call_destructors has something
  19. // to do after constructs_in_destructor is destroyed.
  20. for ($i = 0; $i < 200; ++$i) {
  21. $GLOBALS["b$i"] = new stdClass;
  22. }
  23. ?>
  24. okey
  25. --EXPECT--
  26. okey