php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76991 Incorrect tokenization of multiple invalid flexible heredoc strings
Submitted: 2018-10-10 12:07 UTC Modified: -
From: nikic@php.net Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 7.3.0RC2 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
29 + 38 = ?
Subscribe to this entry?

 
 [2018-10-10 12:07 UTC] nikic@php.net
Description:
------------
The end label for the second heredoc string is cut off here, with the remainder becoming a T_STRING.

Test script:
---------------
<?php

$code = <<<'CODE'
<?php

<<<TEST
$a 
 TEST;

<<<END
$a
 END;
CODE;

var_dump(token_get_all($code));

Expected result:
----------------
[11]=> array(3) {
  [0]=> int(384)
  [1]=> string(3) " END"
  [2]=> int(9)
}

Actual result:
--------------
[11]=> array(3) {
  [0]=> int(384)
  [1]=> string(3) " EN"
  [2]=> int(9)
}
[12]=> array(3) {
  [0]=> int(319)
  [1]=> string(1) "D"
  [2]=> int(9)
}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-10-10 13:01 UTC] nikic@php.net
Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=01948f20b8ae8eed252177f63bf2c9c11a8f1b94
Log: Fixed bug #76991
 [2018-10-10 13:01 UTC] nikic@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 10:01:28 2024 UTC