summaryrefslogtreecommitdiff
path: root/sapi/phpdbg/phpdbg_list.c
diff options
context:
space:
mode:
authorBob Weinand <bobwei9@hotmail.com>2016-05-03 13:36:21 +0200
committerBob Weinand <bobwei9@hotmail.com>2016-05-30 13:31:17 +0200
commit67468fb4176cc8ff43a1dc321c5903f17af88d39 (patch)
treea20100baf813d4eb655df69e44418a6e03f247cd /sapi/phpdbg/phpdbg_list.c
parent933d6b188c62bea6e10e67bea97ac23f51f6ecce (diff)
downloadphp-git-67468fb4176cc8ff43a1dc321c5903f17af88d39.tar.gz
Fixed bug #72284 (phpdbg fatal errors with coverage)
Cherry-pick of original commits d3371b and 0f20e11 only present in master
Diffstat (limited to 'sapi/phpdbg/phpdbg_list.c')
-rw-r--r--sapi/phpdbg/phpdbg_list.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sapi/phpdbg/phpdbg_list.c b/sapi/phpdbg/phpdbg_list.c
index e9cf1bc0b8..6895bea43e 100644
--- a/sapi/phpdbg/phpdbg_list.c
+++ b/sapi/phpdbg/phpdbg_list.c
@@ -232,6 +232,7 @@ void phpdbg_list_function_byname(const char *str, size_t len) /* {{{ */
efree(func_name);
} /* }}} */
+/* Note: do not free the original file handler, let original compile_file() or caller do that. Caller may rely on its value to check success */
zend_op_array *phpdbg_compile_file(zend_file_handle *file, int type) {
phpdbg_file_source data, *dataptr;
zend_file_handle fake;
@@ -242,8 +243,7 @@ zend_op_array *phpdbg_compile_file(zend_file_handle *file, int type) {
char resolved_path_buf[MAXPATHLEN];
if (zend_stream_fixup(file, &bufptr, &data.len) == FAILURE) {
- zend_file_handle_dtor(file);
- return NULL;
+ return PHPDBG_G(compile_file)(file, type);
}
data.buf = emalloc(data.len + ZEND_MMAP_AHEAD + 1);
@@ -280,6 +280,10 @@ zend_op_array *phpdbg_compile_file(zend_file_handle *file, int type) {
if (ret == NULL) {
efree(data.buf);
efree(dataptr);
+
+ fake.opened_path = NULL;
+ zend_file_handle_dtor(&fake);
+
return NULL;
}
@@ -289,7 +293,6 @@ zend_op_array *phpdbg_compile_file(zend_file_handle *file, int type) {
fake.opened_path = NULL;
zend_file_handle_dtor(&fake);
- zend_file_handle_dtor(file);
return ret;
}