From:             kjartan at zind dot net
Operating system: Linux + Windows
PHP version:      4.3.3
PHP Bug Type:     Unknown/Other Function
Bug description:  highlight_string doesn't parse strings containing \ properly

Description:
------------
Given a string that contains this PHP code:

<?php
$a = 2;
\;
$b = 3;
?>

Then highlight_string() generates this:

<?php
$a = 2;

Warning: Unexpected character in input:  '\' (ASCII=92) state=1 in
/home/kjartan/scripts/highlight_string on line 9
;
$b = 3;
?>

Granted its not valid PHP, but should hightlight_string() function as a
PHP validation system? Not that it does a good job at it as this gets
colored just fine:

<?php
$a = 2
$b = 3
$c = 5
?>

What gives?

Reproduce code:
---------------
<?php
$string = '<?php
$a = 2;
\
$c = 5;
?>';

highlight_string($string);


Expected result:
----------------
I expect it to just leave the \ alone and not cause warnings.


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

Reply via email to