@@ -434,8 +434,9 @@ PHPDBG_API void phpdbg_stack_free(phpdbg_param_t *stack) {
434
434
PHPDBG_API void phpdbg_stack_push (phpdbg_param_t * stack , phpdbg_param_t * param ) {
435
435
phpdbg_param_t * next = calloc (1 , sizeof (phpdbg_param_t ));
436
436
437
- if (!next )
437
+ if (!next ) {
438
438
return ;
439
+ }
439
440
440
441
* (next ) = * (param );
441
442
@@ -454,6 +455,16 @@ PHPDBG_API void phpdbg_stack_push(phpdbg_param_t *stack, phpdbg_param_t *param)
454
455
stack -> len ++ ;
455
456
} /* }}} */
456
457
458
+ /* {{{ */
459
+ PHPDBG_API void phpdbg_stack_separate (phpdbg_param_t * param ) {
460
+ phpdbg_param_t * stack = calloc (1 , sizeof (phpdbg_param_t ));
461
+
462
+ stack -> type = STACK_PARAM ;
463
+ stack -> next = param -> next ;
464
+ param -> next = stack ;
465
+ stack -> top = param -> top ;
466
+ } /* }}} */
467
+
457
468
PHPDBG_API int phpdbg_stack_verify (const phpdbg_command_t * command , phpdbg_param_t * * stack ) {
458
469
if (command ) {
459
470
char buffer [128 ] = {0 ,};
@@ -466,7 +477,7 @@ PHPDBG_API int phpdbg_stack_verify(const phpdbg_command_t *command, phpdbg_param
466
477
467
478
/* check for arg spec */
468
479
if (!(arg ) || !(* arg )) {
469
- if (!top ) {
480
+ if (!top || top -> type == STACK_PARAM ) {
470
481
return SUCCESS ;
471
482
}
472
483
@@ -506,6 +517,10 @@ PHPDBG_API int phpdbg_stack_verify(const phpdbg_command_t *command, phpdbg_param
506
517
}
507
518
508
519
while (arg && * arg ) {
520
+ if (top && top -> type == STACK_PARAM ) {
521
+ break ;
522
+ }
523
+
509
524
current ++ ;
510
525
511
526
switch (* arg ) {
@@ -528,9 +543,11 @@ PHPDBG_API int phpdbg_stack_verify(const phpdbg_command_t *command, phpdbg_param
528
543
case '*' : { /* do nothing */ } break ;
529
544
}
530
545
531
- if (top ) {
546
+ if (top ) {
532
547
top = top -> next ;
533
- } else break ;
548
+ } else {
549
+ break ;
550
+ }
534
551
535
552
received ++ ;
536
553
arg ++ ;
@@ -644,22 +661,9 @@ PHPDBG_API const phpdbg_command_t *phpdbg_stack_resolve(const phpdbg_command_t *
644
661
return NULL ;
645
662
} /* }}} */
646
663
647
- /* {{{ */
648
- PHPDBG_API int phpdbg_stack_execute (phpdbg_param_t * stack , zend_bool allow_async_unsafe ) {
649
- phpdbg_param_t * top = NULL ;
664
+ static int phpdbg_internal_stack_execute (phpdbg_param_t * stack , zend_bool allow_async_unsafe ) {
650
665
const phpdbg_command_t * handler = NULL ;
651
-
652
- if (stack -> type != STACK_PARAM ) {
653
- phpdbg_error ("command" , "type=\"nostack\"" , "The passed argument was not a stack !" );
654
- return FAILURE ;
655
- }
656
-
657
- if (!stack -> len ) {
658
- phpdbg_error ("command" , "type=\"emptystack\"" , "The stack contains nothing !" );
659
- return FAILURE ;
660
- }
661
-
662
- top = (phpdbg_param_t * ) stack -> next ;
666
+ phpdbg_param_t * top = (phpdbg_param_t * ) stack -> next ;
663
667
664
668
switch (top -> type ) {
665
669
case EVAL_PARAM :
@@ -709,6 +713,31 @@ PHPDBG_API int phpdbg_stack_execute(phpdbg_param_t *stack, zend_bool allow_async
709
713
return SUCCESS ;
710
714
} /* }}} */
711
715
716
+ /* {{{ */
717
+ PHPDBG_API int phpdbg_stack_execute (phpdbg_param_t * stack , zend_bool allow_async_unsafe ) {
718
+ phpdbg_param_t * top = stack ;
719
+
720
+ if (stack -> type != STACK_PARAM ) {
721
+ phpdbg_error ("command" , "type=\"nostack\"" , "The passed argument was not a stack !" );
722
+ return FAILURE ;
723
+ }
724
+
725
+ if (!stack -> len ) {
726
+ phpdbg_error ("command" , "type=\"emptystack\"" , "The stack contains nothing !" );
727
+ return FAILURE ;
728
+ }
729
+
730
+ do {
731
+ if (top -> type == STACK_PARAM ) {
732
+ if (phpdbg_internal_stack_execute (top , allow_async_unsafe ) == FAILURE ) {
733
+ return FAILURE ;
734
+ }
735
+ }
736
+ } while ((top = top -> next ));
737
+
738
+ return SUCCESS ;
739
+ } /* }}} */
740
+
712
741
PHPDBG_API char * phpdbg_read_input (char * buffered ) /* {{{ */
713
742
{
714
743
char buf [PHPDBG_MAX_CMD ];
0 commit comments