From dea3732525a104fd45f080b88f859b41bfc4bade Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 29 Aug 2024 09:39:03 +0200 Subject: add upstream patch for PHP 8.4.0beta4 --- php-pecl-vld.spec | 7 +-- vld-pr83.patch | 39 ----------------- vld-upstream.patch | 124 ++++++++++++++++++++++++++++++++++++++++++++++++----- 3 files changed, 118 insertions(+), 52 deletions(-) delete mode 100644 vld-pr83.patch diff --git a/php-pecl-vld.spec b/php-pecl-vld.spec index 1e96e31..13fe7bb 100644 --- a/php-pecl-vld.spec +++ b/php-pecl-vld.spec @@ -23,12 +23,11 @@ Summary: Dump the internal representation of PHP scripts Name: %{?scl_prefix}php-pecl-%{pecl_name} License: PHP-3.01 Version: 0.18.0 -Release: 4%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} +Release: 5%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} URL: https://pecl.php.net/package/%{pecl_name} Source0: https://pecl.php.net/get/%{sources}.tgz Patch0: %{pecl_name}-upstream.patch -Patch1: %{pecl_name}-pr83.patch BuildRequires: make BuildRequires: %{?dtsprefix}gcc @@ -58,7 +57,6 @@ sed -e '/LICENSE/s/role="doc"/role="src"/' -i package.xml pushd %{sources} %patch -P0 -p1 -%patch -P1 -p1 #: Fix version #sed -e 's/"0.16.0"/"%{version}"/' -i vld.c @@ -165,6 +163,9 @@ done %changelog +* Thu Aug 29 2024 Remi Collet - 0.18.0-5 +- add upstream patch for PHP 8.4.0beta4 + * Thu Aug 22 2024 Remi Collet - 0.18.0-4 - add minimal patch for 8.4.0beta3 from https://github.com/derickr/vld/pull/83 diff --git a/vld-pr83.patch b/vld-pr83.patch deleted file mode 100644 index 376b342..0000000 --- a/vld-pr83.patch +++ /dev/null @@ -1,39 +0,0 @@ -From d1d9b0823ec8048dfabea506f4fcd337c047deac Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Thu, 22 Aug 2024 08:34:30 +0200 -Subject: [PATCH] minimal fix for 8.4.0beta3 - ---- - srm_oparray.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/srm_oparray.c b/srm_oparray.c -index 3bd6dce..e5fd05f 100644 ---- a/srm_oparray.c -+++ b/srm_oparray.c -@@ -1116,7 +1116,9 @@ int vld_find_jumps(zend_op_array *opa, unsigned int position, size_t *jump_count - - } else if ( - opcode.opcode == ZEND_GENERATOR_RETURN || -+#if PHP_VERSION_ID < 80400 - opcode.opcode == ZEND_EXIT || -+#endif - opcode.opcode == ZEND_THROW || - #if PHP_VERSION_ID >= 80000 - opcode.opcode == ZEND_MATCH_ERROR || -@@ -1265,6 +1267,7 @@ void vld_analyse_branch(zend_op_array *opa, unsigned int position, vld_set *set, - break; - } - -+#if PHP_VERSION_ID < 80400 - /* See if we have an exit instruction */ - if (opa->opcodes[position].opcode == ZEND_EXIT) { - VLD_PRINT(1, "Exit found\n"); -@@ -1272,6 +1275,7 @@ void vld_analyse_branch(zend_op_array *opa, unsigned int position, vld_set *set, - branch_info->branches[position].start_lineno = opa->opcodes[position].lineno; - break; - } -+#endif - /* See if we have a return instruction */ - if ( - opa->opcodes[position].opcode == ZEND_RETURN diff --git a/vld-upstream.patch b/vld-upstream.patch index b57e4de..5764235 100644 --- a/vld-upstream.patch +++ b/vld-upstream.patch @@ -1,7 +1,7 @@ From 850d2d82c293e52cf0ef57e6cc762617fcc09979 Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Mon, 10 Oct 2022 16:47:13 +0100 -Subject: [PATCH 1/5] Fixed crash with CATCH on PHP 8.2 with 32-bit +Subject: [PATCH 1/6] Fixed crash with CATCH on PHP 8.2 with 32-bit --- branchinfo.c | 10 +++++++--- @@ -37,12 +37,12 @@ index 3547c1b..bddd9ff 100644 branch_info->branches[i].start_lineno, branch_info->branches[i].end_lineno -- -2.45.2 +2.46.0 From 298cea2f3880cdc775fddbdb4fcb334e1f19bfc5 Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Fri, 16 Dec 2022 10:27:40 +0000 -Subject: [PATCH 2/5] Fixed showing the JMP for the 'default' (or error) case +Subject: [PATCH 2/6] Fixed showing the JMP for the 'default' (or error) case in MATCH instructions --- @@ -63,12 +63,12 @@ index 9fc75d4..54661c3 100644 /* 197 */ { "MATCH_ERROR", ALL_USED }, /* 198 */ { "JMP_NULL", ALL_USED }, -- -2.45.2 +2.46.0 From 7d25f1e5949935aa153b37d6bdaf19cf8079772a Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Tue, 28 May 2024 15:09:58 +0100 -Subject: [PATCH 3/5] RECV uses OP2_OPNUM too +Subject: [PATCH 3/6] RECV uses OP2_OPNUM too --- srm_oparray.c | 5 ++++- @@ -98,12 +98,12 @@ index 54661c3..1df6f06 100644 return flags; } -- -2.45.2 +2.46.0 From d7abb0c5ebda8277cda4be37a92d55e29ab5b503 Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Tue, 28 May 2024 15:11:24 +0100 -Subject: [PATCH 4/5] PHP_CHECK_GCC_ARG is now AX_CHECK_COMPILE_FLAG +Subject: [PATCH 4/6] PHP_CHECK_GCC_ARG is now AX_CHECK_COMPILE_FLAG --- config.m4 | 72 +++++++++++++++++++++++++++---------------------------- @@ -193,12 +193,12 @@ index 54b914d..18cfa7d 100644 MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS" STD_CFLAGS="-g -O0 -Wall" -- -2.45.2 +2.46.0 From df1c52c4cb62e5ff31e1b72e3f11df9a45ee567a Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Wed, 26 Jun 2024 16:58:42 +0100 -Subject: [PATCH 5/5] Add support for PHP 8.4 opcodes ZEND_JMP_FRAMELESS and +Subject: [PATCH 5/6] Add support for PHP 8.4 opcodes ZEND_JMP_FRAMELESS and ZEND_FRAMELESS_ICALL_[0-3] --- @@ -295,5 +295,109 @@ index 0000000..f693565 + +} -- -2.45.2 +2.46.0 + +From dc56f73a25b0230745afb5523871f2e8dd33fccd Mon Sep 17 00:00:00 2001 +From: Derick Rethans +Date: Thu, 22 Aug 2024 14:00:23 +0100 +Subject: [PATCH 6/6] PHP 8.4: Support for opcode-less exit + +Copied over from the Xdebug implementation. + +Fixes #83: minimal fix for 8.4.0beta3 +--- + srm_oparray.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 48 insertions(+), 2 deletions(-) + +diff --git a/srm_oparray.c b/srm_oparray.c +index 3bd6dce..2669697 100644 +--- a/srm_oparray.c ++++ b/srm_oparray.c +@@ -1108,15 +1108,17 @@ int vld_find_jumps(zend_op_array *opa, unsigned int position, size_t *jump_count + + #if PHP_VERSION_ID >= 80400 + } else if (opcode.opcode == ZEND_JMP_FRAMELESS) { +- jumps[0] = VLD_ZNODE_JMP_LINE(opcode.op2, position, base_address); +- jumps[1] = position + 1; ++ jumps[0] = position + 1; ++ jumps[1] = VLD_ZNODE_JMP_LINE(opcode.op2, position, base_address); + *jump_count = 2; + return 1; + #endif + + } else if ( + opcode.opcode == ZEND_GENERATOR_RETURN || ++#if PHP_VERSION_ID < 80400 + opcode.opcode == ZEND_EXIT || ++#endif + opcode.opcode == ZEND_THROW || + #if PHP_VERSION_ID >= 80000 + opcode.opcode == ZEND_MATCH_ERROR || +@@ -1126,6 +1128,48 @@ int vld_find_jumps(zend_op_array *opa, unsigned int position, size_t *jump_count + jumps[0] = VLD_JMP_EXIT; + *jump_count = 1; + return 1; ++ } else if ( ++ opcode.opcode == ZEND_INIT_FCALL ++ ) { ++ zval *func_name = RT_CONSTANT(&opa->opcodes[position], opcode.op2); ++ if (zend_string_equals_literal(Z_PTR_P(func_name), "exit")) { ++ int level = 0; ++ uint32_t start = position + 1; ++ ++ for (;;) { ++ switch (opa->opcodes[start].opcode) { ++ case ZEND_INIT_FCALL: ++ case ZEND_INIT_FCALL_BY_NAME: ++ case ZEND_INIT_NS_FCALL_BY_NAME: ++ case ZEND_INIT_DYNAMIC_CALL: ++ case ZEND_INIT_USER_CALL: ++ case ZEND_INIT_METHOD_CALL: ++ case ZEND_INIT_STATIC_METHOD_CALL: ++#if PHP_VERSION_ID >= 80400 ++ case ZEND_INIT_PARENT_PROPERTY_HOOK_CALL: ++#endif ++ case ZEND_NEW: ++ level++; ++ break; ++ case ZEND_DO_FCALL: ++ case ZEND_DO_FCALL_BY_NAME: ++ case ZEND_DO_ICALL: ++ case ZEND_DO_UCALL: ++ if (level == 0) { ++ goto done; ++ } ++ level--; ++ break; ++ } ++ start++; ++ } ++ done: ++ ZEND_ASSERT(opa->opcodes[start].opcode == ZEND_DO_ICALL); ++ jumps[0] = VLD_JMP_EXIT; ++ *jump_count = 1; ++ return 1; ++ } ++ + #if PHP_VERSION_ID >= 70200 + } else if ( + # if PHP_VERSION_ID >= 80000 +@@ -1265,6 +1309,7 @@ void vld_analyse_branch(zend_op_array *opa, unsigned int position, vld_set *set, + break; + } + ++#if PHP_VERSION_ID < 80400 + /* See if we have an exit instruction */ + if (opa->opcodes[position].opcode == ZEND_EXIT) { + VLD_PRINT(1, "Exit found\n"); +@@ -1272,6 +1317,7 @@ void vld_analyse_branch(zend_op_array *opa, unsigned int position, vld_set *set, + branch_info->branches[position].start_lineno = opa->opcodes[position].lineno; + break; + } ++#endif + /* See if we have a return instruction */ + if ( + opa->opcodes[position].opcode == ZEND_RETURN +-- +2.46.0 -- cgit