#48177 [NEW]: Cannot wrap eval'd code with HTML
| From: | skds1433 at hotmail dot com | Date: | Thu, 07 May 2009 10:13:29 +0000 |
| Subject: | #48177 [NEW]: Cannot wrap eval'd code with HTML | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-136918@lists.php.net to get a copy of this message | ||
From: skds1433 at hotmail dot com
Operating system: Windows Vista
PHP version: 5.2.9
PHP Bug Type: Output Control
Bug description: Cannot wrap eval'd code with HTML
Description:
------------
For debugging purposes of a template system, I am trying to wrap the
output of an eval inside pre HTML tags. Oddly, the tags are simply being
appended.
PHP version: 5.2.9-2
Apache: 2.2.11
Reproduce code:
---------------
<?php
$buffer = 'testing 1 2 3, test test test test.
0123456789012345678901234567890123456789
012345678901234567890123456789
0123456789012345678901234567890123456789(<?php if
(isset($global[\'testing1\'])): ?>testing1<?php if
(isset($global[\'testing2\'])): ?> "testing2 extended"<?php if
(isset($global[\'testing3\'])): ?> "testing3 extended"<?php endif;
?><?php
endif; ?><?php endif; ?>)0123456789
012345678901234567890123456789
<?php if (isset($global[\'loop1\']) && is_array($global[\'loop1\'])):
for($i=0;$i<count($global[\'loop1\']);$i++):
?><?=$global[\'loop1\'][\'var1\']?>
<?=$global[\'loop1\'][\'var2\']?> <?php
if ($global[\'loop1\'][\'showvar3\']):
?><?=$global[\'loop1\'][\'var3\']?><?php endif; ?><?php
endfor; endif; ?>
<?php if (isset($global[\'testing4\'])): ?>testing4<?php if
(isset($global[\'testing5\'])): ?> testing5<?php if
(isset($global[\'testing6\'])): ?> <this is file1><?php endif; ?><?php
endif; ?><?php endif; ?>';
$buffer = eval("?>".$buffer);
echo "<pre>".$buffer."</pre>";
?>
Expected result:
----------------
<pre>testing 1 2 3, test test test test.
0123456789012345678901234567890123456789
012345678901234567890123456789
0123456789012345678901234567890123456789()0123456789
012345678901234567890123456789
</pre>
Actual result:
--------------
testing 1 2 3, test test test test.
0123456789012345678901234567890123456789
012345678901234567890123456789
0123456789012345678901234567890123456789()0123456789
012345678901234567890123456789
<pre></pre>
--
Edit bug report at http://bugs.php.net/?id=48177&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48177&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48177&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48177&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=48177&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48177&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=48177&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=48177&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=48177&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=48177&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=48177&r=support
Expected behavior: http://bugs.php.net/fix.php?id=48177&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=48177&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=48177&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=48177&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48177&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=48177&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=48177&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=48177&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=48177&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=48177&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=48177&r=mysqlcfg