com php-src: Fix include_once in phpdbg: sapi/phpdbg/ phpdbg_list.c
| From: | Bob Weinand | Date: | Sat, 07 May 2016 12:45:41 +0000 |
| Subject: | com php-src: Fix include_once in phpdbg: sapi/phpdbg/ phpdbg_list.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-92063@lists.php.net to get a copy of this message | ||
Commit: d33e71b3589b0ce7218dd1dd770edd0a4bd3264f
Author: Bob Weinand <bobwei9@hotmail.com> Sat, 7 May 2016 14:45:29 +0200
Parents: 455eabcd2cef5eb5410b863b703655b6e22c55a9
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d33e71b3589b0ce7218dd1dd770edd0a4bd3264f
Log:
Fix include_once in phpdbg
Changed paths:
M sapi/phpdbg/phpdbg_list.c
Diff:
diff --git a/sapi/phpdbg/phpdbg_list.c b/sapi/phpdbg/phpdbg_list.c
index e31fe19..ca73209 100644
--- a/sapi/phpdbg/phpdbg_list.c
+++ b/sapi/phpdbg/phpdbg_list.c
@@ -233,6 +233,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;
@@ -243,8 +244,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);
@@ -281,6 +281,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;
}
@@ -290,8 +294,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);
- file->type = -1;
return ret;
}