File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #42767 (highlight_string() truncates trailing comments)
3
+ --FILE--
4
+ <?php
5
+ highlight_string ('<?php /*some comment.. ' );
6
+ ?>
7
+ --EXPECT--
8
+ <code><span style="color: #000000">
9
+ <span style="color: #0000BB"><?php </span><span style="color: #FF8000">/*some comment..</span>
10
+ </span>
11
+ </code>
Original file line number Diff line number Diff line change @@ -177,6 +177,19 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini
177
177
}
178
178
token .type = 0 ;
179
179
}
180
+
181
+ /* handler for trailing comments, see bug #42767 */
182
+ if (LANG_SCNG (yy_leng ) && LANG_SCNG (_yy_more_len )) {
183
+ if (last_color != syntax_highlighter_ini -> highlight_comment ) {
184
+ if (last_color != syntax_highlighter_ini -> highlight_html ) {
185
+ zend_printf ("</span>" );
186
+ }
187
+ if (syntax_highlighter_ini -> highlight_comment != syntax_highlighter_ini -> highlight_html ) {
188
+ zend_printf ("<span style=\"color: %s\">" , syntax_highlighter_ini -> highlight_comment );
189
+ }
190
+ }
191
+ zend_html_puts (LANG_SCNG (yy_text ), LANG_SCNG (_yy_more_len ) TSRMLS_CC );
192
+ }
180
193
done :
181
194
if (last_color != syntax_highlighter_ini -> highlight_html ) {
182
195
zend_printf ("</span>\n" );
@@ -185,8 +198,6 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini
185
198
zend_printf ("</code>" );
186
199
}
187
200
188
-
189
-
190
201
ZEND_API void zend_strip (TSRMLS_D )
191
202
{
192
203
zval token ;
You can’t perform that action at this time.
0 commit comments