]> granicus.if.org Git - php/commitdiff
Fixed bug #63874 (Segfaul if php_strip_whitespace has heredoc)
authorPierrick Charron <pierrick@php.net>
Sun, 30 Dec 2012 04:11:37 +0000 (23:11 -0500)
committerPierrick Charron <pierrick@php.net>
Sun, 30 Dec 2012 04:11:37 +0000 (23:11 -0500)
T_END_HEREDOC don't carry a token value anymore since commit 4cf90e06c
Bugfix by Nikita for bug #60097

NEWS
Zend/zend_highlight.c
ext/standard/tests/strings/bug63874.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index b67276aa80be660df75f3bb26bb8f81183b64cfc..2d0b4c3d027a3b9f266de99648d7aced351f63d2 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -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)
index 938e1c612b91218f24f5f1a8b9b3a2400fa801c5..7fe617451940e91a59d789b079aea2c0b44d4aa4 100644 (file)
@@ -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));
diff --git a/ext/standard/tests/strings/bug63874.phpt b/ext/standard/tests/strings/bug63874.phpt
new file mode 100644 (file)
index 0000000..066cc15
--- /dev/null
@@ -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;
+?>