ID: 48177
User updated by: skds1433 at hotmail dot com
Reported By: skds1433 at hotmail dot com
Status: Open
-Bug Type: Output Control
+Bug Type: Unknown/Other Function
Operating System: Windows Vista
PHP Version: 5.2.9
New Comment:
Changed category, from 'Output Control'. Not really sure what this
applies to.
Previous Comments:
------------------------------------------------------------------------
[2009-05-07 10:13:29] skds1433 at hotmail dot com
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 this bug report at http://bugs.php.net/?id=48177&edit=1