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 Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: nikic@php.net
New email:
PHP Version: OS:

 

 [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

Pull Requests

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: Thu Nov 21 12:01:29 2024 UTC