Skip to content

Commit

Permalink
Fixed issue #2014: Drop PHP 7.2 support
Browse files Browse the repository at this point in the history
  • Loading branch information
derickr committed Sep 1, 2021
1 parent 21e6394 commit fe6c055
Show file tree
Hide file tree
Showing 95 changed files with 264 additions and 1,477 deletions.
48 changes: 24 additions & 24 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,97 +26,97 @@ cache:
environment:
BIN_SDK_VER: 2.2.0
matrix:
- PHP_VER: 8.0
- PHP_VER: 8.1
ARCH: x64
TS: 1
VC: vs16
OPCACHE: yes
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
- PHP_VER: 8.0
- PHP_VER: 8.1
ARCH: x64
TS: 0
VC: vs16
OPCACHE: no
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
- PHP_VER: 8.0
- PHP_VER: 8.1
ARCH: x86
TS: 1
VC: vs16
OPCACHE: no
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
- PHP_VER: 8.0
- PHP_VER: 8.1
ARCH: x86
TS: 0
VC: vs16
OPCACHE: yes
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
- PHP_VER: 7.4
- PHP_VER: 8.0
ARCH: x64
TS: 1
VC: vc15
VC: vs16
OPCACHE: yes
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- PHP_VER: 7.4
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
- PHP_VER: 8.0
ARCH: x64
TS: 0
VC: vc15
VC: vs16
OPCACHE: no
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- PHP_VER: 7.4
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
- PHP_VER: 8.0
ARCH: x86
TS: 1
VC: vc15
VC: vs16
OPCACHE: no
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- PHP_VER: 7.4
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
- PHP_VER: 8.0
ARCH: x86
TS: 0
VC: vc15
VC: vs16
OPCACHE: yes
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- PHP_VER: 7.3
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
- PHP_VER: 7.4
ARCH: x64
TS: 1
VC: vc15
OPCACHE: yes
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- PHP_VER: 7.3
- PHP_VER: 7.4
ARCH: x64
TS: 0
VC: vc15
OPCACHE: no
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- PHP_VER: 7.3
- PHP_VER: 7.4
ARCH: x86
TS: 1
VC: vc15
OPCACHE: no
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- PHP_VER: 7.3
- PHP_VER: 7.4
ARCH: x86
TS: 0
VC: vc15
OPCACHE: yes
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- PHP_VER: 7.2.34
- PHP_VER: 7.3
ARCH: x64
TS: 1
VC: vc15
OPCACHE: yes
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- PHP_VER: 7.2.34
- PHP_VER: 7.3
ARCH: x64
TS: 0
VC: vc15
OPCACHE: no
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- PHP_VER: 7.2.34
- PHP_VER: 7.3
ARCH: x86
TS: 1
VC: vc15
OPCACHE: no
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- PHP_VER: 7.2.34
- PHP_VER: 7.3
ARCH: x86
TS: 0
VC: vc15
Expand Down
36 changes: 0 additions & 36 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,40 +119,6 @@ jobs:
environment:
REPORT_EXIT_STATUS: 1

"PHP 7 2 without opcache":
docker:
- image: circleci/php:7.2.34-cli-stretch
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 2 with opcache":
docker:
- image: circleci/php:7.2.34-cli-stretch
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
Expand All @@ -164,5 +130,3 @@ workflows:
- "PHP 7 4 with opcache"
- "PHP 7 3 without opcache"
- "PHP 7 3 with opcache"
- "PHP 7 2 without opcache"
- "PHP 7 2 with opcache"
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [7.2, 7.3, 7.4, 8.0, 8.1]
php: [7.3, 7.4, 8.0, 8.1]
use-opcache: [true, false]

