Skip to content

Instantly share code, notes, and snippets.

@nielsdos
Created April 9, 2024 20:16
Show Gist options
  • Save nielsdos/d26afa61d00a261893709b3c1e6497e0 to your computer and use it in GitHub Desktop.
Save nielsdos/d26afa61d00a261893709b3c1e6497e0 to your computer and use it in GitHub Desktop.
diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c
index f72cb76489..bc1b731388 100644
--- a/Zend/zend_object_handlers.c
+++ b/Zend/zend_object_handlers.c
@@ -30,6 +30,7 @@
#include "zend_closures.h"
#include "zend_compile.h"
#include "zend_hash.h"
+#include "zend_observer.h"
#define DEBUG_OBJECT_HANDLERS 0
@@ -1352,7 +1353,8 @@ ZEND_API zend_function *zend_get_call_trampoline_func(const zend_class_entry *ce
* value so that it doesn't contain garbage when the engine allocates space for the next stack
* frame. This didn't cause any issues until now due to "lucky" structure layout. */
func->last_var = 0;
- func->T = (fbc->type == ZEND_USER_FUNCTION)? MAX(fbc->op_array.last_var + fbc->op_array.T, 2) : 2;
+ uint32_t min_T = 2 + ZEND_OBSERVER_ENABLED;
+ func->T = (fbc->type == ZEND_USER_FUNCTION)? MAX(fbc->op_array.last_var + fbc->op_array.T, min_T) : min_T;
func->filename = (fbc->type == ZEND_USER_FUNCTION)? fbc->op_array.filename : ZSTR_EMPTY_ALLOC();
func->line_start = (fbc->type == ZEND_USER_FUNCTION)? fbc->op_array.line_start : 0;
func->line_end = (fbc->type == ZEND_USER_FUNCTION)? fbc->op_array.line_end : 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment