Skip to content

Commit

Permalink
Fixed issue #2103: Remove support for PHP 7.4
Browse files Browse the repository at this point in the history
  • Loading branch information
derickr committed Jul 13, 2022
1 parent a0d3a09 commit 45f2a13
Show file tree
Hide file tree
Showing 18 changed files with 20 additions and 304 deletions.
10 changes: 0 additions & 10 deletions .azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ jobs:
configurationName: 'OSX_PHP_80'
phpVersion: '8.0.20'
configurationParameters: '--enable-debug --disable-zts'
- template: .azure/macos/job.yml
parameters:
configurationName: 'OSX_PHP_74'
phpVersion: '7.4.30'
configurationParameters: '--enable-debug --disable-maintainer-zts'
- template: .azure/macos/job.yml
parameters:
configurationName: 'OSX_PHP_81_ZTS'
Expand All @@ -33,8 +28,3 @@ jobs:
phpVersion: '8.0.20'
configurationParameters: '--enable-debug --enable-zts'
xdebugConfigurationParameters: '--without-xdebug-compression'
- template: .azure/macos/job.yml
parameters:
configurationName: 'OSX_PHP_74_ZTS'
phpVersion: '7.4.30'
configurationParameters: '--enable-debug --enable-maintainer-zts'
37 changes: 0 additions & 37 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,41 +85,6 @@ jobs:
environment:
REPORT_EXIT_STATUS: 1

"PHP 7 4 without opcache":
docker:
- image: cimg/php:7.4.30
auth:
username: $DOCKERHUB_USER
password: $DOCKERHUB_PW
steps:
- checkout
- compile
- run:
name: Setup extra env vars
command: |
echo 'export TEST_PHP_ARGS="-n -d foo=yes -d zend_extension=${CWD}/modules/xdebug.so"' >> $BASH_ENV
- run-tests
environment:
REPORT_EXIT_STATUS: 1

"PHP 7 4 with opcache":
docker:
- image: cimg/php:7.4.30
auth:
username: $DOCKERHUB_USER
password: $DOCKERHUB_PW
steps:
- checkout
- compile
- run:
name: Setup extra env vars
command: |
echo 'export TEST_PHP_ARGS="-n -d foo=yes -d zend_extension=opcache.so -d opcache.enable=1 -d opcache.enable_cli=1 -d zend_extension=${CWD}/modules/xdebug.so"' >> $BASH_ENV
- run-tests
environment:
REPORT_EXIT_STATUS: 1


