@@ -44,12 +44,13 @@ zend_llist zend_observer_error_callbacks;
44
44
int zend_observer_fcall_op_array_extension = -1 ;
45
45
46
46
ZEND_TLS zend_arena * fcall_handlers_arena = NULL ;
47
+ ZEND_TLS zend_execute_data * first_observed_frame = NULL ;
47
48
ZEND_TLS zend_execute_data * current_observed_frame = NULL ;
48
49
49
50
// Call during minit/startup ONLY
50
51
ZEND_API void zend_observer_fcall_register (zend_observer_fcall_init init ) {
51
- /* We don't want to get an extension handle unless an ext installs an observer */
52
52
if (!ZEND_OBSERVER_ENABLED ) {
53
+ /* We don't want to get an extension handle unless an ext installs an observer */
53
54
zend_observer_fcall_op_array_extension =
54
55
zend_get_op_array_extension_handle ("Zend Observer" );
55
56
@@ -161,6 +162,9 @@ static void ZEND_FASTCALL _zend_observe_fcall_begin(zend_execute_data *execute_d
161
162
return ;
162
163
}
163
164
165
+ if (first_observed_frame == NULL ) {
166
+ first_observed_frame = execute_data ;
167
+ }
164
168
current_observed_frame = execute_data ;
165
169
166
170
end = fcall_data -> end ;
@@ -212,7 +216,12 @@ ZEND_API void ZEND_FASTCALL zend_observer_fcall_end(
212
216
}
213
217
}
214
218
215
- current_observed_frame = execute_data -> prev_execute_data ;
219
+ if (first_observed_frame == execute_data ) {
220
+ first_observed_frame = NULL ;
221
+ current_observed_frame = NULL ;
222
+ } else {
223
+ current_observed_frame = execute_data -> prev_execute_data ;
224
+ }
216
225
}
217
226
218
227
ZEND_API void zend_observer_fcall_end_all (void )
0 commit comments