From:             francois at bonzon dot com
Operating system: Linux
PHP version:      4.3.8
PHP Bug Type:     Scripting Engine problem
Bug description:  highlight_file / highlight_string

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> ...

-- 
Edit bug report at http://bugs.php.net/?id=29338&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=29338&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=29338&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=29338&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=29338&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=29338&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=29338&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=29338&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=29338&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=29338&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=29338&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=29338&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=29338&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29338&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=29338&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=29338&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=29338&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29338&r=float

Reply via email to