workflows:
version: 2
testing:
Expand All @@ -128,5 +93,3 @@ workflows:
- "PHP 8 1 with opcache"
- "PHP 8 0 without opcache"
- "PHP 8 0 with opcache"
- "PHP 7 4 without opcache"
- "PHP 7 4 with opcache"
5 changes: 2 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [7.4, 8.0, 8.1]
php: [8.0, 8.1]
use-opcache: [true, false]
experimental: [false]
include:
Expand Down Expand Up @@ -73,7 +73,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ["7.4", "8.0", "8.1"]
php: ["8.0", "8.1"]
arch: [x64, x86]
ts: [nts, ts]
experimental: [false]
Expand Down Expand Up @@ -131,7 +131,6 @@ jobs:
$artifact_name = 'php_xdebug-${{env.XDEBUG_VERSION}}-${{matrix.php}}'
if ('7.4' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vc15' }
if ('8.0' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vs16' }
if ('8.1' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vs16' }
if ('8.2' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vs16' }
Expand Down
6 changes: 3 additions & 3 deletions config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ if test "$PHP_XDEBUG" != "no"; then
AC_MSG_CHECKING([Check for supported PHP versions])
PHP_XDEBUG_FOUND_VERSION=`${PHP_CONFIG} --version`
PHP_XDEBUG_FOUND_VERNUM=`echo "${PHP_XDEBUG_FOUND_VERSION}" | $AWK 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 100 + [$]2) * 100 + [$]3;}'`
if test "$PHP_XDEBUG_FOUND_VERNUM" -lt "70400"; then
AC_MSG_ERROR([not supported. Need a PHP version >= 7.4.0 and < 8.3.0 (found $PHP_XDEBUG_FOUND_VERSION)])
if test "$PHP_XDEBUG_FOUND_VERNUM" -lt "80000"; then
AC_MSG_ERROR([not supported. Need a PHP version >= 8.0.0 and < 8.3.0 (found $PHP_XDEBUG_FOUND_VERSION)])
else
if test "$PHP_XDEBUG_FOUND_VERNUM" -ge "80300"; then
AC_MSG_ERROR([not supported. Need a PHP version >= 7.4.0 and < 8.3.0 (found $PHP_XDEBUG_FOUND_VERSION)])
AC_MSG_ERROR([not supported. Need a PHP version >= 8.0.0 and < 8.3.0 (found $PHP_XDEBUG_FOUND_VERSION)])
else
AC_MSG_RESULT([supported ($PHP_XDEBUG_FOUND_VERSION)])
fi
Expand Down
54 changes: 4 additions & 50 deletions src/base/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,10 @@ ZEND_EXTERN_MODULE_GLOBALS(xdebug)
void (*xdebug_old_error_cb)(int type, zend_string *error_filename, const uint32_t error_lineno, zend_string *message);
void (*xdebug_new_error_cb)(int type, zend_string *error_filename, const uint32_t error_lineno, zend_string *message);
static void xdebug_error_cb(int orig_type, zend_string *error_filename, const uint32_t error_lineno, zend_string *message);
#elif PHP_VERSION_ID >= 80000
#else
void (*xdebug_old_error_cb)(int type, const char *error_filename, const uint32_t error_lineno, zend_string *message);
void (*xdebug_new_error_cb)(int type, const char *error_filename, const uint32_t error_lineno, zend_string *message);
static void xdebug_error_cb(int orig_type, const char *error_filename, const uint32_t error_lineno, zend_string *message);
#else
void (*xdebug_old_error_cb)(int type, const char *error_filename, const uint32_t error_lineno, const char *format, va_list args) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 4, 0);
void (*xdebug_new_error_cb)(int type, const char *error_filename, const uint32_t error_lineno, const char *format, va_list args) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 4, 0);
static void xdebug_error_cb(int orig_type, const char *error_filename, const uint32_t error_lineno, const char *format, va_list args) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 4, 0);
#endif

/* execution redirection functions */
Expand Down Expand Up @@ -413,7 +409,6 @@ static void collect_params_internal(function_stack_entry *fse, zend_execute_data
#endif
}

#if PHP_VERSION_ID >= 80000
if (ZEND_CALL_INFO(zdata) & ZEND_CALL_HAS_EXTRA_NAMED_PARAMS) {
zend_string *name;
zval *param;
Expand All @@ -429,7 +424,6 @@ static void collect_params_internal(function_stack_entry *fse, zend_execute_data
i++;
} ZEND_HASH_FOREACH_END();
}
#endif

#if DEBUG
for (i = 0; i < fse->varc; i++) {
Expand Down Expand Up @@ -522,7 +516,6 @@ static void collect_params(function_stack_entry *fse, zend_execute_data *zdata,
#endif
}

#if PHP_VERSION_ID >= 80000
if (ZEND_CALL_INFO(zdata) & ZEND_CALL_HAS_EXTRA_NAMED_PARAMS) {
zend_string *name;
zval *param;
Expand All @@ -538,7 +531,6 @@ static void collect_params(function_stack_entry *fse, zend_execute_data *zdata,
i++;
} ZEND_HASH_FOREACH_END();
}
#endif

#if DEBUG
for (i = 0; i < fse->varc; i++) {
Expand Down Expand Up @@ -849,10 +841,8 @@ static void xdebug_execute_internal(zend_execute_data *current_execute_data, zva
int restore_error_handler_situation = 0;
#if PHP_VERSION_ID >= 80100
void (*tmp_error_cb)(int type, zend_string *error_filename, const uint32_t error_lineno, zend_string *message) = NULL;
#elif PHP_VERSION_ID >= 80000
void (*tmp_error_cb)(int type, const char *error_filename, const uint32_t error_lineno, zend_string *message) = NULL;
#else
void (*tmp_error_cb)(int type, const char *error_filename, const uint32_t error_lineno, const char *format, va_list args) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 4, 0) = NULL;
void (*tmp_error_cb)(int type, const char *error_filename, const uint32_t error_lineno, zend_string *message) = NULL;
#endif

/* If the stack vector hasn't been initialised yet, we should abort immediately */
Expand Down Expand Up @@ -1340,7 +1330,7 @@ static void xdebug_error_cb(int orig_type, zend_string *error_filename, const un
xdebug_old_error_cb(orig_type, error_filename, error_lineno, message);
}
}
#elif PHP_VERSION_ID >= 80000
#else
static void xdebug_error_cb(int orig_type, const char *error_filename, const unsigned int error_lineno, zend_string *message)
{
if (XDEBUG_MODE_IS(XDEBUG_MODE_STEP_DEBUG)) {
Expand All @@ -1359,32 +1349,6 @@ static void xdebug_error_cb(int orig_type, const char *error_filename, const uns
xdebug_old_error_cb(orig_type, error_filename, error_lineno, message);
}
}
#else
static void xdebug_error_cb(int orig_type, const char *error_filename, const unsigned int error_lineno, const char *format, va_list args)
{
if (XDEBUG_MODE_IS(XDEBUG_MODE_STEP_DEBUG)) {
int type = orig_type & E_ALL;
char *error_type_str = xdebug_error_type(type);
zend_string *tmp_error_filename = zend_string_init(error_filename, strlen(error_filename), 0);
char *buffer;
va_list new_args;

va_copy(new_args, args);
vspprintf(&buffer, PG(log_errors_max_len), format, new_args);
va_end(new_args);

xdebug_debugger_error_cb(tmp_error_filename, error_lineno, type, error_type_str, buffer);

efree(buffer);
zend_string_release(tmp_error_filename);
xdfree(error_type_str);
}
if (XDEBUG_MODE_IS(XDEBUG_MODE_DEVELOP)) {
xdebug_develop_error_cb(orig_type, error_filename, error_lineno, format, args);
} else {
xdebug_old_error_cb(orig_type, error_filename, error_lineno, format, args);
}
}
#endif

void xdebug_base_use_original_error_cb(void)
Expand All @@ -1397,13 +1361,8 @@ void xdebug_base_use_xdebug_error_cb(void)
zend_error_cb = xdebug_new_error_cb;
}

#if PHP_VERSION_ID >= 80000
static void xdebug_throw_exception_hook(zend_object *exception)
{
#else
static void xdebug_throw_exception_hook(zval *exception)
{
#endif
zval *code, *message, *file, *line;
zend_class_entry *exception_ce;
char *code_str = NULL;
Expand All @@ -1417,22 +1376,17 @@ static void xdebug_throw_exception_hook(zval *exception)
return;
}

#if PHP_VERSION_ID >= 80000
if (zend_is_unwind_exit(exception)) {
return;
}
#endif

#if PHP_VERSION_ID >= 80100
if (zend_is_graceful_exit(exception)) {
return;
}
#endif

#if PHP_VERSION_ID >= 80000
exception_ce = exception->ce;
#else
exception_ce = Z_OBJCE_P(exception);
#endif

code = zend_read_property(exception_ce, exception, "code", sizeof("code")-1, 0, &dummy);
message = zend_read_property(exception_ce, exception, "message", sizeof("message")-1, 0, &dummy);
Expand Down
21 changes: 0 additions & 21 deletions src/coverage/code_coverage.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,18 +348,14 @@ static int xdebug_find_jumps(zend_op_array *opa, unsigned int position, size_t *
opcode.opcode == ZEND_GENERATOR_RETURN ||
opcode.opcode == ZEND_EXIT ||
opcode.opcode == ZEND_THROW ||
#if PHP_VERSION_ID >= 80000
opcode.opcode == ZEND_MATCH_ERROR ||
#endif
opcode.opcode == ZEND_RETURN
) {
jumps[0] = XDEBUG_JMP_EXIT;
*jump_count = 1;
return 1;
} else if (
# if PHP_VERSION_ID >= 80000
opcode.opcode == ZEND_MATCH ||
# endif
opcode.opcode == ZEND_SWITCH_LONG ||
opcode.opcode == ZEND_SWITCH_STRING
) {
Expand All @@ -382,15 +378,11 @@ static int xdebug_find_jumps(zend_op_array *opa, unsigned int position, size_t *
jumps[*jump_count] = position + (opcode.extended_value / sizeof(zend_op));
(*jump_count)++;

# if PHP_VERSION_ID >= 80000
if (opcode.opcode != ZEND_MATCH) {
# endif
/* The 'next' opcode */
jumps[*jump_count] = position + 1;
(*jump_count)++;
# if PHP_VERSION_ID >= 80000
}
# endif

return 1;
}
Expand Down Expand Up @@ -731,15 +723,8 @@ PHP_FUNCTION(xdebug_stop_code_coverage)
RETURN_TRUE;
}

#if PHP_VERSION_ID >= 80000
static int xdebug_lineno_cmp(Bucket *f, Bucket *s)
{
#else
static int xdebug_lineno_cmp(const void *a, const void *b)
{
Bucket *f = (Bucket *) a;
Bucket *s = (Bucket *) b;
#endif
if (f->h < s->h) {
return -1;
} else if (f->h > s->h) {
Expand Down Expand Up @@ -1044,14 +1029,8 @@ void xdebug_coverage_minit(INIT_FUNC_ARGS)
int i;

/* Get reserved offsets */
#if PHP_VERSION_ID >= 80000
zend_xdebug_cc_run_offset = zend_get_resource_handle(XDEBUG_NAME);
zend_xdebug_filter_offset = zend_get_resource_handle(XDEBUG_NAME);
#else
zend_extension dummy_ext;
zend_xdebug_cc_run_offset = zend_get_resource_handle(&dummy_ext);
zend_xdebug_filter_offset = zend_get_resource_handle(&dummy_ext);
#endif

xdebug_register_with_opcode_multi_handler(ZEND_ASSIGN, xdebug_common_override_handler);
xdebug_register_with_opcode_multi_handler(ZEND_ASSIGN_DIM, xdebug_common_override_handler);
Expand Down
18 changes: 0 additions & 18 deletions src/debugger/debugger.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,6 @@ static int xdebug_handle_hit_value(xdebug_brk_info *brk_info)

int xdebug_do_eval(char *eval_string, zval *ret_zval)
{
#if PHP_VERSION_ID < 80000
int old_track_errors;
#endif
volatile int res = 1;
zend_execute_data *original_execute_data = EG(current_execute_data);
int original_no_extensions = EG(no_extensions);
Expand All @@ -176,13 +173,7 @@ int xdebug_do_eval(char *eval_string, zval *ret_zval)
/* Remember error reporting level and track errors */
XG_BASE(error_reporting_override) = EG(error_reporting);
XG_BASE(error_reporting_overridden) = 1;
#if PHP_VERSION_ID < 80000
old_track_errors = PG(track_errors);
#endif
EG(error_reporting) = 0;
#if PHP_VERSION_ID < 80000
PG(track_errors) = 0;
#endif

XG_DBG(context).inhibit_notifications = 1;
XG_DBG(breakpoints_allowed) = 0;
Expand All @@ -206,9 +197,6 @@ int xdebug_do_eval(char *eval_string, zval *ret_zval)
/* Clean up */
EG(error_reporting) = XG_BASE(error_reporting_override);
XG_BASE(error_reporting_overridden) = 0;
#if PHP_VERSION_ID < 80000
PG(track_errors) = old_track_errors;
#endif
XG_DBG(breakpoints_allowed) = 1;
XG_DBG(context).inhibit_notifications = 0;

Expand Down Expand Up @@ -374,15 +362,9 @@ void xdebug_debugger_statement_call(zend_string *filename, int lineno)
}
}

#if PHP_VERSION_ID >= 80000
void xdebug_debugger_throw_exception_hook(zend_object *exception, zval *file, zval *line, zval *code, char *code_str, zval *message)
{
zend_class_entry *exception_ce = exception->ce;
#else
void xdebug_debugger_throw_exception_hook(zval *exception, zval *file, zval *line, zval *code, char *code_str, zval *message)
{
zend_class_entry *exception_ce = Z_OBJCE_P(exception);
#endif
xdebug_brk_info *extra_brk_info;

/* Start JIT if requested and not yet enabled */
Expand Down
4 changes: 0 additions & 4 deletions src/debugger/debugger.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,7 @@ xdebug_set *xdebug_debugger_get_breakable_lines_from_oparray(zend_op_array *opa)
int xdebug_do_eval(char *eval_string, zval *ret_zval);

void xdebug_debugger_statement_call(zend_string *filename, int lineno);
#if PHP_VERSION_ID >= 80000
void xdebug_debugger_throw_exception_hook(zend_object *exception, zval *file, zval *line, zval *code, char *code_str, zval *message);
#else
void xdebug_debugger_throw_exception_hook(zval *exception, zval *file, zval *line, zval *code, char *code_str, zval *message);
#endif
void xdebug_debugger_error_cb(zend_string *error_filename, int error_lineno, int type, char *error_type_str, char *buffer);
void xdebug_debugger_handle_breakpoints(function_stack_entry *fse, int breakpoint_type, zval *return_value);

Expand Down
4 changes: 0 additions & 4 deletions src/develop/develop.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,7 @@ void xdebug_develop_mshutdown();
void xdebug_develop_rinit();
void xdebug_develop_post_deactivate();

#if PHP_VERSION_ID >= 80000
void xdebug_develop_throw_exception_hook(zend_object *exception, zval *file, zval *line, zval *code, char *code_str, zval *message);
#else
void xdebug_develop_throw_exception_hook(zval *exception, zval *file, zval *line, zval *code, char *code_str, zval *message);
#endif
void xdebug_monitor_handler(function_stack_entry *fse);

#endif
Loading

0 comments on commit 45f2a13

Please sign in to comment.