php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50654 Nested heredocs fail
Submitted: 2010-01-04 13:09 UTC Modified: 2010-01-04 13:44 UTC
From: thuejk at gmail dot com Assigned:
Status: Wont fix Package: Scripting Engine problem
PHP Version: 5.2.12 OS: Debian Linux Unstable
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: thuejk at gmail dot com
New email:
PHP Version: OS:

 

 [2010-01-04 13:09 UTC] thuejk at gmail dot com
Description:
------------
Embedding a heredoc inside another heredoc fails to compile on 5.2.12.

(The same code successfully compiles on 5.2.4-ubuntu, but running it has the wrong output.)

Reproduce code:
---------------
<?php
$a = Array("b" => 1);

echo <<<ZZ
{$a[<<<B
b
B
]}
ZZ;
?>


Expected result:
----------------
1

Actual result:
--------------
Parse error: syntax error, unexpected $end in /home/thue/test.php on line 11

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-01-04 13:44 UTC] johannes@php.net
This works in 5.3 by using a new parser. Quite risky to change the parser in 5.2. 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 12:01:27 2024 UTC