steps:
Expand Down
8 changes: 4 additions & 4 deletions config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,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 "70200"; then
AC_MSG_ERROR([not supported. Need a PHP version >= 7.2.0 and < 8.2.0 (found $PHP_XDEBUG_FOUND_VERSION)])
if test "$PHP_XDEBUG_FOUND_VERNUM" -lt "70300"; then
AC_MSG_ERROR([not supported. Need a PHP version >= 7.3.0 and < 8.3.0 (found $PHP_XDEBUG_FOUND_VERSION)])
else
if test "$PHP_XDEBUG_FOUND_VERNUM" -ge "80200"; then
AC_MSG_ERROR([not supported. Need a PHP version >= 7.2.0 and < 8.2.0 (found $PHP_XDEBUG_FOUND_VERSION)])
if test "$PHP_XDEBUG_FOUND_VERNUM" -ge "80300"; then
AC_MSG_ERROR([not supported. Need a PHP version >= 7.3.0 and < 8.3.0 (found $PHP_XDEBUG_FOUND_VERSION)])
else
AC_MSG_RESULT([supported ($PHP_XDEBUG_FOUND_VERSION)])
fi
Expand Down
7 changes: 0 additions & 7 deletions src/base/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -1096,13 +1096,6 @@ void xdebug_base_minit(INIT_FUNC_ARGS)
xdebug_old_error_cb = zend_error_cb;
xdebug_new_error_cb = xdebug_error_cb;

/* Redirect compile and execute functions to our own. For PHP 7.3 and
* later, we hook these in xdebug_post_startup instead */
#if PHP_VERSION_ID < 70300
old_compile_file = zend_compile_file;
zend_compile_file = xdebug_compile_file;
#endif

xdebug_old_execute_ex = zend_execute_ex;
zend_execute_ex = xdebug_execute_ex;

