Skip to content

Commit 8228597

Browse files
committed
Fixed bug #63874 (Segfaul if php_strip_whitespace has heredoc)
T_END_HEREDOC don't carry a token value anymore since commit 4cf90e0 Bugfix by Nikita for bug #60097
1 parent f8a9a47 commit 8228597

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

NEWS

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ PHP NEWS
33
?? ??? 201?, PHP 5.5.0 Alpha 3
44

55
- General improvements:
6+
. Fixed bug #63874 (Segfault if php_strip_whitespace has heredoc). (Pierrick)
67
. Fixed bug #63822 (Crash when using closures with ArrayAccess).
78
(Nikita Popov)
89
. Add Generator::throw() method. (Nikita Popov)

Zend/zend_highlight.c

-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ ZEND_API void zend_strip(TSRMLS_D)
186186

187187
case T_END_HEREDOC:
188188
zend_write((char*)LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
189-
efree(token.value.str.val);
190189
/* read the following character, either newline or ; */
191190
if (lex_scan(&token TSRMLS_CC) != T_WHITESPACE) {
192191
zend_write((char*)LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
--TEST--
2+
Bug #63874 (Segfault if php_strip_whitespace has heredoc)
3+
--FILE--
4+
<?php
5+
echo php_strip_whitespace(__FILE__);
6+
7+
return <<<A
8+
a
9+
A;
10+
?>
11+
--EXPECT--
12+
<?php
13+
echo php_strip_whitespace(__FILE__); return <<<A
14+
a
15+
A;
16+
?>

0 commit comments

Comments
 (0)