From 6499162ff0d8aa6e862d3e3cdd2288b87636b8a1 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Thu, 28 Apr 2016 04:13:34 +0300 Subject: - get rid of EG(scope). zend_get_executed_scope() should be used instead. - ichanged zval_update_constant_ex(). Use IS_TYPE_IMMUTABLE flag on shared constants and AST, instead of "inline_change" parameter. --- sapi/phpdbg/phpdbg_list.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'sapi/phpdbg/phpdbg_list.c') diff --git a/sapi/phpdbg/phpdbg_list.c b/sapi/phpdbg/phpdbg_list.c index e9cf1bc0b8..2e97ad4b73 100644 --- a/sapi/phpdbg/phpdbg_list.c +++ b/sapi/phpdbg/phpdbg_list.c @@ -200,11 +200,12 @@ void phpdbg_list_function_byname(const char *str, size_t len) /* {{{ */ /* search active scope if begins with period */ if (func_name[0] == '.') { - if (EG(scope)) { + zend_class_entry *scope = zend_get_executed_scope(); + if (scope) { func_name++; func_name_len--; - func_table = &EG(scope)->function_table; + func_table = &scope->function_table; } else { phpdbg_error("inactive", "type=\"noclasses\"", "No active class"); return; -- cgit v1.2.1 From 0f20e113c2fd9c5e96beb2723ba8b5c8eb43b182 Mon Sep 17 00:00:00 2001 From: Bob Weinand Date: Tue, 3 May 2016 13:36:21 +0200 Subject: Fix potential double free with phpdbg --- sapi/phpdbg/phpdbg_list.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sapi/phpdbg/phpdbg_list.c') diff --git a/sapi/phpdbg/phpdbg_list.c b/sapi/phpdbg/phpdbg_list.c index 2e97ad4b73..e31fe199f2 100644 --- a/sapi/phpdbg/phpdbg_list.c +++ b/sapi/phpdbg/phpdbg_list.c @@ -291,6 +291,7 @@ 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; } -- cgit v1.2.1 From d33e71b3589b0ce7218dd1dd770edd0a4bd3264f Mon Sep 17 00:00:00 2001 From: Bob Weinand Date: Sat, 7 May 2016 14:45:29 +0200 Subject: Fix include_once in phpdbg --- sapi/phpdbg/phpdbg_list.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'sapi/phpdbg/phpdbg_list.c') diff --git a/sapi/phpdbg/phpdbg_list.c b/sapi/phpdbg/phpdbg_list.c index e31fe199f2..ca73209114 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; } -- cgit v1.2.1