|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-12-15 05:57 UTC] vrana@php.net
Description:
------------
highlight.keyword isn't used in strings without variables for \n and similar. It is used in strings with variables (e.g. "$a\n").
(The problem is in file /ZendEngine2/zend_highlight.c.)
Reproduce code:
---------------
highlight_string('<?php echo "a\n"; ?>');
Expected result:
----------------
<code><font color="#000000">
<font color="#0000BB"><?php </font><font color="#007700">echo </font><font color="#DD0000">"a</font><font color="#007700">\n</font><font color="#DD0000">"</font><font color="#007700">; </font><font color="#0000BB">?></font>
</font>
</code>
Actual result:
--------------
<code><font color="#000000">
<font color="#0000BB"><?php </font><font color="#007700">echo </font><font color="#DD0000">"a\n"</font><font color="#007700">; </font><font color="#0000BB">?></font>
</font>
</code>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 16:00:01 2025 UTC |
Because the lexer in PHP handles those cases different. "$a\n" = quote + variable + newline character + quote "a\n" = string Try this script: <pre> <?php highlight_string('<?php "a\n"; ?>'); var_dump(token_get_all('<?php "a\n"; ?>')); highlight_string('<?php "$a\n"; ?>'); var_dump(token_get_all('<?php "$a\n"; ?>')); ?> </pre> (and leave this bug bogus)