From:             [EMAIL PROTECTED]
Operating system: Any
PHP version:      4.3.4
PHP Bug Type:     Scripting Engine problem
Bug description:  highlight_string and similar highlights improper characters as a 
keyword

Description:
------------
There are two issues with highlight_string, highlight_file and `php -s`:

1. Some characters (like []{}) are highlighted in non-constant strings
(i.e. double quote strings with variables) as a keyword even on places
where they don't have any special purpose.

2. Some characters ([]{} and backslash sequences) are highlighted in
non-constant strings and aren't highlighted in constant strings. It should
be consistent.

Suggested solution: Don't highlight anything as a keyword both in constant
and non-constant strings.

I've already sent a patch for this to [EMAIL PROTECTED]

Reproduce code:
---------------
<?php
highlight_string('<?php "foo[] $a \n"; ?>');
?>


Expected result:
----------------
<code><font color="#000000">
<font color="#0000BB">&lt;?php </font><font color="#DD0000">"foo[] $a
\n"</font><font color="#007700">; </font><font
color="#0000BB">?&gt;</font>
</font>
</code>

Actual result:
--------------
<code><font color="#000000">
<font color="#0000BB">&lt;?php </font><font
color="#DD0000">"foo</font><font color="#007700">[]</font><font
color="#DD0000"> $a </font><font color="#007700">\n</font><font
color="#DD0000">"</font><font color="#007700">; </font><font
color="#0000BB">?&gt;</font>
</font>
</code>

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

Reply via email to