Hi:
this bug is similar to #49000, and the fix is a little ugly, in this
case, setting CG(interactive) in sapi/cli/php_cli.c becomes
unnecessary.
thanks
On Thu, Jul 26, 2012 at 12:40 PM, Xinchen Hui larue...@php.net wrote:
Commit:b4b3a65f5518803c4a3bca34ac67e139b2547133
Author:Xinchen Hui larue...@php.net Thu, 26 Jul 2012 12:40:47
+0800
Parents: 9fe8c58130ac82d2b52b35a290b71569abe50d18
Branches: PHP-5.4
Link:
http://git.php.net/?p=php-src.git;a=commitdiff;h=b4b3a65f5518803c4a3bca34ac67e139b2547133
Log:
Fixed bug #62661 (Interactive php-cli crashes if include() is used in
auto_prepend_file)
Bugs:
https://bugs.php.net/62661
Changed paths:
M NEWS
M Zend/zend.c
Diff:
diff --git a/NEWS b/NEWS
index 883d910..d429849 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,8 @@ PHP
NEWS
?? ??? 2012, PHP 5.4.6
- Core:
+ . Fixed bug #62661 (Interactive php-cli crashes if include() is used in
+auto_prepend_file). (Laruence)
. Fixed bug #62565 (Crashes due non-initialized internal properties_table).
(Felipe)
diff --git a/Zend/zend.c b/Zend/zend.c
index 37a1a27..18c4f11 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -1261,6 +1261,7 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC,
zval **retval, int file_co
zend_file_handle *file_handle;
zend_op_array *orig_op_array = EG(active_op_array);
zval **orig_retval_ptr_ptr = EG(return_value_ptr_ptr);
+long orig_interactive = CG(interactive);
va_start(files, file_count);
for (i = 0; i file_count; i++) {
@@ -1268,6 +1269,15 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC,
zval **retval, int file_co
if (!file_handle) {
continue;
}
+
+if (orig_interactive) {
+if (file_handle-filename[0] != '-' || file_handle-filename[1])
{
+CG(interactive) = 0;
+} else {
+CG(interactive) = 1;
+}
+}
+
EG(active_op_array) = zend_compile_file(file_handle, type
TSRMLS_CC);
if (file_handle-opened_path) {
int dummy = 1;
@@ -1309,12 +1319,14 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC,
zval **retval, int file_co
va_end(files);
EG(active_op_array) = orig_op_array;
EG(return_value_ptr_ptr) = orig_retval_ptr_ptr;
+CG(interactive) = orig_interactive;
return FAILURE;
}
}
va_end(files);
EG(active_op_array) = orig_op_array;
EG(return_value_ptr_ptr) = orig_retval_ptr_ptr;
+CG(interactive) = orig_interactive;
return SUCCESS;
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
Laruence Xinchen Hui
http://www.laruence.com/
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php