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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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