diff options
author | Bob Weinand <bobwei9@hotmail.com> | 2016-10-12 20:19:10 +0200 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2016-10-14 01:48:03 +0200 |
commit | 11e7447e044fe0b719e38246babbed6e8d56ebf3 (patch) | |
tree | 6ad99f8b4c4c81713c46c48a4ffaf4de0e66e22e /sapi/phpdbg/phpdbg_list.c | |
parent | a8a11b669d86ee276e0942a5a9d5aa504cf49fd3 (diff) | |
download | php-git-11e7447e044fe0b719e38246babbed6e8d56ebf3.tar.gz |
Merge branch 'PHP-7.0' into PHP-7.1
(cherry picked from commit 37ae5f3931b60c55e5004b6da912c4a957bca274)
Diffstat (limited to 'sapi/phpdbg/phpdbg_list.c')
-rw-r--r-- | sapi/phpdbg/phpdbg_list.c | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/sapi/phpdbg/phpdbg_list.c b/sapi/phpdbg/phpdbg_list.c index 86a2132b74..4d5e7dd8f8 100644 --- a/sapi/phpdbg/phpdbg_list.c +++ b/sapi/phpdbg/phpdbg_list.c @@ -62,9 +62,15 @@ PHPDBG_LIST(lines) /* {{{ */ } break; case FILE_PARAM: { - zend_string *file = zend_string_init(param->file.name, strlen(param->file.name), 0); + zend_string *file; + char resolved_path_buf[MAXPATHLEN]; + const char *abspath = param->file.name; + if (VCWD_REALPATH(abspath, resolved_path_buf)) { + abspath = resolved_path_buf; + } + file = zend_string_init(abspath, strlen(abspath), 0); phpdbg_list_file(file, param->file.line, 0, 0); - efree(file); + zend_string_release(file); } break; phpdbg_default_switch_case(); @@ -127,16 +133,8 @@ void phpdbg_list_file(zend_string *filename, uint count, int offset, uint highli { uint line, lastline; phpdbg_file_source *data; - char resolved_path_buf[MAXPATHLEN]; - const char *abspath; - - if (VCWD_REALPATH(ZSTR_VAL(filename), resolved_path_buf)) { - abspath = resolved_path_buf; - } else { - abspath = ZSTR_VAL(filename); - } - if (!(data = zend_hash_str_find_ptr(&PHPDBG_G(file_sources), abspath, strlen(abspath)))) { + if (!(data = zend_hash_find_ptr(&PHPDBG_G(file_sources), filename))) { phpdbg_error("list", "type=\"unknownfile\"", "Could not find information about included file..."); return; } @@ -288,6 +286,7 @@ zend_op_array *phpdbg_compile_file(zend_file_handle *file, int type) { return NULL; } + dataptr->filename = estrdup(dataptr->filename); dataptr = erealloc(dataptr, sizeof(phpdbg_file_source) + sizeof(uint) * line); zend_hash_str_add_ptr(&PHPDBG_G(file_sources), filename, strlen(filename), dataptr); phpdbg_resolve_pending_file_break(filename); @@ -306,6 +305,17 @@ zend_op_array *phpdbg_init_compile_file(zend_file_handle *file, int type) { if (VCWD_REALPATH(filename, resolved_path_buf)) { filename = resolved_path_buf; + + if (file->opened_path) { + zend_string_release(file->opened_path); + file->opened_path = zend_string_init(filename, strlen(filename), 0); + } else { + if (file->free_filename) { + efree((char *) file->filename); + } + file->free_filename = 1; + file->filename = estrdup(filename); + } } op_array = PHPDBG_G(init_compile_file)(file, type); @@ -356,7 +366,7 @@ zend_op_array *phpdbg_compile_string(zval *source_string, char *filename) { return NULL; } - fake_name = strpprintf(0, "%s\0%p", filename, op_array->opcodes); + fake_name = strpprintf(0, "%s%c%p", filename, 0, op_array->opcodes); dataptr = erealloc(dataptr, sizeof(phpdbg_file_source) + sizeof(uint) * line); zend_hash_add_ptr(&PHPDBG_G(file_sources), fake_name, dataptr); |