-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PHP: Fixed closing tag issue (#1652)
This fixes that PHP's closing tag (`?>`) was detected inside strings and comments.
- Loading branch information
1 parent
152a68e
commit 289ddd9
Showing
5 changed files
with
80 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
echo '<?xml version="1.0" encoding="UTF-8"?><tracker />'; | ||
echo PHP_EOL; | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["php", [ | ||
["delimiter", "<?php"], | ||
["keyword", "echo"], | ||
["single-quoted-string", "'<?xml version=\"1.0\" encoding=\"UTF-8\"?><tracker />'"], | ||
["punctuation", ";"], | ||
["keyword", "echo"], | ||
["constant", "PHP_EOL"], | ||
["punctuation", ";"] | ||
]] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for PHP closing tags '?>' inside of strings. | ||
See #1582 for details. |
44 changes: 44 additions & 0 deletions
44
tests/languages/markup+php/php_with_closing_tag_in_markup_feature.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
// ' | ||
# " | ||
//* | ||
echo '?>' + "?>"; /* ?> */ | ||
echo PHP_EOL; | ||
// */ | ||
// ?> | ||
|
||
<?php # ?> | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["php", [ | ||
["delimiter", "<?php"], | ||
["comment", "// '"], | ||
["shell-comment", "# \""], | ||
["comment", "//*"], | ||
["keyword", "echo"], | ||
["single-quoted-string", "'?>'"], | ||
["operator", "+"], | ||
["double-quoted-string", ["\"?>\""]], | ||
["punctuation", ";"], | ||
["comment", "/* ?> */"], | ||
["keyword", "echo"], | ||
["constant", "PHP_EOL"], | ||
["punctuation", ";"], | ||
["comment", "// */"], | ||
["comment", "// "], | ||
["delimiter", "?>"] | ||
]], | ||
|
||
["php", [ | ||
["delimiter", "<?php"], | ||
["shell-comment", "# "], | ||
["delimiter", "?>"] | ||
]] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for PHP closing tags '?>' inside of strings and comments. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters