|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-05-07 10:22 UTC] skds1433 at hotmail dot com
[2009-05-07 10:38 UTC] mattwil@php.net
[2009-05-07 11:04 UTC] skds1433 at hotmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Fri Jan 30 21:00:01 2026 UTC |
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>