diff options
author | Bob Weinand <bobwei9@hotmail.com> | 2015-07-31 02:05:49 +0200 |
---|---|---|
committer | Bob Weinand <bobwei9@hotmail.com> | 2015-07-31 02:06:03 +0200 |
commit | 1da4ee25b89a668d55064f6cbfd62fcf1c9d00ef (patch) | |
tree | 328a37f388101805ccc8da6f037c19bb2dfbec85 | |
parent | 57247f01f74acf55cbe6fb2ee2c117d6db3848db (diff) | |
download | php-git-1da4ee25b89a668d55064f6cbfd62fcf1c9d00ef.tar.gz |
Fix oplog trace with already freed closures
-rw-r--r-- | sapi/phpdbg/phpdbg.c | 15 | ||||
-rw-r--r-- | sapi/phpdbg/phpdbg_list.c | 1 | ||||
-rw-r--r-- | sapi/phpdbg/phpdbg_opcode.c | 8 | ||||
-rw-r--r-- | sapi/phpdbg/phpdbg_opcode.h | 5 |
4 files changed, 19 insertions, 10 deletions
diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c index 51e6899e4e..874704bc63 100644 --- a/sapi/phpdbg/phpdbg.c +++ b/sapi/phpdbg/phpdbg.c @@ -615,25 +615,24 @@ static PHP_FUNCTION(phpdbg_end_oplog) zend_long insert_idx; do { - zend_op_array *op_array = cur->op_array; zval zero; ZVAL_LONG(&zero, 0); - if (op_array->filename != last_file) { - last_file = op_array->filename; + if (cur->filename != last_file) { + last_file = cur->filename; file_ht = insert_ht = phpdbg_add_empty_array(Z_ARR_P(return_value), last_file); } if (by_function) { - if (op_array->function_name == NULL) { + if (cur->function_name == NULL) { if (last_function != NULL) { insert_ht = file_ht; } last_function = NULL; - } else if (op_array->function_name != last_function || op_array->scope != last_scope) { + } else if (cur->function_name != last_function || cur->scope != last_scope) { zend_string *fn_name; - last_function = op_array->function_name; - last_scope = op_array->scope; + last_function = cur->function_name; + last_scope = cur->scope; if (last_scope == NULL) { fn_name = zend_string_copy(last_function); } else { @@ -645,7 +644,7 @@ static PHP_FUNCTION(phpdbg_end_oplog) } if (by_opcode) { - insert_idx = cur->op - op_array->opcodes; + insert_idx = cur->op - cur->opcodes; } else { insert_idx = cur->op->lineno; } diff --git a/sapi/phpdbg/phpdbg_list.c b/sapi/phpdbg/phpdbg_list.c index 89e352a971..7413ded884 100644 --- a/sapi/phpdbg/phpdbg_list.c +++ b/sapi/phpdbg/phpdbg_list.c @@ -320,6 +320,7 @@ zend_op_array *phpdbg_init_compile_file(zend_file_handle *file, int type) { *dataptr->op_array->refcount = 2; dataptr->destroy_op_array = 0; } + ++*dataptr->op_array->refcount; } return ret; diff --git a/sapi/phpdbg/phpdbg_opcode.c b/sapi/phpdbg/phpdbg_opcode.c index 092fcb985c..8b6c964343 100644 --- a/sapi/phpdbg/phpdbg_opcode.c +++ b/sapi/phpdbg/phpdbg_opcode.c @@ -202,11 +202,17 @@ void phpdbg_print_opline_ex(zend_execute_data *execute_data, zend_bool ignore_fl if (PHPDBG_G(oplog_list)) { phpdbg_oplog_entry *cur = zend_arena_alloc(&PHPDBG_G(oplog_arena), sizeof(phpdbg_oplog_entry)); + zend_op_array *op_array = &execute_data->func->op_array; cur->op = (zend_op *) execute_data->opline; - cur->op_array = &execute_data->func->op_array; + cur->opcodes = op_array->opcodes; + cur->filename = op_array->filename; + cur->scope = op_array->scope; + cur->function_name = op_array->function_name; cur->next = NULL; PHPDBG_G(oplog_cur)->next = cur; PHPDBG_G(oplog_cur) = cur; +if (!execute_data->func->op_array.filename) +printf("ALETR"); } } /* }}} */ diff --git a/sapi/phpdbg/phpdbg_opcode.h b/sapi/phpdbg/phpdbg_opcode.h index 34c9c37e50..10d8be3f42 100644 --- a/sapi/phpdbg/phpdbg_opcode.h +++ b/sapi/phpdbg/phpdbg_opcode.h @@ -30,7 +30,10 @@ void phpdbg_print_opline_ex(zend_execute_data *execute_data, zend_bool ignore_fl typedef struct _phpdbg_oplog_entry phpdbg_oplog_entry; struct _phpdbg_oplog_entry { phpdbg_oplog_entry *next; - zend_op_array *op_array; + zend_string *function_name; + zend_class_entry *scope; + zend_string *filename; + zend_op *opcodes; zend_op *op; }; |