Expand Down
21 changes: 5 additions & 16 deletions src/coverage/branch_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void xdebug_branch_info_update(xdebug_branch_info *branch_info, unsigned int pos
static void only_leave_first_catch(zend_op_array *opa, xdebug_branch_info *branch_info, int position)
{
unsigned int exit_jmp;
#if PHP_VERSION_ID >= 70300 && ZEND_USE_ABS_JMP_ADDR
#if ZEND_USE_ABS_JMP_ADDR
zend_op *base_address = &(opa->opcodes[0]);
#endif

Expand All @@ -83,17 +83,10 @@ static void only_leave_first_catch(zend_op_array *opa, xdebug_branch_info *branc

xdebug_set_remove(branch_info->entry_points, position);

#if PHP_VERSION_ID >= 70300
if (opa->opcodes[position].extended_value & ZEND_LAST_CATCH) {
return;
}
exit_jmp = XDEBUG_ZNODE_JMP_LINE(opa->opcodes[position].op2, position, base_address);
#else
if (opa->opcodes[position].result.num) {
return;
}
exit_jmp = position + ((signed int) opa->opcodes[position].extended_value / sizeof(zend_op));
#endif

if (opa->opcodes[exit_jmp].opcode == ZEND_FETCH_CLASS) {
exit_jmp++;
Expand All @@ -107,25 +100,21 @@ void xdebug_branch_post_process(zend_op_array *opa, xdebug_branch_info *branch_i
{
unsigned int i;
int in_branch = 0, last_start = -1;
#if PHP_VERSION_ID >= 70300 && ZEND_USE_ABS_JMP_ADDR
#if ZEND_USE_ABS_JMP_ADDR
zend_op *base_address = &(opa->opcodes[0]);
#endif

/* Figure out which CATCHes are chained, and hence which ones should be
* considered entry points */
for (i = 0; i < branch_info->entry_points->size; i++) {
if (xdebug_set_in(branch_info->entry_points, i) && opa->opcodes[i].opcode == ZEND_CATCH) {
#if PHP_VERSION_ID >= 70300
# if ZEND_USE_ABS_JMP_ADDR
#if ZEND_USE_ABS_JMP_ADDR
if (opa->opcodes[i].op2.jmp_addr != NULL) {
# else
#else
if (opa->opcodes[i].op2.jmp_offset != 0) {
# endif
#endif
only_leave_first_catch(opa, branch_info, XDEBUG_ZNODE_JMP_LINE(opa->opcodes[i].op2, i, base_address));
}
#else
only_leave_first_catch(opa, branch_info, i + ((signed int) opa->opcodes[i].extended_value / sizeof(zend_op)));
#endif
}
}

Expand Down
9 changes: 0 additions & 9 deletions src/coverage/code_coverage.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,13 +321,8 @@ static int xdebug_find_jumps(zend_op_array *opa, unsigned int position, size_t *
} else if (opcode.opcode == ZEND_CATCH) {
*jump_count = 2;
jumps[0] = position + 1;
#if PHP_VERSION_ID >= 70300
if (!(opcode.extended_value & ZEND_LAST_CATCH)) {
jumps[1] = XDEBUG_ZNODE_JMP_LINE(opcode.op2, position, base_address);
#else
if (!opcode.result.num) {
jumps[1] = position + (opcode.extended_value / sizeof(zend_op));
#endif
if (jumps[1] == jumps[0]) {
jumps[1] = XDEBUG_JMP_NOT_SET;
*jump_count = 1;
Expand Down Expand Up @@ -376,11 +371,7 @@ static int xdebug_find_jumps(zend_op_array *opa, unsigned int position, size_t *
HashTable *myht;
zval *val;

# if PHP_VERSION_ID >= 70300
array_value = RT_CONSTANT(&opa->opcodes[position], opcode.op2);
# else
array_value = RT_CONSTANT_EX(opa->literals, opcode.op2);
# endif
myht = Z_ARRVAL_P(array_value);

/* All 'case' statements */
Expand Down
2 changes: 1 addition & 1 deletion src/debugger/handler_dbgp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1812,7 +1812,7 @@ static int attach_context_vars(xdebug_xml_node *node, xdebug_var_export_options
continue;
}

if (XDEBUG_ZEND_CONSTANT_MODULE_NUMBER(val) != PHP_USER_CONSTANT) {
if (ZEND_CONSTANT_MODULE_NUMBER(val) != PHP_USER_CONSTANT) {
/* we're only interested in user defined constants */
continue;
}
Expand Down
43 changes: 10 additions & 33 deletions src/develop/stack.c
Original file line number Diff line number Diff line change
Expand Up @@ -703,28 +703,11 @@ void xdebug_develop_error_cb(int orig_type, const char *error_filename, const un
display = 1;
}

#if PHP_VERSION_ID < 70300
/* Store last error message for error_get_last() */
if (display) {
clear_last_error();
if (!error_filename) {
error_filename = "Unknown";
}
PG(last_error_type) = type;
PG(last_error_message) = strdup(buffer);
PG(last_error_file) = strdup(error_filename);
PG(last_error_lineno) = error_lineno;
}
#endif
error_handling = EG(error_handling);
exception_class = EG(exception_class);
#if PHP_VERSION_ID >= 70300

/* according to error handling mode, throw exception or show it */
if (error_handling == EH_THROW) {
#else
/* according to error handling mode, suppress error, throw exception or show it */
if (error_handling != EH_NORMAL) {
#endif
switch (type) {
case E_ERROR:
case E_CORE_ERROR:
Expand All @@ -746,11 +729,7 @@ void xdebug_develop_error_cb(int orig_type, const char *error_filename, const un
/* throw an exception if we are in EH_THROW mode
* but DO NOT overwrite a pending exception
*/
#if PHP_VERSION_ID >= 70300
if (!EG(exception)) {
#else
if (error_handling == EH_THROW && !EG(exception)) {
#endif
#if PHP_VERSION_ID >= 80000
zend_throw_error_exception(exception_class, message, 0, type);
#else
Expand All @@ -765,31 +744,29 @@ void xdebug_develop_error_cb(int orig_type, const char *error_filename, const un
}
}

#if PHP_VERSION_ID >= 70300
/* Store last error message for error_get_last() */
if (display) {
clear_last_error();
if (!error_filename) {
# if PHP_VERSION_ID >= 80100
#if PHP_VERSION_ID >= 80100
error_filename = zend_string_init(ZEND_STRL("Unknown"), 0);
# else
#else
error_filename = "Unknown";
# endif
#endif
}
PG(last_error_type) = type;
# if PHP_VERSION_ID >= 80000
#if PHP_VERSION_ID >= 80000
PG(last_error_message) = zend_string_copy(message);
# else
#else
PG(last_error_message) = strdup(buffer);
# endif
# if PHP_VERSION_ID >= 80100
#endif
#if PHP_VERSION_ID >= 80100
PG(last_error_file) = zend_string_copy(error_filename);
# else
#else
PG(last_error_file) = strdup(error_filename);
# endif
#endif
PG(last_error_lineno) = error_lineno;
}
#endif

if ((EG(error_reporting) | XINI_DEV(force_error_reporting)) & type) {
/* Log to logger */
Expand Down
Loading

0 comments on commit fe6c055

Please sign in to comment.