com php-src: Merge remote-tracking branch 'origin/PHP-5.6': sapi/phpdbg/phpdbg.c sapi/phpdbg/phpdbg_frame.c sapi/phpd bg/phpdbg_list.c
sapi/phpdbg/phpdbg_prompt.c sapi/p hpdbg/phpdbg_utils.h

From: Date: Sat, 25 Oct 2014 17:09:19 +0000
Subject: com php-src: Merge remote-tracking branch 'origin/PHP-5.6': sapi/phpdbg/phpdbg.c sapi/phpdbg/phpdbg_frame.c sapi/phpd bg/phpdbg_list.c
sapi/phpdbg/phpdbg_prompt.c sapi/p hpdbg/phpdbg_utils.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-82665@lists.php.net to get a copy of this message
Commit: 044f37a832ec1f72c960b02dc7a5b9aca3f43f67 Author: Bob Weinand <bobwei9@hotmail.com> Sat, 25 Oct 2014 19:09:19 +0200 Parents: 87c28ccd28121070ba7225f0ad73b9246dcfdc49 24babb01946ccb63b993b98b161455475a697d42 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=044f37a832ec1f72c960b02dc7a5b9aca3f43f67 Log: Merge remote-tracking branch 'origin/PHP-5.6' Conflicts: sapi/phpdbg/phpdbg.c sapi/phpdbg/phpdbg_list.c Changed paths: MM sapi/phpdbg/phpdbg.c MM sapi/phpdbg/phpdbg_frame.c MM sapi/phpdbg/phpdbg_list.c MM sapi/phpdbg/phpdbg_prompt.c MM sapi/phpdbg/phpdbg_utils.h Diff: diff --cc sapi/phpdbg/phpdbg.c index d70e512,aaf1e5f..3de0cc4 --- a/sapi/phpdbg/phpdbg.c +++ b/sapi/phpdbg/phpdbg.c @@@ -469,13 -476,8 +469,11 @@@ static void php_sapi_phpdbg_log_message case E_COMPILE_ERROR: case E_USER_ERROR: case E_PARSE: -- case E_RECOVERABLE_ERROR: - if (!(PHPDBG_G(flags) & PHPDBG_IN_EVAL)) { - const char *file_char = zend_get_executed_filename(TSRMLS_C); - zend_string *file = zend_string_init(file_char, strlen(file_char), 0); - phpdbg_list_file(file, 3, zend_get_executed_lineno(TSRMLS_C) - 1, zend_get_executed_lineno(TSRMLS_C) TSRMLS_CC); - efree(file); - } - phpdbg_list_file(zend_get_executed_filename(TSRMLS_C), 3, zend_get_executed_lineno(TSRMLS_C)-1, zend_get_executed_lineno(TSRMLS_C) TSRMLS_CC); ++ case E_RECOVERABLE_ERROR: { ++ const char *file_char = zend_get_executed_filename(TSRMLS_C); ++ zend_string *file = zend_string_init(file_char, strlen(file_char), 0); ++ phpdbg_list_file(file, 3, zend_get_executed_lineno(TSRMLS_C) - 1, zend_get_executed_lineno(TSRMLS_C) TSRMLS_CC); ++ efree(file); do { switch (phpdbg_interactive(1 TSRMLS_CC)) { @@@ -486,6 -488,6 +484,7 @@@ return; } } while (!(PHPDBG_G(flags) & PHPDBG_IS_QUITTING)); ++ } } } else fprintf(stdout, "%s\n", message); diff --cc sapi/phpdbg/phpdbg_frame.c index 4429a7f,437e6d4..08a6bec --- a/sapi/phpdbg/phpdbg_frame.c +++ b/sapi/phpdbg/phpdbg_frame.c @@@ -168,14 -192,19 +169,18 @@@ static void phpdbg_dump_prototype(zval void phpdbg_dump_backtrace(size_t num TSRMLS_DC) /* {{{ */ { - zval zbacktrace; - zval **tmp; - zval **file, **line; HashPosition position; + zval zbacktrace; + zval *tmp; + zval *file, *line; int i = 0, limit = num; - int user_defined; + PHPDBG_OUTPUT_BACKUP(); + if (limit < 0) { phpdbg_error("backtrace", "type=\"minnum\"", "Invalid backtrace size %d", limit); + + PHPDBG_OUTPUT_BACKUP_RESTORE(); return; } diff --cc sapi/phpdbg/phpdbg_list.c index de03a36,7aa8c4f..dd3db35 --- a/sapi/phpdbg/phpdbg_list.c +++ b/sapi/phpdbg/phpdbg_list.c @@@ -122,12 -124,17 +122,20 @@@ PHPDBG_LIST(class) /* {{{ * return SUCCESS; } /* }}} */ -void phpdbg_list_file(const char *filename, uint count, int offset, uint highlight TSRMLS_DC) /* {{{ */ +void phpdbg_list_file(zend_string *filename, uint count, int offset, uint highlight TSRMLS_DC) /* {{{ */ { uint line, lastline; - phpdbg_file_source **data; + phpdbg_file_source *data; + char resolved_path_buf[MAXPATHLEN]; ++ const char *abspath; - if (!(data = zend_hash_find_ptr(&PHPDBG_G(file_sources), filename))) { - if (VCWD_REALPATH(filename, resolved_path_buf)) { - filename = resolved_path_buf; ++ if (VCWD_REALPATH(filename->val, resolved_path_buf)) { ++ abspath = resolved_path_buf; ++ } else { ++ abspath = filename->val; + } + - if (zend_hash_find(&PHPDBG_G(file_sources), filename, strlen(filename), (void **) &data) == FAILURE) { ++ if (!(data = zend_hash_str_find_ptr(&PHPDBG_G(file_sources), abspath, strlen(abspath)))) { phpdbg_error("list", "type=\"unknownfile\"", "Could not find information about included file..."); return; } @@@ -256,6 -264,10 +265,9 @@@ zend_op_array *phpdbg_compile_file(zend fake.opened_path = file->opened_path; *(dataptr = emalloc(sizeof(phpdbg_file_source) + sizeof(uint) * data.len)) = data; + if (VCWD_REALPATH(filename, resolved_path_buf)) { + filename = resolved_path_buf; + } - zend_hash_add(&PHPDBG_G(file_sources), filename, strlen(filename), &dataptr, sizeof(phpdbg_file_source *), NULL); for (line = 0, bufptr = data.buf - 1, endptr = data.buf + data.len; ++bufptr < endptr;) { if (*bufptr == '\n') { diff --cc sapi/phpdbg/phpdbg_prompt.c index 190907e,2e0c698..f1b1db1 --- a/sapi/phpdbg/phpdbg_prompt.c +++ b/sapi/phpdbg/phpdbg_prompt.c @@@ -645,9 -690,21 +646,16 @@@ PHPDBG_COMMAND(ev) /* {{{ * zend_bool stepping = ((PHPDBG_G(flags) & PHPDBG_IS_STEPPING) == PHPDBG_IS_STEPPING); zval retval; - zend_op **orig_opline = EG(opline_ptr); - zend_op_array *orig_op_array = EG(active_op_array); - zval **orig_retval_ptr = EG(return_value_ptr_ptr); - zend_execute_data *ex = EG(current_execute_data); - HashTable *original_active_symbol_table = EG(active_symbol_table); - zval *original_This = EG(This); ++ zend_execute_data *original_execute_data = EG(current_execute_data); + zend_class_entry *original_scope = EG(scope); - zend_class_entry *original_called_scope = EG(called_scope); - zend_vm_stack original_stack = EG(argument_stack); ++ zend_vm_stack original_stack = EG(vm_stack); ++ original_stack->top = EG(vm_stack_top); + + PHPDBG_OUTPUT_BACKUP(); + if (PHPDBG_G(flags) & PHPDBG_IN_SIGNAL_HANDLER) { phpdbg_try_access { - phpdbg_parse_variable(param->str, param->len, &EG(symbol_table), 0, phpdbg_output_ev_variable, 0 TSRMLS_CC); + phpdbg_parse_variable(param->str, param->len, &EG(symbol_table).ht, 0, phpdbg_output_ev_variable, 0 TSRMLS_CC); } phpdbg_catch_access { phpdbg_error("signalsegv", "", "Could not fetch data, invalid data source"); } phpdbg_end_try_access(); @@@ -670,8 -729,18 +680,14 @@@ zend_print_zval_r(&retval, 0 TSRMLS_CC); phpdbg_xml("</eval>"); phpdbg_out("\n"); - zval_dtor(&retval); + zval_ptr_dtor(&retval); } + } zend_catch { - EG(active_op_array) = orig_op_array; - EG(opline_ptr) = orig_opline; - EG(return_value_ptr_ptr) = orig_retval_ptr; - EG(current_execute_data) = ex; - EG(active_symbol_table) = original_active_symbol_table; - EG(This) = original_This; ++ EG(current_execute_data) = original_execute_data; + EG(scope) = original_scope; - EG(called_scope) = original_called_scope; - EG(argument_stack) = original_stack; ++ EG(vm_stack_top) = original_stack->top; ++ EG(vm_stack_end) = original_stack->end; ++ EG(vm_stack) = original_stack; } zend_end_try(); PHPDBG_G(flags) &= ~PHPDBG_IN_EVAL; diff --cc sapi/phpdbg/phpdbg_utils.h index 83dc8e9,9038aa7..feb5470 --- a/sapi/phpdbg/phpdbg_utils.h +++ b/sapi/phpdbg/phpdbg_utils.h @@@ -90,8 -110,31 +90,33 @@@ typedef int (*phpdbg_parse_var_with_arg PHPDBG_API int phpdbg_parse_variable(char *input, size_t len, HashTable *parent, size_t i, phpdbg_parse_var_func callback, zend_bool silent TSRMLS_DC); PHPDBG_API int phpdbg_parse_variable_with_arg(char *input, size_t len, HashTable *parent, size_t i, phpdbg_parse_var_with_arg_func callback, zend_bool silent, void *arg TSRMLS_DC); -PHPDBG_API void phpdbg_xml_var_dump(zval **zv TSRMLS_DC); +int phpdbg_is_auto_global(char *name, int len TSRMLS_DC); + +PHPDBG_API void phpdbg_xml_var_dump(zval *zv TSRMLS_DC); + #ifdef ZTS + #define PHPDBG_OUTPUT_BACKUP_DEFINES() \ + zend_output_globals *output_globals_ptr; \ + zend_output_globals original_output_globals; \ + output_globals_ptr = (zend_output_globals *) (*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(output_globals_id)]; + #else + #define PHPDBG_OUTPUT_BACKUP_DEFINES() \ + zend_output_globals *output_globals_ptr; \ + zend_output_globals original_output_globals; \ + output_globals_ptr = &output_globals; + #endif + + #define PHPDBG_OUTPUT_BACKUP_SWAP() \ + original_output_globals = *output_globals_ptr; \ + memset(output_globals_ptr, 0, sizeof(zend_output_globals)); \ + php_output_activate(TSRMLS_C); + + #define PHPDBG_OUTPUT_BACKUP() \ + PHPDBG_OUTPUT_BACKUP_DEFINES() \ + PHPDBG_OUTPUT_BACKUP_SWAP() + + #define PHPDBG_OUTPUT_BACKUP_RESTORE() \ + php_output_deactivate(TSRMLS_C); \ + *output_globals_ptr = original_output_globals; + #endif /* PHPDBG_UTILS_H */

« previous php.cvs (#82665) next »