File tree 3 files changed +36
-8
lines changed
3 files changed +36
-8
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,8 @@ PHP NEWS
14
14
. Fixed bug GH-14741 (Segmentation fault in Zend/zend_types.h). (nielsdos)
15
15
. Fixed bug GH-14969 (Use-after-free in property coercion with __toString()).
16
16
(ilutov)
17
+ . Fixed bug GH-14961 (Comment between -> and keyword results in parse error).
18
+ (ilutov)
17
19
18
20
- Dom:
19
21
. Fixed bug GH-14702 (DOMDocument::xinclude() crash). (nielsdos)
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ GH-14961: Comment between -> and keyword
3
+ --FILE--
4
+ <?php
5
+
6
+ class C {
7
+ public $ class = C::class;
8
+ }
9
+
10
+ $ c = new C ();
11
+ $ c ->/* comment */ class = 42 ;
12
+ var_dump ($ c ->/** doc comment */ class );
13
+ var_dump ($ c ->
14
+ // line comment
15
+ class );
16
+ var_dump ($ c ->
17
+ # hash comment
18
+ class );
19
+ var_dump ($ c ?->/* comment */ class);
20
+
21
+ ?>
22
+ --EXPECT--
23
+ int(42)
24
+ int(42)
25
+ int(42)
26
+ int(42)
Original file line number Diff line number Diff line change @@ -1587,12 +1587,6 @@ NEWLINE ("\r"|"\n"|"\r\n")
1587
1587
RETURN_TOKEN_WITH_STR (T_STRING, 0 );
1588
1588
}
1589
1589
1590
- <ST_LOOKING_FOR_PROPERTY>{ANY_CHAR} {
1591
- yyless (0 );
1592
- yy_pop_state ();
1593
- goto restart;
1594
- }
1595
-
1596
1590
<ST_IN_SCRIPTING>" ::" {
1597
1591
RETURN_TOKEN (T_PAAMAYIM_NEKUDOTAYIM);
1598
1592
}
@@ -2375,7 +2369,7 @@ inline_char_handler:
2375
2369
}
2376
2370
2377
2371
2378
- <ST_IN_SCRIPTING>" #" |" // " {
2372
+ <ST_IN_SCRIPTING,ST_LOOKING_FOR_PROPERTY >" #" |" // " {
2379
2373
while ( YYCURSOR < YYLIMIT) {
2380
2374
switch (*YYCURSOR++) {
2381
2375
case ' \r ' :
@@ -2399,7 +2393,7 @@ inline_char_handler:
2399
2393
RETURN_OR_SKIP_TOKEN (T_COMMENT);
2400
2394
}
2401
2395
2402
- <ST_IN_SCRIPTING>" /*" |" /**" {WHITESPACE} {
2396
+ <ST_IN_SCRIPTING,ST_LOOKING_FOR_PROPERTY >" /*" |" /**" {WHITESPACE} {
2403
2397
int doc_com;
2404
2398
2405
2399
if (yyleng > 2 ) {
@@ -2435,6 +2429,12 @@ inline_char_handler:
2435
2429
RETURN_OR_SKIP_TOKEN (T_COMMENT);
2436
2430
}
2437
2431
2432
+ <ST_LOOKING_FOR_PROPERTY>{ANY_CHAR} {
2433
+ yyless (0 );
2434
+ yy_pop_state ();
2435
+ goto restart;
2436
+ }
2437
+
2438
2438
<ST_IN_SCRIPTING>" ?>" {NEWLINE}? {
2439
2439
BEGIN (INITIAL);
2440
2440
if (yytext[yyleng-1 ] != ' >' ) {
You can’t perform that action at this time.
0 commit comments