[Bug 238872] [NEW] php5 fails to interpret a valid script using heredoc string syntax

David david at nuteca.com
Tue Jun 10 15:24:39 BST 2008


Public bug reported:

Binary package hint: php5

This script

<?php
$a=<<<E
Hello
WHERE
E;

echo $a;
?>

should print:

Hello WHERE

Instead I get something like:

Parse error: syntax error, unexpected T_STRING in ... on line 6

There are no extra characters before or after the heredoc start/end
identifiers.

The problem seems to be caused by the last "E" on the "WHERE", as the
script will be considered syntactically correct if we change the start
and end identifiers for "EOT" or "X". It will work as well if we write
"WHER" instead of "WHERE".

This seems to be a bug, as the script is syntactically correct and it
works correctly on other PHP4 servers as well as on non-ubuntu, non-
debian PHP5 servers.

The server affected by this bug has Ubuntu 8.04.

The PHP5 package version is 5.2.4-2ubuntu5.1

** Affects: php5 (Ubuntu)
     Importance: Undecided
         Status: Confirmed


** Tags: php5

** Description changed:

  Binary package hint: php5
  
  This script
  
  <?php
  $a=<<<E
  Hello
  WHERE
  E;
  
  echo $a;
  ?>
  
  should print:
  
- Hello
- WHERE
+ Hello WHERE
  
  Instead I get something like:
  
  Parse error: syntax error, unexpected T_STRING in ... on line 6
  
  There are no extra characters before or after the heredoc start/end
  identifiers.
  
  The problem seems to be caused by the last "E" on the "WHERE", as the
  script will be considered syntactically correct if we change the start
  and end identifiers for "EOT" or "X". It will work as well if we write
  "WHER" instead of "WHERE".
  
  This seems to be a bug, as the script is syntactically correct and it
  works correctly on other PHP4 servers as well as on non-ubuntu, non-
  debian PHP5 servers.
  
  The server affected by this bug has Ubuntu 8.04.
  
  The PHP5 package version is 5.2.4-2ubuntu5.1

** Tags added: php5

-- 
php5 fails to interpret a valid script using heredoc string syntax
https://bugs.launchpad.net/bugs/238872
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to php5 in ubuntu.



More information about the Ubuntu-server-bugs mailing list