File tree Expand file tree Collapse file tree 5 files changed +43
-0
lines changed Expand file tree Collapse file tree 5 files changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,10 @@ PHP 7.4 UPGRADE NOTES
34
34
. Passing the result of a (non-reference) list() assignment by reference is
35
35
consistently disallowed now. Previously this worked if the right hand side
36
36
was a simple (CV) variable and did not occur as part of the list().
37
+ . `<?php` at the end of the file (without trailing newline) will now be
38
+ interpreted as an opening PHP tag. Previously it was interpreted either as
39
+ `<? php` and resulted in a syntax error (with short_open_tag=1) or was
40
+ interpreted as a literal `<?php` string (with short_open_tag=0).
37
41
38
42
- BCMath:
39
43
. BCMath functions will now warn if a non well-formed number is passed, such
Original file line number Diff line number Diff line change
1
+ <?php
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ File with just a <?php tag should be valid
3
+ --FILE_EXTERNAL --
4
+ php_tag_only.inc
5
+ --EXPECT --
Original file line number Diff line number Diff line change @@ -2031,6 +2031,20 @@ string:
2031
2031
RETURN_OR_SKIP_TOKEN (T_OPEN_TAG);
2032
2032
}
2033
2033
2034
+ <INITIAL>" <?php" {
2035
+ /* Allow <?php followed by end of file. */
2036
+ if (YYCURSOR == YYLIMIT) {
2037
+ BEGIN (ST_IN_SCRIPTING);
2038
+ RETURN_OR_SKIP_TOKEN (T_OPEN_TAG);
2039
+ }
2040
+ /* Degenerate case: <?phpX is interpreted as <? phpX with short tags. */
2041
+ if (CG (short_tags)) {
2042
+ yyless (2 );
2043
+ BEGIN (ST_IN_SCRIPTING);
2044
+ RETURN_OR_SKIP_TOKEN (T_OPEN_TAG);
2045
+ }
2046
+ goto inline_char_handler;
2047
+ }
2034
2048
2035
2049
<INITIAL>" <?" {
2036
2050
if (CG (short_tags)) {
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Tokenization of only the <?php tag
3
+ --FILE --
4
+ <?php
5
+
6
+ foreach (token_get_all ("<?php " ) as $ token ) {
7
+ echo token_name ($ token [0 ]), "\n" ;
8
+ }
9
+ echo "\n" ;
10
+ foreach (token_get_all ("Foobar<?php " ) as $ token ) {
11
+ echo token_name ($ token [0 ]), "\n" ;
12
+ }
13
+
14
+ ?>
15
+ --EXPECT--
16
+ T_OPEN_TAG
17
+
18
+ T_INLINE_HTML
19
+ T_OPEN_TAG
You can’t perform that action at this time.
0 commit comments