From 74aefc49058553a8eeadc73551edd2501f9bf8bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Sat, 1 Nov 2025 12:31:53 +0100 Subject: [PATCH 01/19] working filter and empty scripts --- .github/scripts/download-bundled/pcre2.sh | 7 +++ .github/scripts/download-bundled/sljit.sh | 7 +++ .../verify-directory-unchanged.sh | 6 +++ .github/workflows/verify-bundled-files.yml | 45 +++++++++++++++++++ 4 files changed, 65 insertions(+) create mode 100755 .github/scripts/download-bundled/pcre2.sh create mode 100755 .github/scripts/download-bundled/sljit.sh create mode 100755 .github/scripts/download-bundled/verify-directory-unchanged.sh create mode 100644 .github/workflows/verify-bundled-files.yml diff --git a/.github/scripts/download-bundled/pcre2.sh b/.github/scripts/download-bundled/pcre2.sh new file mode 100755 index 0000000000000..597b9b7b63880 --- /dev/null +++ b/.github/scripts/download-bundled/pcre2.sh @@ -0,0 +1,7 @@ +#!/bin/sh +set -e +cd "$(dirname "$0")/../../.." + +commit=b2bd4254b379b9d7dc9a3dda060a7e27009ccdff # 10.46 release + +git clone --revision=$commit https://github.com/PCRE2Project/pcre2.git /tmp/php-src-bundled/pcre2 diff --git a/.github/scripts/download-bundled/sljit.sh b/.github/scripts/download-bundled/sljit.sh new file mode 100755 index 0000000000000..46e7ff635e687 --- /dev/null +++ b/.github/scripts/download-bundled/sljit.sh @@ -0,0 +1,7 @@ +#!/bin/sh +set -e +cd "$(dirname "$0")/../../.." + +commit=8d40e0306aacca3596f64a338b5033d2050fc20e + +git clone --revision=$commit https://github.com/zherczeg/sljit.git /tmp/php-src-bundled/sljit diff --git a/.github/scripts/download-bundled/verify-directory-unchanged.sh b/.github/scripts/download-bundled/verify-directory-unchanged.sh new file mode 100755 index 0000000000000..7e0e7ebcacda9 --- /dev/null +++ b/.github/scripts/download-bundled/verify-directory-unchanged.sh @@ -0,0 +1,6 @@ +#!/bin/sh +set -e +cd "$(dirname "$0")/../../.." + +cd $1 +git add . -N && git diff --cached -a --exit-code . && git diff -a --exit-code . diff --git a/.github/workflows/verify-bundled-files.yml b/.github/workflows/verify-bundled-files.yml new file mode 100644 index 0000000000000..3fdb769d47a1d --- /dev/null +++ b/.github/workflows/verify-bundled-files.yml @@ -0,0 +1,45 @@ +name: Verify Bundled Files + +on: + push: + pull_request: + schedule: + - cron: "0 1 * * *" + workflow_dispatch: ~ + +permissions: + contents: read + +jobs: + VERIFY_BUNDLED_FILES: + name: Verify Bundled Files + runs-on: ubuntu-22.04 + steps: + - name: git checkout + uses: actions/checkout@v5 + + - uses: dorny/paths-filter@v3 + id: changes + with: + base: master + filters: | + pcre2: + - 'ext/pcre/pcre2lib/!(sljit/**)/**' + sljit: + - 'ext/pcre/pcre2lib/sljit/**' + + - name: PCRE2 - Download + if: ${{ !cancelled() && (steps.changes.outputs.pcre2 == 'true' || (github.event_name != 'push' && github.event_name != 'pull_request')) }} + run: .github/scripts/download-bundled/pcre2.sh + + - name: PCRE2 - Verify files + if: ${{ !cancelled() && (steps.changes.outputs.pcre2 == 'true' || (github.event_name != 'push' && github.event_name != 'pull_request')) }} + run: .github/scripts/download-bundled/verify-directory-unchanged.sh ext/pcre/pcre2lib + + - name: SLJIT - Download + if: ${{ !cancelled() && (steps.changes.outputs.sljit == 'true' || (github.event_name != 'push' && github.event_name != 'pull_request')) }} + run: .github/scripts/download-bundled/sljit.sh + + - name: SLJIT - Verify files + if: ${{ !cancelled() && (steps.changes.outputs.sljit == 'true' || (github.event_name != 'push' && github.event_name != 'pull_request')) }} + run: .github/scripts/download-bundled/verify-directory-unchanged.sh ext/pcre/pcre2lib/sljit From ae3ccb9f6e2a8ba745ac54cc7780c10c632f3603 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Sat, 1 Nov 2025 12:36:57 +0100 Subject: [PATCH 02/19] DEBUG FORCE CHANGE/CI --- ext/pcre/pcre2lib/pcre2_auto_possess.c | 2 +- ext/pcre/pcre2lib/sljit/sljitConfig.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/pcre/pcre2lib/pcre2_auto_possess.c b/ext/pcre/pcre2lib/pcre2_auto_possess.c index 6d7f27b6904ca..b3c476e360d7f 100644 --- a/ext/pcre/pcre2lib/pcre2_auto_possess.c +++ b/ext/pcre/pcre2lib/pcre2_auto_possess.c @@ -1,4 +1,4 @@ -/************************************************* +/*************************************************XXX * Perl-Compatible Regular Expressions * *************************************************/ diff --git a/ext/pcre/pcre2lib/sljit/sljitConfig.h b/ext/pcre/pcre2lib/sljit/sljitConfig.h index 993f4fe2fa168..2f98306aec22f 100644 --- a/ext/pcre/pcre2lib/sljit/sljitConfig.h +++ b/ext/pcre/pcre2lib/sljit/sljitConfig.h @@ -1,4 +1,4 @@ -/* +/*XXX * Stack-less Just-In-Time compiler * * Copyright Zoltan Herczeg (hzmester@freemail.hu). All rights reserved. From ff07fc5b7a7aa68ecf779105535be5a863e4b6b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Sat, 1 Nov 2025 12:41:31 +0100 Subject: [PATCH 03/19] wip update local bundle from upstream --- .github/scripts/download-bundled/pcre2.sh | 6 ++++++ .github/scripts/download-bundled/sljit.sh | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/.github/scripts/download-bundled/pcre2.sh b/.github/scripts/download-bundled/pcre2.sh index 597b9b7b63880..2186b352e3b41 100755 --- a/.github/scripts/download-bundled/pcre2.sh +++ b/.github/scripts/download-bundled/pcre2.sh @@ -5,3 +5,9 @@ cd "$(dirname "$0")/../../.." commit=b2bd4254b379b9d7dc9a3dda060a7e27009ccdff # 10.46 release git clone --revision=$commit https://github.com/PCRE2Project/pcre2.git /tmp/php-src-bundled/pcre2 + +rm -rf ext/pcre/pcre2lib +cp -R /tmp/php-src-bundled/pcre2/src ext/pcre/pcre2lib + +cd ext/pcre/pcre2lib +git restore config.h diff --git a/.github/scripts/download-bundled/sljit.sh b/.github/scripts/download-bundled/sljit.sh index 46e7ff635e687..bf498ebde9fe8 100755 --- a/.github/scripts/download-bundled/sljit.sh +++ b/.github/scripts/download-bundled/sljit.sh @@ -5,3 +5,8 @@ cd "$(dirname "$0")/../../.." commit=8d40e0306aacca3596f64a338b5033d2050fc20e git clone --revision=$commit https://github.com/zherczeg/sljit.git /tmp/php-src-bundled/sljit + +rm -rf ext/pcre/pcre2lib/sljit +cp -R /tmp/php-src-bundled/sljit/sljit_src ext/pcre/pcre2lib/sljit + +cd ext/pcre/pcre2lib/sljit From 5fbbe62d69fe081e3e04bba7fab3dfbb01f55bc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Sat, 1 Nov 2025 14:21:30 +0100 Subject: [PATCH 04/19] --recurse-submodules --- .github/scripts/download-bundled/pcre2.sh | 2 +- .github/scripts/download-bundled/sljit.sh | 12 ------------ .github/workflows/verify-bundled-files.yml | 12 +----------- 3 files changed, 2 insertions(+), 24 deletions(-) delete mode 100755 .github/scripts/download-bundled/sljit.sh diff --git a/.github/scripts/download-bundled/pcre2.sh b/.github/scripts/download-bundled/pcre2.sh index 2186b352e3b41..8c7723295e3ef 100755 --- a/.github/scripts/download-bundled/pcre2.sh +++ b/.github/scripts/download-bundled/pcre2.sh @@ -4,7 +4,7 @@ cd "$(dirname "$0")/../../.." commit=b2bd4254b379b9d7dc9a3dda060a7e27009ccdff # 10.46 release -git clone --revision=$commit https://github.com/PCRE2Project/pcre2.git /tmp/php-src-bundled/pcre2 +git clone --recurse-submodules --revision=$commit https://github.com/PCRE2Project/pcre2.git /tmp/php-src-bundled/pcre2 rm -rf ext/pcre/pcre2lib cp -R /tmp/php-src-bundled/pcre2/src ext/pcre/pcre2lib diff --git a/.github/scripts/download-bundled/sljit.sh b/.github/scripts/download-bundled/sljit.sh deleted file mode 100755 index bf498ebde9fe8..0000000000000 --- a/.github/scripts/download-bundled/sljit.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -set -e -cd "$(dirname "$0")/../../.." - -commit=8d40e0306aacca3596f64a338b5033d2050fc20e - -git clone --revision=$commit https://github.com/zherczeg/sljit.git /tmp/php-src-bundled/sljit - -rm -rf ext/pcre/pcre2lib/sljit -cp -R /tmp/php-src-bundled/sljit/sljit_src ext/pcre/pcre2lib/sljit - -cd ext/pcre/pcre2lib/sljit diff --git a/.github/workflows/verify-bundled-files.yml b/.github/workflows/verify-bundled-files.yml index 3fdb769d47a1d..a469c28ba92c0 100644 --- a/.github/workflows/verify-bundled-files.yml +++ b/.github/workflows/verify-bundled-files.yml @@ -24,9 +24,7 @@ jobs: base: master filters: | pcre2: - - 'ext/pcre/pcre2lib/!(sljit/**)/**' - sljit: - - 'ext/pcre/pcre2lib/sljit/**' + - 'ext/pcre/pcre2lib/**' - name: PCRE2 - Download if: ${{ !cancelled() && (steps.changes.outputs.pcre2 == 'true' || (github.event_name != 'push' && github.event_name != 'pull_request')) }} @@ -35,11 +33,3 @@ jobs: - name: PCRE2 - Verify files if: ${{ !cancelled() && (steps.changes.outputs.pcre2 == 'true' || (github.event_name != 'push' && github.event_name != 'pull_request')) }} run: .github/scripts/download-bundled/verify-directory-unchanged.sh ext/pcre/pcre2lib - - - name: SLJIT - Download - if: ${{ !cancelled() && (steps.changes.outputs.sljit == 'true' || (github.event_name != 'push' && github.event_name != 'pull_request')) }} - run: .github/scripts/download-bundled/sljit.sh - - - name: SLJIT - Verify files - if: ${{ !cancelled() && (steps.changes.outputs.sljit == 'true' || (github.event_name != 'push' && github.event_name != 'pull_request')) }} - run: .github/scripts/download-bundled/verify-directory-unchanged.sh ext/pcre/pcre2lib/sljit From bd1bda497670194fedf620076d03aefc13c5157a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Sun, 2 Nov 2025 01:32:02 +0100 Subject: [PATCH 05/19] Revert "DEBUG FORCE CHANGE/CI" --- ext/pcre/pcre2lib/pcre2_auto_possess.c | 2 +- ext/pcre/pcre2lib/sljit/sljitConfig.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/pcre/pcre2lib/pcre2_auto_possess.c b/ext/pcre/pcre2lib/pcre2_auto_possess.c index b3c476e360d7f..6d7f27b6904ca 100644 --- a/ext/pcre/pcre2lib/pcre2_auto_possess.c +++ b/ext/pcre/pcre2lib/pcre2_auto_possess.c @@ -1,4 +1,4 @@ -/*************************************************XXX +/************************************************* * Perl-Compatible Regular Expressions * *************************************************/ diff --git a/ext/pcre/pcre2lib/sljit/sljitConfig.h b/ext/pcre/pcre2lib/sljit/sljitConfig.h index 2f98306aec22f..993f4fe2fa168 100644 --- a/ext/pcre/pcre2lib/sljit/sljitConfig.h +++ b/ext/pcre/pcre2lib/sljit/sljitConfig.h @@ -1,4 +1,4 @@ -/*XXX +/* * Stack-less Just-In-Time compiler * * Copyright Zoltan Herczeg (hzmester@freemail.hu). All rights reserved. From 60385d5836a4a7e87bf9507f4fe57f1be33d9ddc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Sun, 2 Nov 2025 01:29:03 +0100 Subject: [PATCH 06/19] fix outdated pcre2_chartables.c (pcre2_chartables.c.dist) --- ext/pcre/pcre2lib/pcre2_chartables.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/ext/pcre/pcre2lib/pcre2_chartables.c b/ext/pcre/pcre2lib/pcre2_chartables.c index 861914d1ac3ac..7362c3f2345ab 100644 --- a/ext/pcre/pcre2lib/pcre2_chartables.c +++ b/ext/pcre/pcre2lib/pcre2_chartables.c @@ -5,7 +5,8 @@ /* This file was automatically written by the pcre2_dftables auxiliary program. It contains character tables that are used when no external tables are passed to PCRE2 by the application that calls it. The tables -are used only for characters whose code values are less than 256. */ +are used only for characters whose code values are less than 256, and +only relevant if not in UCP mode. */ /* This set of tables was written in the C locale. */ @@ -18,13 +19,6 @@ PCRE2 is configured with --enable-rebuild-chartables. However, you can run pcre2_dftables manually with the -L option to build tables using the LC_ALL locale. */ -/* The following #include is present because without it gcc 4.x may remove -the array definition from the final binary if PCRE2 is built into a static -library and dead code stripping is activated. This leads to link errors. -Pulling in the header ensures that the array gets flagged as "someone -outside this compilation unit might reference this" and so it will always -be supplied to the linker. */ - #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -163,7 +157,7 @@ graph, print, punct, and cntrl. Other classes are built from combinations. */ 0x02 letter 0x04 lower case letter 0x08 decimal digit - 0x10 alphanumeric or '_' + 0x10 word (alphanumeric or '_') */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 0- 7 */ From d739629a3cbd017dd649eef79535631bd21a230f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Sun, 2 Nov 2025 02:22:03 +0100 Subject: [PATCH 07/19] fix outdated pcre2.h (pcre2.h.generic) --- ext/pcre/pcre2lib/pcre2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/pcre/pcre2lib/pcre2.h b/ext/pcre/pcre2lib/pcre2.h index 7432608967398..a6c739fb9182d 100644 --- a/ext/pcre/pcre2lib/pcre2.h +++ b/ext/pcre/pcre2lib/pcre2.h @@ -324,7 +324,7 @@ pcre2_pattern_convert(). */ #define PCRE2_ERROR_ALPHA_ASSERTION_UNKNOWN 195 #define PCRE2_ERROR_SCRIPT_RUN_NOT_AVAILABLE 196 #define PCRE2_ERROR_TOO_MANY_CAPTURES 197 -#define PCRE2_ERROR_CONDITION_ATOMIC_ASSERTION_EXPECTED 198 +#define PCRE2_ERROR_MISSING_OCTAL_DIGIT 198 #define PCRE2_ERROR_BACKSLASH_K_IN_LOOKAROUND 199 #define PCRE2_ERROR_MAX_VAR_LOOKBEHIND_EXCEEDED 200 #define PCRE2_ERROR_PATTERN_COMPILED_SIZE_TOO_BIG 201 From 95a110aa79ffcdcb7f2db6a28ad54aa35c69d736 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Sun, 2 Nov 2025 02:29:33 +0100 Subject: [PATCH 08/19] impl --- .github/.gitignore | 1 + .../pcre2-adjust-sljit-directory.patch | 13 +++++++++ .github/scripts/download-bundled/pcre2.sh | 27 +++++++++++++++++-- .../verify-directory-unchanged.sh | 9 +++++-- 4 files changed, 46 insertions(+), 4 deletions(-) create mode 100644 .github/.gitignore create mode 100644 .github/scripts/download-bundled/pcre2-adjust-sljit-directory.patch diff --git a/.github/.gitignore b/.github/.gitignore new file mode 100644 index 0000000000000..69f1bf4530957 --- /dev/null +++ b/.github/.gitignore @@ -0,0 +1 @@ +!*.patch diff --git a/.github/scripts/download-bundled/pcre2-adjust-sljit-directory.patch b/.github/scripts/download-bundled/pcre2-adjust-sljit-directory.patch new file mode 100644 index 0000000000000..49696aa6190db --- /dev/null +++ b/.github/scripts/download-bundled/pcre2-adjust-sljit-directory.patch @@ -0,0 +1,13 @@ +diff --git a/ext/pcre/pcre2lib/pcre2_jit_compile.c b/ext/pcre/pcre2lib/pcre2_jit_compile.c +index 175eb68..7fd10d5 100644 +--- a/ext/pcre/pcre2lib/pcre2_jit_compile.c ++++ b/ext/pcre/pcre2lib/pcre2_jit_compile.c +@@ -82,7 +82,7 @@ pcre2_memctl *allocator = ((pcre2_memctl*)allocator_data); + allocator->free(ptr, allocator->memory_data); + } + +-#include "../deps/sljit/sljit_src/sljitLir.c" ++#include "sljit/sljitLir.c" + + #if defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED + #error Unsupported architecture diff --git a/.github/scripts/download-bundled/pcre2.sh b/.github/scripts/download-bundled/pcre2.sh index 8c7723295e3ef..c9e25c260b0b1 100755 --- a/.github/scripts/download-bundled/pcre2.sh +++ b/.github/scripts/download-bundled/pcre2.sh @@ -1,5 +1,5 @@ #!/bin/sh -set -e +set -ex cd "$(dirname "$0")/../../.." commit=b2bd4254b379b9d7dc9a3dda060a7e27009ccdff # 10.46 release @@ -8,6 +8,29 @@ git clone --recurse-submodules --revision=$commit https://github.com/PCRE2Projec rm -rf ext/pcre/pcre2lib cp -R /tmp/php-src-bundled/pcre2/src ext/pcre/pcre2lib +cp -R /tmp/php-src-bundled/pcre2/deps/sljit/sljit_src ext/pcre/pcre2lib/sljit cd ext/pcre/pcre2lib -git restore config.h + +# remove unneeded files +rm pcre2.h.in +rm pcre2_dftables.c +rm pcre2_fuzzsupport.c +rm pcre2_jit_test.c +rm pcre2demo.c +rm pcre2grep.c +rm pcre2posix.c +rm pcre2posix.h +rm pcre2posix_test.c +rm pcre2test.c + +# move renamed files +mv config.h.generic config.h +mv pcre2.h.generic pcre2.h +mv pcre2_chartables.c.dist pcre2_chartables.c + +# add extra files +git restore config.h # based on config.h.generic but with many changes + +# patch customized files +git apply -v ../../../.github/scripts/download-bundled/pcre2-adjust-sljit-directory.patch diff --git a/.github/scripts/download-bundled/verify-directory-unchanged.sh b/.github/scripts/download-bundled/verify-directory-unchanged.sh index 7e0e7ebcacda9..1a783ab693514 100755 --- a/.github/scripts/download-bundled/verify-directory-unchanged.sh +++ b/.github/scripts/download-bundled/verify-directory-unchanged.sh @@ -1,6 +1,11 @@ #!/bin/sh -set -e +set -ex cd "$(dirname "$0")/../../.." -cd $1 +cd "$1" + +# display overview of changed files +git status + +# display & detect all changes git add . -N && git diff --cached -a --exit-code . && git diff -a --exit-code . From 8d00dc378c67b2e73b458e3eb7134ddf3c7bf8dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Mon, 3 Nov 2025 16:25:57 +0100 Subject: [PATCH 09/19] run if download script changes --- .github/workflows/verify-bundled-files.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/verify-bundled-files.yml b/.github/workflows/verify-bundled-files.yml index a469c28ba92c0..b2eb66169d9f8 100644 --- a/.github/workflows/verify-bundled-files.yml +++ b/.github/workflows/verify-bundled-files.yml @@ -24,6 +24,7 @@ jobs: base: master filters: | pcre2: + - '.github/scripts/download-bundled/pcre2.sh' - 'ext/pcre/pcre2lib/**' - name: PCRE2 - Download From 8a9e8282aab437942db26680bf19896f1a66c7f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Mon, 3 Nov 2025 16:25:01 +0100 Subject: [PATCH 10/19] reference using tag --- .github/scripts/download-bundled/pcre2.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/scripts/download-bundled/pcre2.sh b/.github/scripts/download-bundled/pcre2.sh index c9e25c260b0b1..4ea9981260ddf 100755 --- a/.github/scripts/download-bundled/pcre2.sh +++ b/.github/scripts/download-bundled/pcre2.sh @@ -2,9 +2,9 @@ set -ex cd "$(dirname "$0")/../../.." -commit=b2bd4254b379b9d7dc9a3dda060a7e27009ccdff # 10.46 release +revision=refs/tags/pcre2-10.46 -git clone --recurse-submodules --revision=$commit https://github.com/PCRE2Project/pcre2.git /tmp/php-src-bundled/pcre2 +git clone --depth 1 --recurse-submodules --revision=$revision https://github.com/PCRE2Project/pcre2.git /tmp/php-src-bundled/pcre2 rm -rf ext/pcre/pcre2lib cp -R /tmp/php-src-bundled/pcre2/src ext/pcre/pcre2lib From 66c5bfacb947c3e3bef0a87bbcfea3482c1a6330 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Mon, 3 Nov 2025 21:39:01 +0100 Subject: [PATCH 11/19] dedup changed files testing --- .github/actions/verify-generated-files/action.yml | 3 +-- ...rify-directory-unchanged.sh => test-directory-unchanged.sh} | 3 +-- .github/workflows/verify-bundled-files.yml | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) rename .github/scripts/{download-bundled/verify-directory-unchanged.sh => test-directory-unchanged.sh} (82%) diff --git a/.github/actions/verify-generated-files/action.yml b/.github/actions/verify-generated-files/action.yml index 13f0cf9f128bb..79c49dbfcfffb 100644 --- a/.github/actions/verify-generated-files/action.yml +++ b/.github/actions/verify-generated-files/action.yml @@ -13,5 +13,4 @@ runs: ext/tokenizer/tokenizer_data_gen.php build/gen_stub.php -f --generate-optimizer-info --verify ext/phar/makestub.php - # Use the -a flag for a bug in git 2.46.0, which doesn't consider changed -diff files. - git add . -N && git diff -a --exit-code + .github/scripts/test-directory-unchanged.sh . diff --git a/.github/scripts/download-bundled/verify-directory-unchanged.sh b/.github/scripts/test-directory-unchanged.sh similarity index 82% rename from .github/scripts/download-bundled/verify-directory-unchanged.sh rename to .github/scripts/test-directory-unchanged.sh index 1a783ab693514..fc44b720feb3a 100755 --- a/.github/scripts/download-bundled/verify-directory-unchanged.sh +++ b/.github/scripts/test-directory-unchanged.sh @@ -1,8 +1,7 @@ #!/bin/sh set -ex -cd "$(dirname "$0")/../../.." -cd "$1" +cd "$(dirname "$0")/../../$1" # display overview of changed files git status diff --git a/.github/workflows/verify-bundled-files.yml b/.github/workflows/verify-bundled-files.yml index b2eb66169d9f8..d998679d91d98 100644 --- a/.github/workflows/verify-bundled-files.yml +++ b/.github/workflows/verify-bundled-files.yml @@ -33,4 +33,4 @@ jobs: - name: PCRE2 - Verify files if: ${{ !cancelled() && (steps.changes.outputs.pcre2 == 'true' || (github.event_name != 'push' && github.event_name != 'pull_request')) }} - run: .github/scripts/download-bundled/verify-directory-unchanged.sh ext/pcre/pcre2lib + run: .github/scripts/test-directory-unchanged.sh ext/pcre/pcre2lib From a120ad9c7e6f30e04a6bd608232b854853f533ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Tue, 4 Nov 2025 08:52:39 +0100 Subject: [PATCH 12/19] adjust to downgrade (PR 20380) --- .github/.gitignore | 1 - .../pcre2-adjust-sljit-directory.patch | 13 ------------- .github/scripts/download-bundled/pcre2.sh | 6 +----- ext/pcre/pcre2lib/pcre2.h | 2 +- 4 files changed, 2 insertions(+), 20 deletions(-) delete mode 100644 .github/.gitignore delete mode 100644 .github/scripts/download-bundled/pcre2-adjust-sljit-directory.patch diff --git a/.github/.gitignore b/.github/.gitignore deleted file mode 100644 index 69f1bf4530957..0000000000000 --- a/.github/.gitignore +++ /dev/null @@ -1 +0,0 @@ -!*.patch diff --git a/.github/scripts/download-bundled/pcre2-adjust-sljit-directory.patch b/.github/scripts/download-bundled/pcre2-adjust-sljit-directory.patch deleted file mode 100644 index 49696aa6190db..0000000000000 --- a/.github/scripts/download-bundled/pcre2-adjust-sljit-directory.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/ext/pcre/pcre2lib/pcre2_jit_compile.c b/ext/pcre/pcre2lib/pcre2_jit_compile.c -index 175eb68..7fd10d5 100644 ---- a/ext/pcre/pcre2lib/pcre2_jit_compile.c -+++ b/ext/pcre/pcre2lib/pcre2_jit_compile.c -@@ -82,7 +82,7 @@ pcre2_memctl *allocator = ((pcre2_memctl*)allocator_data); - allocator->free(ptr, allocator->memory_data); - } - --#include "../deps/sljit/sljit_src/sljitLir.c" -+#include "sljit/sljitLir.c" - - #if defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED - #error Unsupported architecture diff --git a/.github/scripts/download-bundled/pcre2.sh b/.github/scripts/download-bundled/pcre2.sh index 4ea9981260ddf..dc996277f1636 100755 --- a/.github/scripts/download-bundled/pcre2.sh +++ b/.github/scripts/download-bundled/pcre2.sh @@ -2,13 +2,12 @@ set -ex cd "$(dirname "$0")/../../.." -revision=refs/tags/pcre2-10.46 +revision=refs/tags/pcre2-10.44 git clone --depth 1 --recurse-submodules --revision=$revision https://github.com/PCRE2Project/pcre2.git /tmp/php-src-bundled/pcre2 rm -rf ext/pcre/pcre2lib cp -R /tmp/php-src-bundled/pcre2/src ext/pcre/pcre2lib -cp -R /tmp/php-src-bundled/pcre2/deps/sljit/sljit_src ext/pcre/pcre2lib/sljit cd ext/pcre/pcre2lib @@ -31,6 +30,3 @@ mv pcre2_chartables.c.dist pcre2_chartables.c # add extra files git restore config.h # based on config.h.generic but with many changes - -# patch customized files -git apply -v ../../../.github/scripts/download-bundled/pcre2-adjust-sljit-directory.patch diff --git a/ext/pcre/pcre2lib/pcre2.h b/ext/pcre/pcre2lib/pcre2.h index 46012bf0a8cf7..a322d9f2d56f9 100644 --- a/ext/pcre/pcre2lib/pcre2.h +++ b/ext/pcre/pcre2lib/pcre2.h @@ -318,7 +318,7 @@ pcre2_pattern_convert(). */ #define PCRE2_ERROR_ALPHA_ASSERTION_UNKNOWN 195 #define PCRE2_ERROR_SCRIPT_RUN_NOT_AVAILABLE 196 #define PCRE2_ERROR_TOO_MANY_CAPTURES 197 -#define PCRE2_ERROR_MISSING_OCTAL_DIGIT 198 +#define PCRE2_ERROR_CONDITION_ATOMIC_ASSERTION_EXPECTED 198 #define PCRE2_ERROR_BACKSLASH_K_IN_LOOKAROUND 199 From 0370530530ff76d3a1f971fa0d6d7e200eb8d0dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Wed, 5 Nov 2025 23:29:34 +0100 Subject: [PATCH 13/19] one step in favor of grouped output --- .github/workflows/verify-bundled-files.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/verify-bundled-files.yml b/.github/workflows/verify-bundled-files.yml index d998679d91d98..99c84f3e54771 100644 --- a/.github/workflows/verify-bundled-files.yml +++ b/.github/workflows/verify-bundled-files.yml @@ -27,10 +27,12 @@ jobs: - '.github/scripts/download-bundled/pcre2.sh' - 'ext/pcre/pcre2lib/**' - - name: PCRE2 - Download + - name: PCRE2 if: ${{ !cancelled() && (steps.changes.outputs.pcre2 == 'true' || (github.event_name != 'push' && github.event_name != 'pull_request')) }} - run: .github/scripts/download-bundled/pcre2.sh - - - name: PCRE2 - Verify files - if: ${{ !cancelled() && (steps.changes.outputs.pcre2 == 'true' || (github.event_name != 'push' && github.event_name != 'pull_request')) }} - run: .github/scripts/test-directory-unchanged.sh ext/pcre/pcre2lib + run: | + echo "::group::Download" + .github/scripts/download-bundled/pcre2.sh + echo "::endgroup::" + echo "::group::Verify files" + .github/scripts/test-directory-unchanged.sh ext/pcre/pcre2lib + echo "::endgroup::" From 6d6d4813b7fb0248dc8d7840df61470de98feaeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Wed, 5 Nov 2025 23:30:07 +0100 Subject: [PATCH 14/19] quote sh variable --- .github/scripts/download-bundled/pcre2.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/download-bundled/pcre2.sh b/.github/scripts/download-bundled/pcre2.sh index dc996277f1636..4e171073405b0 100755 --- a/.github/scripts/download-bundled/pcre2.sh +++ b/.github/scripts/download-bundled/pcre2.sh @@ -4,7 +4,7 @@ cd "$(dirname "$0")/../../.." revision=refs/tags/pcre2-10.44 -git clone --depth 1 --recurse-submodules --revision=$revision https://github.com/PCRE2Project/pcre2.git /tmp/php-src-bundled/pcre2 +git clone --depth 1 --recurse-submodules --revision="$revision" https://github.com/PCRE2Project/pcre2.git /tmp/php-src-bundled/pcre2 rm -rf ext/pcre/pcre2lib cp -R /tmp/php-src-bundled/pcre2/src ext/pcre/pcre2lib From c38a094c73528a1fd1e39fa8bfea450844147516 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Thu, 6 Nov 2025 01:22:03 +0100 Subject: [PATCH 15/19] add step name --- .github/workflows/verify-bundled-files.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/verify-bundled-files.yml b/.github/workflows/verify-bundled-files.yml index 99c84f3e54771..a400ed76b3090 100644 --- a/.github/workflows/verify-bundled-files.yml +++ b/.github/workflows/verify-bundled-files.yml @@ -18,7 +18,8 @@ jobs: - name: git checkout uses: actions/checkout@v5 - - uses: dorny/paths-filter@v3 + - name: Detect changed files + uses: dorny/paths-filter@v3 id: changes with: base: master From a1d59c6aa03319c802f0a6f0d5a0ae2e13627293 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Thu, 6 Nov 2025 01:44:22 +0100 Subject: [PATCH 16/19] improve directory diff script --- .github/scripts/test-directory-unchanged.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/scripts/test-directory-unchanged.sh b/.github/scripts/test-directory-unchanged.sh index fc44b720feb3a..1f81f296effc2 100755 --- a/.github/scripts/test-directory-unchanged.sh +++ b/.github/scripts/test-directory-unchanged.sh @@ -3,8 +3,12 @@ set -ex cd "$(dirname "$0")/../../$1" +# notify git about untracked files +# add -f to detect even ignored files +git add -N . + # display overview of changed files -git status +git status . -# display & detect all changes -git add . -N && git diff --cached -a --exit-code . && git diff -a --exit-code . +# display diff of working directory vs HEAD commit and set exit code +git diff -a --exit-code HEAD . From 2621136ed45526c4e20dacc4174b503d01020198 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Fri, 7 Nov 2025 16:29:16 +0100 Subject: [PATCH 17/19] address workflow feedback --- .github/workflows/verify-bundled-files.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/verify-bundled-files.yml b/.github/workflows/verify-bundled-files.yml index a400ed76b3090..b15e309608a7f 100644 --- a/.github/workflows/verify-bundled-files.yml +++ b/.github/workflows/verify-bundled-files.yml @@ -1,10 +1,10 @@ name: Verify Bundled Files on: - push: - pull_request: + push: ~ + pull_request: ~ schedule: - - cron: "0 1 * * *" + - cron: "0 1 * * *" workflow_dispatch: ~ permissions: @@ -13,7 +13,7 @@ permissions: jobs: VERIFY_BUNDLED_FILES: name: Verify Bundled Files - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: git checkout uses: actions/checkout@v5 @@ -29,7 +29,7 @@ jobs: - 'ext/pcre/pcre2lib/**' - name: PCRE2 - if: ${{ !cancelled() && (steps.changes.outputs.pcre2 == 'true' || (github.event_name != 'push' && github.event_name != 'pull_request')) }} + if: ${{ !cancelled() && (steps.changes.outputs.pcre2 == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') }} run: | echo "::group::Download" .github/scripts/download-bundled/pcre2.sh From 035a2350d0af8848c5f8514d7f7ced741e9a391f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Fri, 7 Nov 2025 16:38:38 +0100 Subject: [PATCH 18/19] comment after "git restore config.h" is enough --- .github/scripts/download-bundled/pcre2.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/download-bundled/pcre2.sh b/.github/scripts/download-bundled/pcre2.sh index 4e171073405b0..b43554206c929 100755 --- a/.github/scripts/download-bundled/pcre2.sh +++ b/.github/scripts/download-bundled/pcre2.sh @@ -12,6 +12,7 @@ cp -R /tmp/php-src-bundled/pcre2/src ext/pcre/pcre2lib cd ext/pcre/pcre2lib # remove unneeded files +rm config.h.generic rm pcre2.h.in rm pcre2_dftables.c rm pcre2_fuzzsupport.c @@ -24,7 +25,6 @@ rm pcre2posix_test.c rm pcre2test.c # move renamed files -mv config.h.generic config.h mv pcre2.h.generic pcre2.h mv pcre2_chartables.c.dist pcre2_chartables.c From 8448da616179e95823a4dbdcb54c587eda6d2a48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Sat, 8 Nov 2025 00:59:47 +0100 Subject: [PATCH 19/19] remove mention of unused "-f" option --- .github/scripts/test-directory-unchanged.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/scripts/test-directory-unchanged.sh b/.github/scripts/test-directory-unchanged.sh index 1f81f296effc2..0ce7fd4cc4afd 100755 --- a/.github/scripts/test-directory-unchanged.sh +++ b/.github/scripts/test-directory-unchanged.sh @@ -3,8 +3,7 @@ set -ex cd "$(dirname "$0")/../../$1" -# notify git about untracked files -# add -f to detect even ignored files +# notify git about untracked (except ignored) files git add -N . # display overview of changed files