Doc #60072 [Opn->Wfx]: eval parameter must not begin with <?php
| From: | frozenfire@php.net | Date: | Sat, 03 Dec 2011 06:26:07 +0000 |
| Subject: | Doc #60072 [Opn->Wfx]: eval parameter must not begin with <?php | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-7509@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=60072&edit=1
ID: 60072
Updated by: frozenfire@php.net
Reported by: mkllnk at web dot de
Summary: eval parameter must not begin with <?php
-Status: Open
+Status: Wont fix
Type: Documentation Problem
Package: Documentation problem
Operating System: Debian Squeeze
PHP Version: 5.3.8
Block user comment: N
Private report: N
New Comment:
I don't think there's much confusion to be had about this. eval() essentially
acts as if you save the string to a file, then include() that file. It's
basically pasting that code into the current scope.
If one places an open tag after another open tag, they should expect an error.
That much should be somewhat evident.
Previous Comments:
------------------------------------------------------------------------
[2011-10-16 20:28:46] mkllnk at web dot de
Description:
------------
---
From manual page: http://www.php.net/function.eval#refsect1-function.eval-
parameters
---
The eval documentation says: "The code string to be evaluated. code_str does not
have to contain PHP Opening tags."
But the code string must not contain PHP Opening tags unless after a PHP Closing
tag.
Test script:
---------------
<?php
eval('<?php echo "hallo\n"; ?>');
?>
Expected result:
----------------
hallo
Actual result:
--------------
PHP Parse error: syntax error, unexpected '<' in /tmp/php/test.php(3) : eval()'d
code on line 1
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60072&edit=1