summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2005-01-02 23:53:43 +0000
committerIlia Alshanetsky <iliaa@php.net>2005-01-02 23:53:43 +0000
commitea7b61dfe5b7c8bbc681c559031acf48fb0c8fb8 (patch)
treeede7e69eb0cab77d74f3581427917273f7e9da7d
parent6bbb254ecc5d75c477c0be2c6a17863ff46f2bf9 (diff)
downloadphp-git-ea7b61dfe5b7c8bbc681c559031acf48fb0c8fb8.tar.gz
Fixed bug #31371 (highlight_file() trims new line after heredoc).
-rw-r--r--Zend/zend_highlight.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/Zend/zend_highlight.c b/Zend/zend_highlight.c
index cf2ddc091a..7f91abe318 100644
--- a/Zend/zend_highlight.c
+++ b/Zend/zend_highlight.c
@@ -102,7 +102,7 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini
int token_type;
char *last_color = syntax_highlighter_ini->highlight_html;
char *next_color;
- int in_string=0;
+ int in_string=0, post_heredoc = 0;
zend_printf("<code>");
zend_printf("<span style=\"color: %s\">\n", last_color);
@@ -159,15 +159,14 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini
switch (token_type) {
case T_END_HEREDOC:
zend_html_puts(token.value.str.val, token.value.str.len TSRMLS_CC);
- {
- char *ptr = LANG_SCNG(yy_text);
- if (ptr[LANG_SCNG(yy_leng) - 1] != ';') {
- zend_html_putc('\n');
- }
- }
+ post_heredoc = 1;
break;
default:
zend_html_puts(LANG_SCNG(yy_text), LANG_SCNG(yy_leng) TSRMLS_CC);
+ if (post_heredoc) {
+ zend_html_putc('\n');
+ post_heredoc = 0;
+ }
break;
}