observer_bug81435.phpt 860 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. --TEST--
  2. Bug #81435 (Observer current_observed_frame may point to an old (overwritten) frame)
  3. --EXTENSIONS--
  4. zend_test
  5. --INI--
  6. memory_limit=20M
  7. zend_test.observer.enabled=1
  8. zend_test.observer.observe_function_names=a,d
  9. opcache.optimization_level=0
  10. --FILE--
  11. <?php
  12. function d() {} // observed
  13. function c() {
  14. d();
  15. }
  16. function b() {
  17. c();
  18. }
  19. function bailout(...$args) {
  20. array_map("str_repeat", ["\xFF"], [100000000]);
  21. }
  22. function a() { // observed (first_observed_frame)
  23. b();
  24. bailout(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); // overwrite the vm_stack containing prev_execute_data
  25. }
  26. a();
  27. ?>
  28. --EXPECTF--
  29. <!-- init '%s' -->
  30. <!-- init a() -->
  31. <a>
  32. <!-- init b() -->
  33. <!-- init c() -->
  34. <!-- init d() -->
  35. <d>
  36. </d>
  37. <!-- init bailout() -->
  38. Fatal error: Allowed memory size of 20971520 bytes exhausted %s in %s on line %d
  39. </a>