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
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: 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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 09 01:01:35 2025 UTC