#29338 [Opn->Ver]: highlight_* don't translate single leading space to  

From: Date: Mon, 13 Dec 2004 06:25:04 +0000
Subject: #29338 [Opn->Ver]: highlight_* don't translate single leading space to  
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-70126@lists.php.net to get a copy of this message
ID: 29338 Updated by: sniper@php.net Reported By: francois at bonzon dot com -Status: Open +Status: Verified Bug Type: Strings related -Operating System: Linux +Operating System: * -PHP Version: 4.3.8 +PHP Version: 4CVS, 5CVS (2004-12-12) Previous Comments: ------------------------------------------------------------------------ [2004-07-22 19:43:40] francois at bonzon dot com Changed the bug title to something better. ------------------------------------------------------------------------ [2004-07-22 19:41:18] francois at bonzon dot com Description: ------------ The highlight_file() and highlight_string() functions don't translate the leading space of a line to &nbsp; when this line has exactly one leading space (or identation space if you prefer). As web browsers don't display leading spaces of a line (that are not &nbsp; of course), this single leading space then disapears on the output visible in the browser. When there are two or more spaces, they are all correctly translated to &nbsp; however, and the identation is visible. Reproduce code: --------------- highlight_string('<?php no_leading_space($test); one_leading_space($test); two_leading_spaces($test); three_leading_spaces($test); four_leading_spaces($test); ?>'); Expected result: ---------------- <?php no_leading_space($test); one_leading_space($test); two_leading_spaces($test); three_leading_spaces($test); four_leading_spaces($test); ?> with HTML source (excerpt): ... <font color="#007700">);<br />&nbsp;</font><font color="#0000BB">one_leading_space</font> ... Actual result: -------------- <?php no_leading_space($test); one_leading_space($test); two_leading_spaces($test); three_leading_spaces($test); four_leading_spaces($test); ?> with HTML source (excerpt): ... <font color="#007700">);<br /> </font><font color="#0000BB">one_leading_space</font> ... ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29338&edit=1

« previous php.bugs (#70126) next »