svn: /php/php-src/ branches/PHP_5_3/Zend/zend_language_scanner.l branches/PHP_5_3/tests/lang/019.phpt branches/PHP_5_4/Zend/zend_language_scanner.l
branches/PHP_5_4/tests/lang/019.phpt trunk/Zend/zend_language_scanner.l trunk/tests/lang/019.phpt
| From: | Nuno Lopes | Date: | Sun, 01 Jan 2012 22:45:58 +0000 |
| Subject: | svn: /php/php-src/ branches/PHP_5_3/Zend/zend_language_scanner.l branches/PHP_5_3/tests/lang/019.phpt branches/PHP_5_4/Zend/zend_language_scanner.l branches/PHP_5_4/tests/lang/019.phpt trunk/Zend/zend_language_scanner.l trunk/tests/lang/019.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-67383@lists.php.net to get a copy of this message | ||
nlopess Sun, 01 Jan 2012 22:45:58 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=321655
Log:
fix memory leak in compile_string when there's a parse error (used e.g. in eval or assert)
Changed paths:
U php/php-src/branches/PHP_5_3/Zend/zend_language_scanner.l
U php/php-src/branches/PHP_5_3/tests/lang/019.phpt
U php/php-src/branches/PHP_5_4/Zend/zend_language_scanner.l
U php/php-src/branches/PHP_5_4/tests/lang/019.phpt
U php/php-src/trunk/Zend/zend_language_scanner.l
U php/php-src/trunk/tests/lang/019.phpt
Modified: php/php-src/branches/PHP_5_3/Zend/zend_language_scanner.l
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/zend_language_scanner.l 2012-01-01 22:26:43 UTC (rev 321654)
+++ php/php-src/branches/PHP_5_3/Zend/zend_language_scanner.l 2012-01-01 22:45:58 UTC (rev 321655)
@@ -536,6 +536,8 @@
if (compiler_result==1) {
CG(active_op_array) = original_active_op_array;
CG(unclean_shutdown)=1;
+ destroy_op_array(op_array TSRMLS_CC);
+ efree(op_array);
retval = NULL;
} else {
zend_do_return(NULL, 0 TSRMLS_CC);
Modified: php/php-src/branches/PHP_5_3/tests/lang/019.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/tests/lang/019.phpt 2012-01-01 22:26:43 UTC (rev 321654)
+++ php/php-src/branches/PHP_5_3/tests/lang/019.phpt 2012-01-01 22:45:58 UTC (rev 321655)
@@ -3,8 +3,6 @@
--FILE--
<?php
-error_reporting(0);
-
eval("function test() { echo \"hey, this is a function inside an eval()!\\n\";
}");
$i=0;
@@ -13,7 +11,9 @@
test();
$i++;
}
---EXPECT--
+
+eval('-');
+--EXPECTF--
hey, this is a regular echo'd eval()
hey, this is a function inside an eval()!
hey, this is a regular echo'd eval()
@@ -34,3 +34,5 @@
hey, this is a function inside an eval()!
hey, this is a regular echo'd eval()
hey, this is a function inside an eval()!
+
+Parse error: syntax error, unexpected end of file in %s019.php(12) : eval()'d code on line 1
Modified: php/php-src/branches/PHP_5_4/Zend/zend_language_scanner.l
===================================================================
--- php/php-src/branches/PHP_5_4/Zend/zend_language_scanner.l 2012-01-01 22:26:43 UTC (rev 321654)
+++ php/php-src/branches/PHP_5_4/Zend/zend_language_scanner.l 2012-01-01 22:45:58 UTC (rev 321655)
@@ -756,6 +756,8 @@
if (compiler_result==1) {
CG(active_op_array) = original_active_op_array;
CG(unclean_shutdown)=1;
+ destroy_op_array(op_array TSRMLS_CC);
+ efree(op_array);
retval = NULL;
} else {
zend_do_return(NULL, 0 TSRMLS_CC);
Modified: php/php-src/branches/PHP_5_4/tests/lang/019.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/tests/lang/019.phpt 2012-01-01 22:26:43 UTC (rev 321654)
+++ php/php-src/branches/PHP_5_4/tests/lang/019.phpt 2012-01-01 22:45:58 UTC (rev 321655)
@@ -3,8 +3,6 @@
--FILE--
<?php
-error_reporting(0);
-
eval("function test() { echo \"hey, this is a function inside an eval()!\\n\";
}");
$i=0;
@@ -13,7 +11,9 @@
test();
$i++;
}
---EXPECT--
+
+eval('-');
+--EXPECTF--
hey, this is a regular echo'd eval()
hey, this is a function inside an eval()!
hey, this is a regular echo'd eval()
@@ -34,3 +34,5 @@
hey, this is a function inside an eval()!
hey, this is a regular echo'd eval()
hey, this is a function inside an eval()!
+
+Parse error: syntax error, unexpected end of file in %s019.php(12) : eval()'d code on line 1
Modified: php/php-src/trunk/Zend/zend_language_scanner.l
===================================================================
--- php/php-src/trunk/Zend/zend_language_scanner.l 2012-01-01 22:26:43 UTC (rev 321654)
+++ php/php-src/trunk/Zend/zend_language_scanner.l 2012-01-01 22:45:58 UTC (rev 321655)
@@ -756,6 +756,8 @@
if (compiler_result==1) {
CG(active_op_array) = original_active_op_array;
CG(unclean_shutdown)=1;
+ destroy_op_array(op_array TSRMLS_CC);
+ efree(op_array);
retval = NULL;
} else {
zend_do_return(NULL, 0 TSRMLS_CC);
Modified: php/php-src/trunk/tests/lang/019.phpt
===================================================================
--- php/php-src/trunk/tests/lang/019.phpt 2012-01-01 22:26:43 UTC (rev 321654)
+++ php/php-src/trunk/tests/lang/019.phpt 2012-01-01 22:45:58 UTC (rev 321655)
@@ -3,8 +3,6 @@
--FILE--
<?php
-error_reporting(0);
-
eval("function test() { echo \"hey, this is a function inside an eval()!\\n\";
}");
$i=0;
@@ -13,7 +11,9 @@
test();
$i++;
}
---EXPECT--
+
+eval('-');
+--EXPECTF--
hey, this is a regular echo'd eval()
hey, this is a function inside an eval()!
hey, this is a regular echo'd eval()
@@ -34,3 +34,5 @@
hey, this is a function inside an eval()!
hey, this is a regular echo'd eval()
hey, this is a function inside an eval()!
+
+Parse error: syntax error, unexpected end of file in %s019.php(12) : eval()'d code on line 1