Fixed Bug #26703 (Certain characters inside strings incorrectly treated as

keywords). Original patch by vrana@php.net.
This commit is contained in:
Ilia Alshanetsky 2003-12-25 18:57:26 +00:00
parent 12c7ae9f55
commit 0688205940
2 changed files with 22 additions and 6 deletions

View file

@ -137,15 +137,13 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini
continue;
break;
default:
if (token.type==0) {
next_color = syntax_highlighter_ini->highlight_keyword;
} else {
if (in_string) {
next_color = syntax_highlighter_ini->highlight_string;
} else if (token.type == 0) {
next_color = syntax_highlighter_ini->highlight_keyword;
} else {
next_color = syntax_highlighter_ini->highlight_default;
}
}
break;
}

View file

@ -0,0 +1,18 @@
--TEST--
Bug #26703 (Certain characters inside strings incorrectly treated as keywords)
--INI--
highlight.string=#DD0000
highlight.comment=#FF9900
highlight.keyword=#007700
highlight.bg=#FFFFFF
highlight.default=#0000BB
highlight.html=#000000
--FILE--
<?php
highlight_string('<?php echo "foo[] $a \n"; ?>');
?>
--EXPECT--
<code><font color="#000000">
<font color="#0000BB">&lt;?php </font><font color="#007700">echo </font><font color="#DD0000">"foo[] $a \n"</font><font color="#007700">; </font><font color="#0000BB">?&gt;</font>
</font>
</code>