Skip to content

Commit b4b3a65

Browse files
committed
Fixed bug #62661 (Interactive php-cli crashes if include() is used in auto_prepend_file)
1 parent 9fe8c58 commit b4b3a65

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ PHP NEWS
33
?? ??? 2012, PHP 5.4.6
44

55
- Core:
6+
. Fixed bug #62661 (Interactive php-cli crashes if include() is used in
7+
auto_prepend_file). (Laruence)
68
. Fixed bug #62565 (Crashes due non-initialized internal properties_table).
79
(Felipe)
810

Zend/zend.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,13 +1261,23 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_co
12611261
zend_file_handle *file_handle;
12621262
zend_op_array *orig_op_array = EG(active_op_array);
12631263
zval **orig_retval_ptr_ptr = EG(return_value_ptr_ptr);
1264+
long orig_interactive = CG(interactive);
12641265

12651266
va_start(files, file_count);
12661267
for (i = 0; i < file_count; i++) {
12671268
file_handle = va_arg(files, zend_file_handle *);
12681269
if (!file_handle) {
12691270
continue;
12701271
}
1272+
1273+
if (orig_interactive) {
1274+
if (file_handle->filename[0] != '-' || file_handle->filename[1]) {
1275+
CG(interactive) = 0;
1276+
} else {
1277+
CG(interactive) = 1;
1278+
}
1279+
}
1280+
12711281
EG(active_op_array) = zend_compile_file(file_handle, type TSRMLS_CC);
12721282
if (file_handle->opened_path) {
12731283
int dummy = 1;
@@ -1309,12 +1319,14 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_co
13091319
va_end(files);
13101320
EG(active_op_array) = orig_op_array;
13111321
EG(return_value_ptr_ptr) = orig_retval_ptr_ptr;
1322+
CG(interactive) = orig_interactive;
13121323
return FAILURE;
13131324
}
13141325
}
13151326
va_end(files);
13161327
EG(active_op_array) = orig_op_array;
13171328
EG(return_value_ptr_ptr) = orig_retval_ptr_ptr;
1329+
CG(interactive) = orig_interactive;
13181330

13191331
return SUCCESS;
13201332
}

0 commit comments

Comments
 (0)