GeezerVison is showing github.com — refactor: remove all code for PHP versions lower than 8.2 · php-debugger/php-debugger@4475810
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: src/base/base.c -26Lines changed: 0 additions & 26 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 19 | 19 | #include "php_globals.h" | 20 | 20 | #include "zend_closures.h" | 21 | 21 | #include "zend_exceptions.h" | 22 | | -#if PHP_VERSION_ID >= 80200 | 23 | 22 | # include "zend_attributes.h" | 24 | | -#endif | 25 | 23 |
| 26 | 24 | #include "zend_interfaces.h" | 27 | 25 |
| 28 | | -#if PHP_VERSION_ID >= 80100 | 29 | 26 | # include "base_private.h" | 30 | 27 | # include "Zend/zend_fibers.h" | 31 | 28 | # include "Zend/zend_observer.h" | 32 | | -#endif | 33 | 29 |
| 34 | 30 | #include "php_xdebug.h" | 35 | 31 | #include "php_xdebug_arginfo.h" | @@ -53,15 +49,9 @@ zif_handler orig_pcntl_exec_func = NULL; | 53 | 49 | zif_handler orig_pcntl_fork_func = NULL; | 54 | 50 | zif_handler orig_exit_func = NULL; | 55 | 51 |
| 56 | | -#if PHP_VERSION_ID >= 80100 | 57 | 52 | void (*xdebug_old_error_cb)(int type, zend_string *error_filename, const uint32_t error_lineno, zend_string *message); | 58 | 53 | void (*xdebug_new_error_cb)(int type, zend_string *error_filename, const uint32_t error_lineno, zend_string *message); | 59 | 54 | static void xdebug_error_cb(int orig_type, zend_string *error_filename, const uint32_t error_lineno, zend_string *message); | 60 | | -#else | 61 | | -void (*xdebug_old_error_cb)(int type, const char *error_filename, const uint32_t error_lineno, zend_string *message); | 62 | | -void (*xdebug_new_error_cb)(int type, const char *error_filename, const uint32_t error_lineno, zend_string *message); | 63 | | -static void xdebug_error_cb(int orig_type, const char *error_filename, const uint32_t error_lineno, zend_string *message); | 64 | | -#endif | 65 | 55 |
| 66 | 56 | /* execution redirection functions */ | 67 | 57 | zend_op_array* (*old_compile_file)(zend_file_handle* file_handle, int type); | @@ -1023,7 +1013,6 @@ void xdebug_base_rshutdown(void) | 1023 | 1013 | } | 1024 | 1014 |
| 1025 | 1015 | /* Error callback for formatting stack traces */ | 1026 | | -#if PHP_VERSION_ID >= 80100 | 1027 | 1016 | static void xdebug_error_cb(int orig_type, zend_string *error_filename, const unsigned int error_lineno, zend_string *message) | 1028 | 1017 | { | 1029 | 1018 | int type = orig_type & E_ALL; | @@ -1035,19 +1024,6 @@ static void xdebug_error_cb(int orig_type, zend_string *error_filename, const un | 1035 | 1024 |
| 1036 | 1025 | xdebug_old_error_cb(orig_type, error_filename, error_lineno, message); | 1037 | 1026 | } | 1038 | | -#else | 1039 | | -static void xdebug_error_cb(int orig_type, const char *error_filename, const unsigned int error_lineno, zend_string *message) | 1040 | | -{ | 1041 | | - int type = orig_type & E_ALL; | 1042 | | - char *error_type_str = xdebug_error_type(type); | 1043 | | - zend_string *tmp_error_filename = zend_string_init(error_filename, strlen(error_filename), 0); | 1044 | | - | 1045 | | - xdebug_debugger_error_cb(tmp_error_filename, error_lineno, type, error_type_str, ZSTR_VAL(message)); | 1046 | | - | 1047 | | - zend_string_release(tmp_error_filename); | 1048 | | - xdfree(error_type_str); | 1049 | | -} | 1050 | | -#endif | 1051 | 1027 |
| 1052 | 1028 | void xdebug_base_use_original_error_cb(void) | 1053 | 1029 | { | @@ -1074,11 +1050,9 @@ static void xdebug_throw_exception_hook(zend_object *exception) | 1074 | 1050 | return; | 1075 | 1051 | } | 1076 | 1052 |
| 1077 | | -#if PHP_VERSION_ID >= 80100 | 1078 | 1053 | if (zend_is_graceful_exit(exception)) { | 1079 | 1054 | return; | 1080 | 1055 | } | 1081 | | -#endif | 1082 | 1056 |
| 1083 | 1057 | exception_ce = exception->ce; | 1084 | 1058 |
| |
Collapse file Copy file name to clipboardExpand all lines: src/base/base_globals.h -2Lines changed: 0 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -41,9 +41,7 @@ typedef struct _xdebug_nanotime_context { | 41 | 41 |
| 42 | 42 | typedef struct _xdebug_base_globals_t { | 43 | 43 | xdebug_vector *stack; | 44 | | -#if PHP_VERSION_ID >= 80100 | 45 | 44 | xdebug_hash *fiber_stacks; | 46 | | -#endif | 47 | 45 | xdebug_nanotime_context nanotime_context; | 48 | 46 | uint64_t start_nanotime; | 49 | 47 | unsigned int working_tsc_clock; /* -1 = unknown, 0 = not available, 1 = available */ | |
Collapse file Copy file name to clipboardExpand all lines: src/debugger/debugger.c -2Lines changed: 0 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1041,15 +1041,13 @@ static void add_function_to_lines_list(xdebug_lines_list *lines_list, zend_op_ar | 1041 | 1041 | lines_list->functions[lines_list->count] = map_item; | 1042 | 1042 | lines_list->count++; | 1043 | 1043 |
| 1044 | | -#if PHP_VERSION_ID >= 80100 | 1045 | 1044 | if (opa->num_dynamic_func_defs) { | 1046 | 1045 | uint32_t i; | 1047 | 1046 |
| 1048 | 1047 | for (i = 0; i < opa->num_dynamic_func_defs; i++) { | 1049 | 1048 | add_function_to_lines_list(lines_list, opa->dynamic_func_defs[i]); | 1050 | 1049 | } | 1051 | 1050 | } | 1052 | | -#endif | 1053 | 1051 | } | 1054 | 1052 | /* }}} */ | 1055 | 1053 |
| |
Collapse file Copy file name to clipboardExpand all lines: src/lib/lib.h +1-7Lines changed: 1 addition & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -48,9 +48,7 @@ typedef struct xdebug_var_name { | 48 | 48 | #define XFUNC_REQUIRE 0x13 | 49 | 49 | #define XFUNC_REQUIRE_ONCE 0x14 | 50 | 50 | #define XFUNC_MAIN 0x15 | 51 | | -#if PHP_VERSION_ID >= 80100 | 52 | | -# define XFUNC_FIBER 0x16 | 53 | | -#endif | | 51 | +#define XFUNC_FIBER 0x16 | 54 | 52 |
| 55 | 53 | #define XFUNC_ZEND_PASS 0x20 | 56 | 54 |
| @@ -140,11 +138,7 @@ typedef struct _function_stack_entry { | 140 | 138 |
| 141 | 139 | /* misc properties */ | 142 | 140 | zend_op_array *op_array; | 143 | | -#if PHP_VERSION_ID >= 80100 | 144 | 141 | void (*soap_error_cb)(int type, zend_string *error_filename, const uint32_t error_lineno, zend_string *message); | 145 | | -#else | 146 | | - void (*soap_error_cb)(int type, const char *error_filename, const uint32_t error_lineno, zend_string *message); | 147 | | -#endif | 148 | 142 | } function_stack_entry; | 149 | 143 |
| 150 | 144 | function_stack_entry *xdebug_get_stack_frame(int nr); | |
Collapse file Copy file name to clipboardExpand all lines: src/lib/str.c -17Lines changed: 0 additions & 17 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -114,7 +114,6 @@ void xdebug_str_add_uint64(xdebug_str *xs, uint64_t num) | 114 | 114 | xdebug_str_internal_addl(xs, pos, &buffer[20] - pos, 0); | 115 | 115 | } | 116 | 116 |
| 117 | | -#if PHP_VERSION_ID >= 80200 | 118 | 117 | void xdebug_str_add_va_fmt(xdebug_str *xs, const char *fmt, va_list argv) | 119 | 118 | { | 120 | 119 | int size; | @@ -146,22 +145,6 @@ void xdebug_str_add_va_fmt(xdebug_str *xs, const char *fmt, va_list argv) | 146 | 145 |
| 147 | 146 | assert(0); | 148 | 147 | } | 149 | | -#else | 150 | | -void xdebug_str_add_va_fmt(xdebug_str *xs, const char *fmt, va_list argv) | 151 | | -{ | 152 | | - smart_str buf = {0}; | 153 | | - | 154 | | - php_printf_to_smart_str(&buf, fmt, argv); | 155 | | - | 156 | | - if (!buf.s) { | 157 | | - return; | 158 | | - } | 159 | | - | 160 | | - xdebug_str_add_zstr(xs, buf.s); | 161 | | - | 162 | | - smart_str_free(&buf); | 163 | | -} | 164 | | -#endif | 165 | 148 |
| 166 | 149 | void xdebug_str_add_fmt(xdebug_str *xs, const char *fmt, ...) | 167 | 150 | { | |
Collapse file Copy file name to clipboardExpand all lines: src/lib/usefulstuff.c -4Lines changed: 0 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 41 | 41 | #include "usefulstuff.h" | 42 | 42 | #include "log.h" | 43 | 43 |
| 44 | | -#if PHP_VERSION_ID >= 80200 | 45 | 44 | # include "ext/random/php_random.h" | 46 | | -#else | 47 | | -# include "ext/standard/php_lcg.h" | 48 | | -#endif | 49 | 45 | #include "ext/standard/flock_compat.h" | 50 | 46 | #include "main/php_ini.h" | 51 | 47 |
| |
Collapse file Copy file name to clipboardExpand all lines: src/lib/var.c -4Lines changed: 0 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -916,11 +916,9 @@ xdebug_str* xdebug_get_property_type(zval* object, zval *val) | 916 | 916 | zend_string *type_info = zend_type_to_string(info->type); | 917 | 917 | type_str = xdebug_str_new(); | 918 | 918 |
| 919 | | -# if PHP_VERSION_ID >= 80100 | 920 | 919 | if (info->flags & ZEND_ACC_READONLY) { | 921 | 920 | xdebug_str_add_literal(type_str, "readonly "); | 922 | 921 | } | 923 | | -# endif | 924 | 922 |
| 925 | 923 | xdebug_str_add_zstr(type_str, type_info); | 926 | 924 | zend_string_release(type_info); | @@ -1212,11 +1210,9 @@ char* xdebug_show_fname(xdebug_func f, int flags) | 1212 | 1210 | return xdstrdup("{zend_pass}"); | 1213 | 1211 | break; | 1214 | 1212 |
| 1215 | | -#if PHP_VERSION_ID >= 80100 | 1216 | 1213 | case XFUNC_FIBER: | 1217 | 1214 | return xdebug_sprintf("%s", ZSTR_VAL(f.function)); | 1218 | 1215 | break; | 1219 | | -#endif | 1220 | 1216 |
| 1221 | 1217 | default: | 1222 | 1218 | return xdstrdup("{unknown}"); | |
Collapse file Copy file name to clipboardExpand all lines: src/lib/var_export_html.c +7-13Lines changed: 7 additions & 13 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 17 | 17 | #include "var_export_html.h" | 18 | 18 | #include "lib_private.h" | 19 | 19 | #include "Zend/zend_closures.h" | 20 | | -#if PHP_VERSION_ID >= 80100 | 21 | | -# if !defined(_MSC_VER) | 22 | | -# pragma GCC diagnostic push | 23 | | -# pragma GCC diagnostic ignored "-Wdeclaration-after-statement" | 24 | | -# endif | 25 | | -# include "zend_enum.h" | 26 | | -# if !defined(_MSC_VER) | 27 | | -# pragma GCC diagnostic pop | 28 | | -# endif | | 20 | +#if !defined(_MSC_VER) | | 21 | +# pragma GCC diagnostic push | | 22 | +# pragma GCC diagnostic ignored "-Wdeclaration-after-statement" | | 23 | +#endif | | 24 | +#include "zend_enum.h" | | 25 | +#if !defined(_MSC_VER) | | 26 | +# pragma GCC diagnostic pop | 29 | 27 | #endif | 30 | 28 |
| 31 | 29 | ZEND_EXTERN_MODULE_GLOBALS(xdebug) | @@ -245,7 +243,6 @@ void xdebug_var_export_html(zval **struc, xdebug_str *str, int level, int debug_ | 245 | 243 | break; | 246 | 244 |
| 247 | 245 | case IS_OBJECT: { | 248 | | -#if PHP_VERSION_ID >= 80100 | 249 | 246 | zend_class_entry *ce = Z_OBJCE_P(*struc); | 250 | 247 | if (ce->ce_flags & ZEND_ACC_ENUM) { | 251 | 248 | zval *case_name_zval = zend_enum_fetch_case_name(Z_OBJ_P(*struc)); | @@ -274,7 +271,6 @@ void xdebug_var_export_html(zval **struc, xdebug_str *str, int level, int debug_ | 274 | 271 | xdebug_str_addc(str, '\n'); | 275 | 272 | break; | 276 | 273 | } | 277 | | -#endif | 278 | 274 |
| 279 | 275 | myht = xdebug_objdebug_pp(struc, XDEBUG_VAR_OBJDEBUG_USE_DEBUGINFO); | 280 | 276 | xdebug_str_add_fmt(str, "\n%*s", (level - 1) * 4, ""); | @@ -418,14 +414,12 @@ static void xdebug_var_synopsis_html(zval **struc, xdebug_str *str, int level, i | 418 | 414 | break; | 419 | 415 |
| 420 | 416 | case IS_OBJECT: { | 421 | | -#if PHP_VERSION_ID >= 80100 | 422 | 417 | zend_class_entry *ce = Z_OBJCE_P(*struc); | 423 | 418 | if (ce->ce_flags & ZEND_ACC_ENUM) { | 424 | 419 | zval *case_name_zval = zend_enum_fetch_case_name(Z_OBJ_P(*struc)); | 425 | 420 | xdebug_str_add_fmt( str, "<font color='%s'>enum(%s::%s)</font>", COLOR_OBJECT, ZSTR_VAL(ce->name), Z_STRVAL_P(case_name_zval)); | 426 | 421 | break; | 427 | 422 | } | 428 | | -#endif | 429 | 423 |
| 430 | 424 | xdebug_str_add_fmt(str, "<font color='%s'>object(%s)[%d]</font>", COLOR_OBJECT, ZSTR_VAL(Z_OBJCE_P(*struc)->name), Z_OBJ_HANDLE_P(*struc)); | 431 | 425 | } break; | |
Collapse file Copy file name to clipboardExpand all lines: src/lib/var_export_line.c +7-44Lines changed: 7 additions & 44 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 17 | 17 | #include "lib/php-header.h" | 18 | 18 | #include "ext/standard/php_string.h" | 19 | 19 | #include "Zend/zend_closures.h" | 20 | | -#if PHP_VERSION_ID >= 80100 | 21 | | -# if !defined(_MSC_VER) | 22 | | -# pragma GCC diagnostic push | 23 | | -# pragma GCC diagnostic ignored "-Wdeclaration-after-statement" | 24 | | -# endif | 25 | | -# include "zend_enum.h" | 26 | | -# if !defined(_MSC_VER) | 27 | | -# pragma GCC diagnostic pop | 28 | | -# endif | | 20 | +#if !defined(_MSC_VER) | | 21 | +# pragma GCC diagnostic push | | 22 | +# pragma GCC diagnostic ignored "-Wdeclaration-after-statement" | | 23 | +#endif | | 24 | +#include "zend_enum.h" | | 25 | +#if !defined(_MSC_VER) | | 26 | +# pragma GCC diagnostic pop | 29 | 27 | #endif | 30 | 28 |
| 31 | 29 | #include "var_export_line.h" | @@ -112,33 +110,6 @@ static int xdebug_object_element_export(zval *object, zval *zv_nptr, zend_ulong | 112 | 110 | return 0; | 113 | 111 | } | 114 | 112 |
| 115 | | -#if PHP_VERSION_ID < 80200 | 116 | | -static void handle_closure(xdebug_str *str, zval *obj) | 117 | | -{ | 118 | | - const zend_function *closure_function; | 119 | | - | 120 | | - if (Z_TYPE_P(obj) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(obj), zend_ce_closure)) { | 121 | | - return; | 122 | | - } | 123 | | - | 124 | | - closure_function = zend_get_closure_method_def(Z_OBJ_P(obj)); | 125 | | - | 126 | | - xdebug_str_add_literal(str, "virtual $closure = \""); | 127 | | - | 128 | | - if (closure_function->common.scope) { | 129 | | - if (closure_function->common.fn_flags & ZEND_ACC_STATIC) { | 130 | | - xdebug_str_add(str, ZSTR_VAL(closure_function->common.scope->name), 0); | 131 | | - xdebug_str_add_literal(str, "::"); | 132 | | - } else { | 133 | | - xdebug_str_add_literal(str, "$this->"); | 134 | | - } | 135 | | - } | 136 | | - xdebug_str_add_zstr(str, closure_function->common.function_name); | 137 | | - | 138 | | - xdebug_str_add_literal(str, "\", "); | 139 | | -} | 140 | | -#endif | 141 | | - | 142 | 113 | void xdebug_var_export_line(zval **struc, xdebug_str *str, int level, int debug_zval, xdebug_var_export_options *options) | 143 | 114 | { | 144 | 115 | HashTable *myht; | @@ -249,9 +220,7 @@ void xdebug_var_export_line(zval **struc, xdebug_str *str, int level, int debug_ | 249 | 220 | break; | 250 | 221 |
| 251 | 222 | case IS_OBJECT: { | 252 | | -#if PHP_VERSION_ID >= 80100 | 253 | 223 | zend_class_entry *ce = Z_OBJCE_P(*struc); | 254 | | -#endif | 255 | 224 |
| 256 | 225 | #if PHP_VERSION_ID >= 80400 | 257 | 226 | if ( | @@ -267,7 +236,6 @@ void xdebug_var_export_line(zval **struc, xdebug_str *str, int level, int debug_ | 267 | 236 | } | 268 | 237 | #endif | 269 | 238 |
| 270 | | -#if PHP_VERSION_ID >= 80100 | 271 | 239 | if (ce->ce_flags & ZEND_ACC_ENUM) { | 272 | 240 | zval *case_name_zval = zend_enum_fetch_case_name(Z_OBJ_P(*struc)); | 273 | 241 | xdebug_str_add_fmt(str, "enum %s::%s", ZSTR_VAL(ce->name), Z_STRVAL_P(case_name_zval)); | @@ -292,7 +260,6 @@ void xdebug_var_export_line(zval **struc, xdebug_str *str, int level, int debug_ | 292 | 260 |
| 293 | 261 | break; | 294 | 262 | } | 295 | | -#endif | 296 | 263 |
| 297 | 264 | myht = xdebug_objdebug_pp(struc, XDEBUG_VAR_OBJDEBUG_USE_DEBUGINFO); | 298 | 265 |
| @@ -301,10 +268,6 @@ void xdebug_var_export_line(zval **struc, xdebug_str *str, int level, int debug_ | 301 | 268 | xdebug_str_add(str, ZSTR_VAL(Z_OBJCE_P(*struc)->name), 0); | 302 | 269 | xdebug_str_add_literal(str, " { "); | 303 | 270 |
| 304 | | -#if PHP_VERSION_ID < 80200 | 305 | | - handle_closure(str, *struc); | 306 | | -#endif | 307 | | - | 308 | 271 | if (myht && (level <= options->max_depth)) { | 309 | 272 | options->runtime[level].current_element_nr = 0; | 310 | 273 | options->runtime[level].start_element_nr = 0; | |
|