Commit:    8228597ecce3ad868d2c6bfca5ff43f29e014296
Author:    Pierrick Charron <pierr...@php.net>         Sat, 29 Dec 2012 
23:11:37 -0500
Parents:   f8a9a47e8cde62a082a54371c08eedb4c1366b77
Branches:  PHP-5.5 master

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=8228597ecce3ad868d2c6bfca5ff43f29e014296

Log:
Fixed bug #63874 (Segfaul if php_strip_whitespace has heredoc)

T_END_HEREDOC don't carry a token value anymore since commit 4cf90e06c
Bugfix by Nikita for bug #60097

Bugs:
https://bugs.php.net/63874
https://bugs.php.net/60097

Changed paths:
  M  NEWS
  M  Zend/zend_highlight.c
  A  ext/standard/tests/strings/bug63874.phpt


Diff:
diff --git a/NEWS b/NEWS
index b67276a..2d0b4c3 100644
--- 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)
diff --git a/Zend/zend_highlight.c b/Zend/zend_highlight.c
index 938e1c6..7fe6174 100644
--- a/Zend/zend_highlight.c
+++ b/Zend/zend_highlight.c
@@ -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
index 0000000..066cc15
--- /dev/null
+++ b/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;
+?>


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to