summaryrefslogtreecommitdiff
path: root/Zend/zend_highlight.c
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2003-03-06 14:47:13 +0000
committerIlia Alshanetsky <iliaa@php.net>2003-03-06 14:47:13 +0000
commit2cb46d44799e2ed202b5590b15ae6c4c0cb37b8b (patch)
tree8c681a92100bbd03fc4c79143bce76cdcbb2d172 /Zend/zend_highlight.c
parent44347cf64b47048b298609da7fb69934266a6aa2 (diff)
downloadphp-git-2cb46d44799e2ed202b5590b15ae6c4c0cb37b8b.tar.gz
Fixed in zend_strip() that corrupted heredoc.
Optimized the writing routine by moving from putchar() to fwrite(). Changed hardcoded opcode # to it's defined name.
Diffstat (limited to 'Zend/zend_highlight.c')
-rw-r--r--Zend/zend_highlight.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/Zend/zend_highlight.c b/Zend/zend_highlight.c
index 22a87cf71f..6a6b9d2530 100644
--- a/Zend/zend_highlight.c
+++ b/Zend/zend_highlight.c
@@ -202,14 +202,22 @@ ZEND_API void zend_strip(TSRMLS_D)
}
switch (token_type) {
- case 349:
+ case T_CLASS:
break;
default: {
- char c, *ptr=LANG_SCNG(yy_text), *end=LANG_SCNG(yy_text)+LANG_SCNG(yy_leng);
- while (ptr<end) {
- c = *ptr++;
- putchar(c);
+ char *ptr = LANG_SCNG(yy_text);
+
+ if (token_type != T_END_HEREDOC) {
+ fwrite(ptr, LANG_SCNG(yy_leng), 1, stdout);
+ } else {
+ fwrite(ptr, LANG_SCNG(yy_leng) - 1, 1, stdout);
+ /* The ensure that we only write one ; and that it followed by the required newline */
+ putchar('\n');
+ if (ptr[LANG_SCNG(yy_leng) - 1] == ';') {
+ lex_scan(&token TSRMLS_CC);
+ }
+ efree(token.value.str.val);
}
}
break;
@@ -228,14 +236,6 @@ ZEND_API void zend_strip(TSRMLS_D)
efree(token.value.str.val);
break;
}
- } else if (token_type == T_END_HEREDOC) {
- zend_bool has_semicolon=(strchr(token.value.str.val, ';')?1:0);
-
- efree(token.value.str.val);
- if (has_semicolon) {
- /* the following semicolon was unput(), ignore it */
- lex_scan(&token TSRMLS_CC);
- }
}
token.type = 0;
}