|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27101 Eval Error
Submitted: 2004-01-30 17:13 UTC Modified: 2004-01-30 17:36 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: daniel dot marschall at surfeu dot de Assigned:
Status: Not a bug Package: *Programming Data Structures
PHP Version: 4.3.4 OS: Linux
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: daniel dot marschall at surfeu dot de
New email:
PHP Version: OS:


 [2004-01-30 17:13 UTC] daniel dot marschall at surfeu dot de

echo eval('<? if (1 == 1) { ?><? } ?>');


This let a parse error in the eval appear.

The Code <? if (1 == 1) { ?><? } ?> is ok and don't let the parse error appear.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-30 17:29 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

You can't have nested php-tags, try:

eval('if (1 == 1) { ?>works<? }');

in a sense your example does:
<?php <? if (1 == 1) { ?><? } ?> ?>

Which is wrong
 [2004-01-30 17:35 UTC]
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.

 [2004-01-30 17:36 UTC] daniel dot marschall at surfeu dot de
Hello. I was wrong. My real problem is:

# taken from a user comment

function eval_buffer($string) {
   $return = ob_get_contents();
   return $return;

function eval_print_buffer($string) {
   eval("print $string[2];");
   $return = ob_get_contents();
   return $return;

function eval_html($string) {
   $string = preg_replace_callback("/(<\?=)(.*?)\?>/si",
   return preg_replace_callback("/(<\?php|<\?)(.*?)\?>/si",

echo html_eval('<? if (1 == 1) { ?><? } ?>');

And this causes the error. But I don't know if it is the fault of the user-comment-script or if the problem is in eval.
 [2004-01-30 17:36 UTC]
oops, tom is right
 [2004-04-07 13:10 UTC] mr dot heat at gmx dot de
Drop this annoying evalHtml crap. Use eval("?>" . $string);!
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Feb 26 09:01:26 2024 UTC