|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78604 token_get_all() does not properly tokenize FOO<?php with short_open_tag=0
Submitted: 2019-09-28 14:09 UTC Modified: 2019-09-28 15:55 UTC
From: Assigned: nikic (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 7.4.0RC2 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
New email:
PHP Version: OS:


 [2019-09-28 14:09 UTC]
Note that this happened for me when php was configured with short tags, both for the latest php 7.4 and 8.0 (e.g. this is what travis/ would do)

ext/tokenizer/tests/php_tag_only.phpt would fail if php.ini had short_open_tags=0

tested with php 7.4 NTS, ZTS, and php 8.0 NTS (compiled within the last month)

Test script:
» php --no-php-ini  -d short_open_tag=0 -a                   
Interactive shell

php > var_export(token_get_all('FOO<?php'));
array (
  0 => 
  array (
    0 => 313,
    1 => 'FOO<?php',
    2 => 1,
php > echo PHP_VERSION;

Expected result:
Outputs two tokens, one for FOO, and one for <?php

Actual result:
Outputs a single token with FOO<?php


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-09-28 14:50 UTC]
Evaluation is also affected

» php --no-php-ini  -d short_open_tag=0 -a
Interactive shell

php > eval('?>FOO<?php');
 [2019-09-28 15:54 UTC]
-Package: Testing related +Package: Scripting Engine problem -Assigned To: +Assigned To: nikic
 [2019-09-30 08:43 UTC]
Automatic comment on behalf of
Log: Fixed bug #78604
 [2019-09-30 08:43 UTC]
-Status: Assigned +Status: Closed
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Tue Sep 22 00:01:23 2020 UTC