Skip to content

Commit 054fad6

Browse files
davidransnikic
authored andcommitted
PHPDBG: fix bug parsing 3-word opcodes
PHPDBG won't parse opcodes correctly if they are more than two words separated by underscores (as many opcodes, like ZEND_POST_INC, are). Now opcodes that have more than one underscore (e.g. ZEND_POST_INC) are parsed correctly. Closes phpGH-6895.
1 parent 1fcea24 commit 054fad6

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

sapi/phpdbg/phpdbg_lexer.l

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ DIGITS [-]?[0-9\.]+
8181
ID [^ \r\n\t:#\000]+
8282
GENERIC_ID ([^ \r\n\t:#\000"']|":\\")+|["]([^\n\000"\\]|"\\\\"|"\\"["])+["]|[']([^\n\000'\\]|"\\\\"|"\\"['])+[']
8383
ADDR [0][x][a-fA-F0-9]+
84-
OPCODE (ZEND_|zend_)([A-Za-z])+
84+
OPCODE (ZEND_|zend_)([A-Z_a-z])+
8585
INPUT ("\\"[#"']|["]("\\\\"|"\\"["]|[^\n\000"])+["]|[']("\\"[']|"\\\\"|[^\n\000'])+[']|[^\n\000#"'])+
8686
8787
<!*> := yyleng = (size_t) YYCURSOR - (size_t) yytext;
+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
--TEST--
2+
Test parsing longer opcode
3+
--PHPDBG--
4+
b ZEND_POST_INC
5+
r
6+
c
7+
8+
9+
10+
q
11+
--EXPECTF--
12+
[Successful compilation of %s]
13+
prompt> [Breakpoint #0 added at ZEND_POST_INC]
14+
prompt> [Breakpoint #0 in ZEND_POST_INC at %s:3, hits: 1]
15+
>00003: echo $i++;
16+
00004: echo $i++;
17+
00005: echo $i++;
18+
prompt> 1
19+
[Breakpoint #0 in ZEND_POST_INC at %s:4, hits: 2]
20+
>00004: echo $i++;
21+
00005: echo $i++;
22+
00006: echo $i++;
23+
prompt> 2
24+
[Breakpoint #0 in ZEND_POST_INC at %s:5, hits: 3]
25+
>00005: echo $i++;
26+
00006: echo $i++;
27+
00007:
28+
prompt> 3
29+
[Breakpoint #0 in ZEND_POST_INC at %s:6, hits: 4]
30+
>00006: echo $i++;
31+
00007:
32+
prompt> 4
33+
[Script ended normally]
34+
prompt>
35+
--FILE--
36+
<?php
37+
$i = 1;
38+
echo $i++;
39+
echo $i++;
40+
echo $i++;
41+
echo $i++;

0 commit comments

Comments
 (0)