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
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 — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
43 - 20 = ?
Subscribe to this entry?

 
 [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: Thu May 02 15:01:33 2024 UTC