File tree 1 file changed +18
-4
lines changed 1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -1280,21 +1280,35 @@ ZEND_FUNCTION(debug_backtrace)
1280
1280
char * include_filename = NULL ;
1281
1281
zval * stack_frame ;
1282
1282
void * * cur_arg_pos = EG (argument_stack ).top_element ;
1283
+ void * * args = cur_arg_pos ;
1284
+ int arg_stack_consitent = 0 ;
1283
1285
1284
1286
if (ZEND_NUM_ARGS ()) {
1285
1287
WRONG_PARAM_COUNT ;
1286
1288
}
1287
1289
1290
+ while (-- args >= EG (argument_stack ).elements ) {
1291
+ if (* args -- ) {
1292
+ break ;
1293
+ }
1294
+ args -= * (ulong * )args ;
1295
+
1296
+ if (args == EG (argument_stack ).elements ) {
1297
+ arg_stack_consitent = 1 ;
1298
+ break ;
1299
+ }
1300
+ }
1301
+
1302
+ if (! arg_stack_consitent ) {
1303
+ zend_error (E_ERROR , "debug_backtrace(): Can't be called by function parameter" );
1304
+ }
1305
+
1288
1306
ptr = EG (current_execute_data );
1289
1307
1290
1308
/* skip debug_backtrace() */
1291
1309
ptr = ptr -> prev_execute_data ;
1292
1310
cur_arg_pos -= 2 ;
1293
1311
1294
- if (ptr && cur_arg_pos [-1 ]) {
1295
- zend_error (E_ERROR , "debug_backtrace(): Can't be used as a function parameter" );
1296
- }
1297
-
1298
1312
array_init (return_value );
1299
1313
1300
1314
while (ptr ) {
You can’t perform that action at this time.
0 commit comments