Skip to content

Commit

Permalink
Fixed bug #63874 (Segfaul if php_strip_whitespace has heredoc)
Browse files Browse the repository at this point in the history
T_END_HEREDOC don't carry a token value anymore since commit 4cf90e0
Bugfix by Nikita for bug #60097
  • Loading branch information
adoy committed Dec 30, 2012
1 parent f8a9a47 commit 8228597
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions NEWS
Expand Up @@ -3,6 +3,7 @@ PHP NEWS
?? ??? 201?, PHP 5.5.0 Alpha 3

- General improvements:
. Fixed bug #63874 (Segfault if php_strip_whitespace has heredoc). (Pierrick)
. Fixed bug #63822 (Crash when using closures with ArrayAccess).
(Nikita Popov)
. Add Generator::throw() method. (Nikita Popov)
Expand Down
1 change: 0 additions & 1 deletion Zend/zend_highlight.c
Expand Up @@ -186,7 +186,6 @@ ZEND_API void zend_strip(TSRMLS_D)

case T_END_HEREDOC:
zend_write((char*)LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
efree(token.value.str.val);
/* read the following character, either newline or ; */
if (lex_scan(&token TSRMLS_CC) != T_WHITESPACE) {
zend_write((char*)LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
Expand Down
16 changes: 16 additions & 0 deletions ext/standard/tests/strings/bug63874.phpt
@@ -0,0 +1,16 @@
--TEST--
Bug #63874 (Segfault if php_strip_whitespace has heredoc)
--FILE--
<?php
echo php_strip_whitespace(__FILE__);

return <<<A
a
A;
?>
--EXPECT--
<?php
echo php_strip_whitespace(__FILE__); return <<<A
a
A;
?>

0 comments on commit 8228597

Please sign in to comment.