diff options
| author | Nikita Popov <nikita.ppv@gmail.com> | 2019-09-30 10:41:14 +0200 |
|---|---|---|
| committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-09-30 10:41:14 +0200 |
| commit | 19e7e4b19717d0b66c0aad39992c5d98e62bf10e (patch) | |
| tree | 51645b5ffb06432e98fa91661ff363e3246264e0 | |
| parent | 1806ce9cb019ee74ddb540cbc07daf121dcb5537 (diff) | |
| download | php-git-19e7e4b19717d0b66c0aad39992c5d98e62bf10e.tar.gz | |
Fixed bug #78604
<?php followed by EOF is valid since PHP 7.4.
| -rw-r--r-- | NEWS | 4 | ||||
| -rw-r--r-- | Zend/zend_language_scanner.l | 3 | ||||
| -rw-r--r-- | ext/tokenizer/tests/php_tag_only.phpt | 2 | ||||
| -rw-r--r-- | ext/tokenizer/tests/php_tag_only_2.phpt | 23 |
4 files changed, 31 insertions, 1 deletions
@@ -2,6 +2,10 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? ????, PHP 7.4.0RC3 +- Core: + . Fixed bug #78604 (token_get_all() does not properly tokenize FOO<?php with + short_open_tag=0). (Nikita) + - FFI: . Fixed bug #78543 (is_callable() on FFI\CData throws Exception). (cmb) diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l index bfe71705b9..ba692c184b 100644 --- a/Zend/zend_language_scanner.l +++ b/Zend/zend_language_scanner.l @@ -2057,7 +2057,8 @@ inline_char_handler: if (CG(short_tags) /* <? */ || (*(YYCURSOR + 1) == '=') /* <?= */ || (!strncasecmp((char*)YYCURSOR + 1, "php", 3) && /* <?php[ \t\r\n] */ - (YYCURSOR[4] == ' ' || YYCURSOR[4] == '\t' || + (YYCURSOR + 4 == YYLIMIT || + YYCURSOR[4] == ' ' || YYCURSOR[4] == '\t' || YYCURSOR[4] == '\n' || YYCURSOR[4] == '\r')) ) { YYCURSOR--; diff --git a/ext/tokenizer/tests/php_tag_only.phpt b/ext/tokenizer/tests/php_tag_only.phpt index aec11f9e16..3d51e0cea5 100644 --- a/ext/tokenizer/tests/php_tag_only.phpt +++ b/ext/tokenizer/tests/php_tag_only.phpt @@ -2,6 +2,8 @@ Tokenization of only the <?php tag --SKIPIF-- <?php if (!extension_loaded("tokenizer")) print "skip tokenizer extension not enabled"; ?> +--INI-- +short_open_tag=1 --FILE-- <?php diff --git a/ext/tokenizer/tests/php_tag_only_2.phpt b/ext/tokenizer/tests/php_tag_only_2.phpt new file mode 100644 index 0000000000..60e4004179 --- /dev/null +++ b/ext/tokenizer/tests/php_tag_only_2.phpt @@ -0,0 +1,23 @@ +--TEST-- +Tokenization of only the <?php tag +--SKIPIF-- +<?php if (!extension_loaded("tokenizer")) print "skip tokenizer extension not enabled"; ?> +--INI-- +short_open_tag=0 +--FILE-- +<?php + +foreach (token_get_all("<?php") as $token) { + echo token_name($token[0]), "\n"; +} +echo "\n"; +foreach (token_get_all("Foobar<?php") as $token) { + echo token_name($token[0]), "\n"; +} + +?> +--EXPECT-- +T_OPEN_TAG + +T_INLINE_HTML +T_OPEN_TAG |
