]> granicus.if.org Git - php/commitdiff
MFH: Fixed bug #31371 (highlight_file() trims new line after heredoc).
authorIlia Alshanetsky <iliaa@php.net>
Sun, 2 Jan 2005 23:54:59 +0000 (23:54 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Sun, 2 Jan 2005 23:54:59 +0000 (23:54 +0000)
NEWS
Zend/zend_highlight.c

diff --git a/NEWS b/NEWS
index fbdcfb35803959748929779e81ffd15cae4414e0..2bd86b701d482a6611803383d032d5ddf1bbedeb 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,7 @@ PHP                                                                        NEWS
 - Added Oracle Instant Client support. (cjbj at hotmail dot com, Tony)
 - Added length and charsetnr for field array and object in mysqli. (Georg)
 - Fixed a bug in mysqli_stmt_execute() (type conversion with NULL values). (Georg)
+- Fixed bug #31371 (highlight_file() trims new line after heredoc). (Ilia)
 - Fixed bug #31361 (simplexml/domxml segfault when adding node twice). (Rob)
 - Fixed bug #31142 (imap_mail_compose() fails to generate correct output). (Ilia)
 - Fixed bug #31139 (XML Parser Functions seem to drop &amp; when parsing). (Rob)
index cf2ddc091a5fe459ce645d4d38ae8977648d0dfc..7f91abe318c78809a963d6d1c4d114b80574dd91 100644 (file)
@@ -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;
                }