#32918 [NEW]: highlight_string (and highlight_file?) indent incorrectly.

From: Date: Mon, 02 May 2005 21:59:52 +0000
Subject: #32918 [NEW]: highlight_string (and highlight_file?) indent incorrectly.
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-78536@lists.php.net to get a copy of this message
From: mpb dot mail at gmail dot com Operating system: Gentoo Linux PHP version: 5.0.3 PHP Bug Type: Strings related Bug description: highlight_string (and highlight_file?) indent incorrectly. Description: ------------ The highlight_string function fails to properly indent lines that begin with a single space. I suspect highlight_file has the same problem, but have not tested it. In the reproduce code (below), the line ' *' actually renders as: <br /> *<br /> Instead of the expected: <br />&nbsp;*<br /> So, I guess if a line begins with a single space, that space needs to be converted into '&nbsp;' even though it is a singleton. Reproduce code: --------------- <?php $comment = array ('/*', '*', ' *', ' *', "\t*/"); $comment = join ("\n", $comment); highlight_string ($comment); ?> Expected result: ---------------- <code><span style="color: #000000"> /*<br />*<br />&nbsp;*<br />&nbsp;&nbsp;*<br />&nbsp;&nbsp;&nbsp;&nbsp;*/</span> </code> Actual result: -------------- <code><span style="color: #000000"> /*<br />*<br /> *<br />&nbsp;&nbsp;*<br />&nbsp;&nbsp;&nbsp;&nbsp;*/</span> </code> -- Edit bug report at http://bugs.php.net/?id=32918&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32918&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32918&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32918&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=32918&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=32918&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=32918&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=32918&r=needscript Try newer version: http://bugs.php.net/fix.php?id=32918&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=32918&r=support Expected behavior: http://bugs.php.net/fix.php?id=32918&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=32918&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=32918&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=32918&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32918&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=32918&r=dst IIS Stability: http://bugs.php.net/fix.php?id=32918&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=32918&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=32918&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=32918&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=32918&r=mysqlcfg

« previous php.bugs (#78536) next »