diff --git a/php_xdebug.h b/php_xdebug.h index f00239f81..cb46f66ea 100644 --- a/php_xdebug.h +++ b/php_xdebug.h @@ -265,14 +265,7 @@ ZEND_BEGIN_MODULE_GLOBALS(xdebug) char *lasttransid; /* output redirection */ -#if PHP_VERSION_ID < 50400 - php_output_globals stdio; - int stdout_redirected; - int stderr_redirected; - int stdin_redirected; -#else int stdout_mode; -#endif /* aggregate profiling */ HashTable aggr_calls; diff --git a/xdebug.c b/xdebug.c index 2e8d69e8c..55a806936 100644 --- a/xdebug.c +++ b/xdebug.c @@ -77,9 +77,7 @@ void (*xdebug_new_error_cb)(int type, const char *error_filename, const uint err void xdebug_error_cb(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args); static int xdebug_header_handler(sapi_header_struct *h XG_SAPI_HEADER_OP_DC, sapi_headers_struct *s TSRMLS_DC); -#if PHP_VERSION_ID >= 50400 static int xdebug_ub_write(const char *string, unsigned int lenght TSRMLS_DC); -#endif static void xdebug_throw_exception_hook(zval *exception TSRMLS_DC); int xdebug_exit_handler(ZEND_OPCODE_HANDLER_ARGS); @@ -88,9 +86,7 @@ int zend_xdebug_initialised = 0; int zend_xdebug_global_offset = -1; int (*xdebug_orig_header_handler)(sapi_header_struct *h XG_SAPI_HEADER_OP_DC, sapi_headers_struct *s TSRMLS_DC); -#if PHP_VERSION_ID >= 50400 int (*xdebug_orig_ub_write)(const char *string, unsigned int len TSRMLS_DC); -#endif static int xdebug_trigger_enabled(int setting, char *var_name TSRMLS_DC); @@ -346,13 +342,11 @@ static void php_xdebug_init_globals (zend_xdebug_globals *xg TSRMLS_DC) } xg->headers = NULL; -#if PHP_VERSION_ID >= 50400 /* Capturing output */ if (sapi_module.ub_write != xdebug_ub_write) { xdebug_orig_ub_write = sapi_module.ub_write; sapi_module.ub_write = xdebug_ub_write; } -#endif } static void php_xdebug_shutdown_globals (zend_xdebug_globals *xg TSRMLS_DC) @@ -687,12 +681,11 @@ PHP_MINIT_FUNCTION(xdebug) xdebug_orig_header_handler = sapi_module.header_handler; sapi_module.header_handler = xdebug_header_handler; } -# if PHP_VERSION_ID >= 50400 + if (sapi_module.ub_write != xdebug_ub_write) { xdebug_orig_ub_write = sapi_module.ub_write; sapi_module.ub_write = xdebug_ub_write; } -# endif #endif return SUCCESS; @@ -792,7 +785,6 @@ static void xdebug_stack_element_dtor(void *dummy, void *elem) #define COOKIE_ENCODE #endif -#if PHP_VERSION_ID >= 50400 int xdebug_ub_write(const char *string, unsigned int length TSRMLS_DC) { TSRMLS_FETCH(); @@ -804,7 +796,6 @@ int xdebug_ub_write(const char *string, unsigned int length TSRMLS_DC) } return xdebug_orig_ub_write(string, length); } -#endif PHP_RINIT_FUNCTION(xdebug) { diff --git a/xdebug_handler_dbgp.c b/xdebug_handler_dbgp.c index 8de2aecfa..6c083d0a8 100644 --- a/xdebug_handler_dbgp.c +++ b/xdebug_handler_dbgp.c @@ -1339,43 +1339,6 @@ static int xdebug_send_stream(const char *name, const char *str, uint str_length return 0; } -#if PHP_VERSION_ID < 50400 -static int xdebug_header_write(const char *str, uint str_length TSRMLS_DC) -{ - /* nesting_level is zero when final output is sent to sapi */ - if (OG(ob_nesting_level) < 1) { - zend_unset_timeout(TSRMLS_C); - if (XG(stdout_redirected) != 0) { - xdebug_send_stream("stdout", str, str_length TSRMLS_CC); - } -#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 3) || PHP_MAJOR_VERSION >= 6 - zend_set_timeout(EG(timeout_seconds), 0); -#else - zend_set_timeout(EG(timeout_seconds)); -#endif - } - return XG(stdio).php_header_write(str, str_length TSRMLS_CC); -} - -static int xdebug_body_write(const char *str, uint str_length TSRMLS_DC) -{ - /* nesting_level is zero when final output is sent to sapi. We also dont - * want to write if headers are not sent yet, the output layer will handle - * this correctly later. */ - if (OG(ob_nesting_level) < 1 && SG(headers_sent)) { - zend_unset_timeout(TSRMLS_C); - if (XG(stdout_redirected) != 0) { - xdebug_send_stream("stdout", str, str_length TSRMLS_CC); - } -#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 3) || PHP_MAJOR_VERSION >= 6 - zend_set_timeout(EG(timeout_seconds), 0); -#else - zend_set_timeout(EG(timeout_seconds)); -#endif - } - return XG(stdio).php_body_write(str, str_length TSRMLS_CC); -} -#endif DBGP_FUNC(stderr) { @@ -1392,31 +1355,9 @@ DBGP_FUNC(stdout) } mode = strtol(CMD_OPTION('c'), NULL, 10); -#if PHP_VERSION_ID < 50400 - if (mode == 0 && XG(stdout_redirected) != 0) { - if (XG(stdio).php_body_write != NULL && OG(php_body_write)) { - OG(php_body_write) = XG(stdio).php_body_write; - OG(php_header_write) = XG(stdio).php_header_write; - - XG(stdio).php_body_write = NULL; - XG(stdio).php_header_write = NULL; - success = "1"; - } - } else if (mode != 0 && XG(stdout_redirected) == 0) { - if (XG(stdio).php_body_write == NULL && OG(php_body_write)) { - XG(stdio).php_body_write = OG(php_body_write); - OG(php_body_write) = xdebug_body_write; - XG(stdio).php_header_write = OG(php_header_write); - OG(php_header_write) = xdebug_header_write; - success = "1"; - } - } - - XG(stdout_redirected) = mode; -#else XG(stdout_mode) = mode; success = "1"; -#endif + xdebug_xml_add_attribute_ex(*retval, "success", xdstrdup(success), 0, 1); } @@ -1476,13 +1417,7 @@ DBGP_FUNC(detach) xdebug_xml_add_attribute(*retval, "reason", xdebug_dbgp_reason_strings[XG(reason)]); XG(context).handler->remote_deinit(&(XG(context))); XG(remote_enabled) = 0; -#if PHP_VERSION_ID < 50400 - XG(stdout_redirected) = 0; - XG(stderr_redirected) = 0; - XG(stdin_redirected) = 0; -#else XG(stdout_mode) = 0; -#endif } @@ -2444,14 +2379,6 @@ int xdebug_dbgp_init(xdebug_con *context, int mode) XG(lastcmd) = NULL; XG(lasttransid) = NULL; -#if PHP_VERSION_ID < 50400 - XG(stdout_redirected) = 0; - XG(stderr_redirected) = 0; - XG(stdin_redirected) = 0; - XG(stdio).php_body_write = NULL; - XG(stdio).php_header_write = NULL; -#endif - response = xdebug_xml_node_init("init"); xdebug_xml_add_attribute(response, "xmlns", "urn:debugger_protocol_v1"); xdebug_xml_add_attribute(response, "xmlns:xdebug", "http://xdebug.org/dbgp/xdebug"); @@ -2549,15 +2476,7 @@ int xdebug_dbgp_deinit(xdebug_con *context) xdebug_dbgp_cmdloop(context, 0 TSRMLS_CC); } -#if PHP_VERSION_ID < 50400 - if (XG(stdio).php_body_write != NULL && OG(php_body_write)) { - OG(php_body_write) = XG(stdio).php_body_write; - OG(php_header_write) = XG(stdio).php_header_write; - - XG(stdio).php_body_write = NULL; - XG(stdio).php_header_write = NULL; - } -#endif + if (XG(remote_enabled)) { options = (xdebug_var_export_options*) context->options; xdfree(options->runtime); @@ -2699,7 +2618,6 @@ int xdebug_dbgp_breakpoint(xdebug_con *context, xdebug_llist *stack, char *file, return 1; } -#if PHP_VERSION_ID >= 50400 int xdebug_dbgp_stream_output(const char *string, unsigned int length TSRMLS_DC) { if ((XG(stdout_mode) == 1 || XG(stdout_mode) == 2) && length) { @@ -2711,7 +2629,6 @@ int xdebug_dbgp_stream_output(const char *string, unsigned int length TSRMLS_DC) } return -1; } -#endif static char *create_eval_key_file(char *filename, int lineno) { diff --git a/xdebug_handler_dbgp.h b/xdebug_handler_dbgp.h index 281111905..644bddbd2 100644 --- a/xdebug_handler_dbgp.h +++ b/xdebug_handler_dbgp.h @@ -92,24 +92,10 @@ int xdebug_dbgp_init(xdebug_con *context, int mode); int xdebug_dbgp_deinit(xdebug_con *context); int xdebug_dbgp_error(xdebug_con *context, int type, char *exception_type, char *message, const char *location, const uint line, xdebug_llist *stack); int xdebug_dbgp_breakpoint(xdebug_con *context, xdebug_llist *stack, char *file, long lineno, int type, char *exception, char *message); -#if PHP_VERSION_ID >= 50400 int xdebug_dbgp_stream_output(const char *string, unsigned int length TSRMLS_DC); -#endif int xdebug_dbgp_register_eval_id(xdebug_con *context, function_stack_entry *fse); char *xdebug_dbgp_get_revision(void); -#if PHP_VERSION_ID < 50400 -#define xdebug_handler_dbgp { \ - xdebug_dbgp_init, \ - xdebug_dbgp_deinit, \ - xdebug_dbgp_error, \ - xdebug_dbgp_breakpoint, \ - xdebug_dbgp_register_eval_id, \ - xdebug_dbgp_get_revision \ -} -#endif - -#if PHP_VERSION_ID >= 50400 #define xdebug_handler_dbgp { \ xdebug_dbgp_init, \ xdebug_dbgp_deinit, \ @@ -119,7 +105,6 @@ char *xdebug_dbgp_get_revision(void); xdebug_dbgp_register_eval_id, \ xdebug_dbgp_get_revision \ } -#endif #endif diff --git a/xdebug_handlers.h b/xdebug_handlers.h index e8b9bf453..6f13454cc 100644 --- a/xdebug_handlers.h +++ b/xdebug_handlers.h @@ -112,10 +112,8 @@ struct _xdebug_remote_handler { /* Breakpoints */ int (*remote_breakpoint)(xdebug_con *h, xdebug_llist *stack, char *file, long lineno, int type, char *exception, char *message); -#if PHP_VERSION_ID >= 50400 /* Output redirection */ int (*remote_stream_output)(const char *string, unsigned int length TSRMLS_DC); -#endif /* Eval ID registration and removal */ int (*register_eval_id)(xdebug_con *h, function_stack_entry *fse);