php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29338 highlight_* don't translate single leading space to  
Submitted: 2004-07-22 19:41 UTC Modified: 2005-05-22 19:00 UTC
From: francois at bonzon dot com Assigned:
Status: Closed Package: Strings related
PHP Version: 5CVS, 4CVS (2004-12-12) OS: *
Private report: No CVE-ID: None
 [2004-07-22 19:41 UTC] francois at bonzon dot com
Description:
------------
The highlight_file() and highlight_string() functions don't translate the leading space of a line to   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   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   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> ...

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-05-22 19:00 UTC] iliaa@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 04:01:31 2024 UTC