Skip to content
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!*.patch
Original file line number Diff line number Diff line change
@@ -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
36 changes: 36 additions & 0 deletions .github/scripts/download-bundled/pcre2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/sh
set -ex
cd "$(dirname "$0")/../../.."

commit=b2bd4254b379b9d7dc9a3dda060a7e27009ccdff # 10.46 release

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
cp -R /tmp/php-src-bundled/pcre2/deps/sljit/sljit_src ext/pcre/pcre2lib/sljit

cd ext/pcre/pcre2lib

# 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
11 changes: 11 additions & 0 deletions .github/scripts/download-bundled/verify-directory-unchanged.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh
set -ex
cd "$(dirname "$0")/../../.."

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 .
35 changes: 35 additions & 0 deletions .github/workflows/verify-bundled-files.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
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/**'

- 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
2 changes: 1 addition & 1 deletion ext/pcre/pcre2lib/pcre2.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 3 additions & 9 deletions ext/pcre/pcre2lib/pcre2_chartables.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */

Expand All @@ -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
Expand Down Expand Up @@ -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 */
Expand Down
Loading