Skip to content

Commit bccac37

Browse files
committed
Fixed bug #70531 (-rr should not fallback to interactive mode in phpdbg)
1 parent 4a174ca commit bccac37

File tree

5 files changed

+21
-8
lines changed

5 files changed

+21
-8
lines changed

NEWS

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ PHP NEWS
3030

3131
- Phpdbg:
3232
. Fixed bug #70532 (phpdbg must respect set_exception_handler). (Bob)
33+
. Fixed bug #70531 (Run and quit mode (-qrr) should not fallback to
34+
interactive mode). (Bob)
3335

3436
- Session:
3537
. Fixed bug #70529 (Session read causes "String is not zero-terminated" error).

sapi/phpdbg/phpdbg.c

+5
Original file line numberDiff line numberDiff line change
@@ -1835,6 +1835,11 @@ int main(int argc, char **argv) /* {{{ */
18351835
if (phpdbg_startup_run) {
18361836
quit_immediately = phpdbg_startup_run > 1;
18371837
phpdbg_startup_run = 0;
1838+
if (quit_immediately) {
1839+
PHPDBG_G(flags) |= PHPDBG_IS_INTERACTIVE | PHPDBG_PREVENT_INTERACTIVE;
1840+
} else {
1841+
PHPDBG_G(flags) |= PHPDBG_IS_INTERACTIVE;
1842+
}
18381843
PHPDBG_COMMAND_HANDLER(run)(NULL);
18391844
if (quit_immediately) {
18401845
/* if -r is on the command line more than once just quit */

sapi/phpdbg/phpdbg.h

+8-7
Original file line numberDiff line numberDiff line change
@@ -183,16 +183,17 @@ int phpdbg_do_parse(phpdbg_param_t *stack, char *input);
183183
#define PHPDBG_IS_INITIALIZING (1ULL<<25)
184184
#define PHPDBG_IS_SIGNALED (1ULL<<26)
185185
#define PHPDBG_IS_INTERACTIVE (1ULL<<27)
186-
#define PHPDBG_IS_BP_ENABLED (1ULL<<28)
187-
#define PHPDBG_IS_REMOTE (1ULL<<29)
188-
#define PHPDBG_IS_DISCONNECTED (1ULL<<30)
189-
#define PHPDBG_WRITE_XML (1ULL<<31)
186+
#define PHPDBG_PREVENT_INTERACTIVE (1ULL<<28)
187+
#define PHPDBG_IS_BP_ENABLED (1ULL<<29)
188+
#define PHPDBG_IS_REMOTE (1ULL<<30)
189+
#define PHPDBG_IS_DISCONNECTED (1ULL<<31)
190+
#define PHPDBG_WRITE_XML (1ULL<<32)
190191

191-
#define PHPDBG_SHOW_REFCOUNTS (1ULL<<32)
192+
#define PHPDBG_SHOW_REFCOUNTS (1ULL<<33)
192193

193-
#define PHPDBG_IN_SIGNAL_HANDLER (1ULL<<33)
194+
#define PHPDBG_IN_SIGNAL_HANDLER (1ULL<<34)
194195

195-
#define PHPDBG_DISCARD_OUTPUT (1ULL<<34)
196+
#define PHPDBG_DISCARD_OUTPUT (1ULL<<35)
196197

197198
#define PHPDBG_SEEK_MASK (PHPDBG_IN_UNTIL | PHPDBG_IN_FINISH | PHPDBG_IN_LEAVE)
198199
#define PHPDBG_BP_RESOLVE_MASK (PHPDBG_HAS_FUNCTION_OPLINE_BP | PHPDBG_HAS_METHOD_OPLINE_BP | PHPDBG_HAS_FILE_OPLINE_BP)

sapi/phpdbg/phpdbg_help.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ phpdbg_help_text_t phpdbg_help_text[] = {
383383
" **-I** Ignore default .phpdbginit" CR
384384
" **-O** **-O**my.oplog Sets oplog output file" CR
385385
" **-r** Run execution context" CR
386-
" **-rr** Run execution context and quit after execution" CR
386+
" **-rr** Run execution context and quit after execution (not respecting breakpoints)" CR
387387
" **-e** Generate extended information for debugger/profiler" CR
388388
" **-E** Enable step through eval, careful!" CR
389389
" **-S** **-S**cli Override SAPI name, careful!" CR

sapi/phpdbg/phpdbg_prompt.c

+5
Original file line numberDiff line numberDiff line change
@@ -1476,6 +1476,11 @@ void phpdbg_execute_ex(zend_execute_data *execute_data) /* {{{ */
14761476
}
14771477
#endif
14781478

1479+
if (PHPDBG_G(flags) & PHPDBG_PREVENT_INTERACTIVE) {
1480+
phpdbg_print_opline_ex(execute_data, 0);
1481+
goto next;
1482+
}
1483+
14791484
/* check for uncaught exceptions */
14801485
if (exception && PHPDBG_G(handled_exception) != exception && !(PHPDBG_G(flags) & PHPDBG_IN_EVAL)) {
14811486
zend_execute_data *prev_ex = execute_data;

0 commit comments

Comments
 (0)