Skip to content

Commit 8f256be

Browse files
committed
Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0: update NEWS phpdbg next command must stop when leaving function
2 parents f7e5481 + 9ee913a commit 8f256be

File tree

2 files changed

+44
-3
lines changed

2 files changed

+44
-3
lines changed

sapi/phpdbg/phpdbg_prompt.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1535,12 +1535,18 @@ void phpdbg_execute_ex(zend_execute_data *execute_data) /* {{{ */
15351535
goto next;
15361536
}
15371537

1538+
/* not while in conditionals */
1539+
phpdbg_print_opline_ex(execute_data, 0);
1540+
15381541
/* perform seek operation */
15391542
if ((PHPDBG_G(flags) & PHPDBG_SEEK_MASK) && !(PHPDBG_G(flags) & PHPDBG_IN_EVAL)) {
15401543
/* current address */
15411544
zend_ulong address = (zend_ulong) execute_data->opline;
15421545

15431546
if (PHPDBG_G(seek_ex) != execute_data) {
1547+
if (PHPDBG_G(flags) & PHPDBG_IS_STEPPING) {
1548+
goto stepping;
1549+
}
15441550
goto next;
15451551
}
15461552

@@ -1584,10 +1590,8 @@ void phpdbg_execute_ex(zend_execute_data *execute_data) /* {{{ */
15841590
}
15851591
}
15861592

1587-
/* not while in conditionals */
1588-
phpdbg_print_opline_ex(execute_data, 0);
1589-
15901593
if (PHPDBG_G(flags) & PHPDBG_IS_STEPPING && (PHPDBG_G(flags) & PHPDBG_STEP_OPCODE || execute_data->opline->lineno != PHPDBG_G(last_line))) {
1594+
stepping:
15911595
PHPDBG_G(flags) &= ~PHPDBG_IS_STEPPING;
15921596
DO_INTERACTIVE(1);
15931597
}

sapi/phpdbg/tests/next_001.phpt

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
--TEST--
2+
Test next command on function boundaries
3+
--PHPDBG--
4+
b 4
5+
r
6+
n
7+
8+
9+
q
10+
--EXPECTF--
11+
[Successful compilation of %s]
12+
prompt> [Breakpoint #0 added at %s:4]
13+
prompt> [Breakpoint #0 at %s:4, hits: 1]
14+
>00004: echo 0;
15+
00005: }
16+
00006:
17+
prompt> 0
18+
[L5 %s RETURN null %s]
19+
>00005: }
20+
00006:
21+
00007: foo();
22+
prompt> [L8 %s ECHO 1 %s]
23+
>00008: echo 1;
24+
00009:
25+
prompt> 1
26+
[L8 %s RETURN 1 %s]
27+
[Script ended normally]
28+
prompt>
29+
--FILE--
30+
<?php
31+
32+
function foo() {
33+
echo 0;
34+
}
35+
36+
foo();
37+
echo 1;

0 commit comments

Comments
 (0)