Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
9 changes: 8 additions & 1 deletion .github/scripts/download-bundled/pcre2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,20 @@ cd "$(dirname "$0")/../../.."
tmp_dir=/tmp/php-src-download-bundled/pcre2
rm -rf "$tmp_dir"

revision=refs/tags/pcre2-10.44
revision=refs/tags/pcre2-10.49

git clone --depth 1 --recurse-submodules --revision="$revision" https://github.com/PCRE2Project/pcre2.git "$tmp_dir"

rm -rf ext/pcre/pcre2lib
cp -R "$tmp_dir"/src ext/pcre/pcre2lib
cp -R "$tmp_dir"/deps/sljit/sljit_src ext/pcre/pcre2lib/sljit
sed 's|"../deps/sljit/sljit_src/sljitLir.c"|"sljit/sljitLir.c"|' \
"$tmp_dir"/src/pcre2_jit_compile.c > ext/pcre/pcre2lib/pcre2_jit_compile.c

cd ext/pcre/pcre2lib

# remove unneeded files
rm config-cmake.h.in
rm config.h.generic
rm pcre2.h.in
rm pcre2_dftables.c
Expand All @@ -26,6 +30,9 @@ rm pcre2posix.c
rm pcre2posix.h
rm pcre2posix_test.c
rm pcre2test.c
rm pcre2test_inc.h
rm pcre2_chartables.c.ebcdic-*
rm libpcre2-*.sym.in

# move renamed files
mv pcre2.h.generic pcre2.h
Expand Down
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ PHP NEWS
. Fixed OSS-Fuzz #545352966 (default value AST of an SHM-persisted partial).
(ndossche)

- PCRE:
. Upgraded bundled PCRE2 to 10.49. (Ilia Alshanetsky)

- PDO:
. Fixed PDOStatement::getColumnMeta() reading out of bounds for an invalid
column index. (Ilia Alshanetsky)
Expand Down
2 changes: 1 addition & 1 deletion ext/pcre/config.w32
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

EXTENSION("pcre", "php_pcre.c", false /* never shared */,
"-Iext/pcre/pcre2lib");
ADD_SOURCES("ext/pcre/pcre2lib", "pcre2_auto_possess.c pcre2_chartables.c pcre2_compile.c pcre2_config.c pcre2_context.c pcre2_chkdint.c pcre2_dfa_match.c pcre2_error.c pcre2_jit_compile.c pcre2_maketables.c pcre2_match.c pcre2_match_data.c pcre2_newline.c pcre2_ord2utf.c pcre2_pattern_info.c pcre2_serialize.c pcre2_string_utils.c pcre2_study.c pcre2_substitute.c pcre2_substring.c pcre2_tables.c pcre2_ucd.c pcre2_valid_utf.c pcre2_xclass.c pcre2_find_bracket.c pcre2_convert.c pcre2_extuni.c pcre2_script_run.c", "pcre");
ADD_SOURCES("ext/pcre/pcre2lib", "pcre2_auto_possess.c pcre2_chartables.c pcre2_compile.c pcre2_compile_cgroup.c pcre2_compile_class.c pcre2_config.c pcre2_context.c pcre2_chkdint.c pcre2_dfa_match.c pcre2_error.c pcre2_jit_compile.c pcre2_maketables.c pcre2_match.c pcre2_match_data.c pcre2_match_next.c pcre2_newline.c pcre2_ord2utf.c pcre2_pattern_info.c pcre2_serialize.c pcre2_string_utils.c pcre2_study.c pcre2_substitute.c pcre2_substring.c pcre2_tables.c pcre2_ucd.c pcre2_valid_utf.c pcre2_xclass.c pcre2_find_bracket.c pcre2_convert.c pcre2_extuni.c pcre2_script_run.c", "pcre");
ADD_DEF_FILE("ext\\pcre\\php_pcre.def");

AC_DEFINE('HAVE_BUNDLED_PCRE', 1, 'Define to 1 if PHP uses the bundled PCRE library.');
Expand Down
3 changes: 3 additions & 0 deletions ext/pcre/config0.m4
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ else
pcre2lib/pcre2_chartables.c
pcre2lib/pcre2_chkdint.c
pcre2lib/pcre2_compile.c
pcre2lib/pcre2_compile_cgroup.c
pcre2lib/pcre2_compile_class.c
pcre2lib/pcre2_config.c
pcre2lib/pcre2_context.c
pcre2lib/pcre2_convert.c
Expand All @@ -78,6 +80,7 @@ else
pcre2lib/pcre2_maketables.c
pcre2lib/pcre2_match_data.c
pcre2lib/pcre2_match.c
pcre2lib/pcre2_match_next.c
pcre2lib/pcre2_newline.c
pcre2lib/pcre2_ord2utf.c
pcre2lib/pcre2_pattern_info.c
Expand Down
118 changes: 94 additions & 24 deletions ext/pcre/pcre2lib/pcre2.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,40 +42,37 @@ POSSIBILITY OF SUCH DAMAGE.
/* The current PCRE version information. */

#define PCRE2_MAJOR 10
#define PCRE2_MINOR 44
#define PCRE2_MINOR 49
#define PCRE2_PRERELEASE
#define PCRE2_DATE 2024-06-07
#define PCRE2_DATE 2026-09-28

/* When an application links to a PCRE DLL in Windows, the symbols that are
/* When an application links to a PCRE2 DLL in Windows, the symbols that are
imported have to be identified as such. When building PCRE2, the appropriate
export setting is defined in pcre2_internal.h, which includes this file. So we
don't change existing definitions of PCRE2_EXP_DECL. */
export setting is defined in pcre2_internal.h, which includes this file. So, we
don't change existing definitions of PCRE2_EXP_DECL.

#if defined(_WIN32) && !defined(PCRE2_STATIC)
# ifndef PCRE2_EXP_DECL
# define PCRE2_EXP_DECL extern __declspec(dllimport)
# endif
#endif

/* By default, we use the standard "extern" declarations. */
By default, we use the standard "extern" declarations. */

#ifndef PCRE2_EXP_DECL
# ifdef __cplusplus
# if defined(_WIN32) && !defined(PCRE2_STATIC)
# define PCRE2_EXP_DECL extern __declspec(dllimport)
# elif defined __cplusplus
# define PCRE2_EXP_DECL extern "C"
# else
# define PCRE2_EXP_DECL extern
# endif
#endif

/* When compiling with the MSVC compiler, it is sometimes necessary to include
a "calling convention" before exported function names. (This is secondhand
information; I know nothing about MSVC myself). For example, something like
a "calling convention" before exported function names. For example:

void __cdecl function(....)

might be needed. In order so make this easy, all the exported functions have
PCRE2_CALL_CONVENTION just before their names. It is rarely needed; if not
set, we ensure here that it has no effect. */
might be needed. In order to make this easy, all the exported functions have
PCRE2_CALL_CONVENTION just before their names.

PCRE2 normally uses the platform's standard calling convention, so this should
not be set unless you know you need it. */

#ifndef PCRE2_CALL_CONVENTION
#define PCRE2_CALL_CONVENTION
Expand Down Expand Up @@ -143,6 +140,7 @@ D is inspected during pcre2_dfa_match() execution
#define PCRE2_EXTENDED_MORE 0x01000000u /* C */
#define PCRE2_LITERAL 0x02000000u /* C */
#define PCRE2_MATCH_INVALID_UTF 0x04000000u /* J M D */
#define PCRE2_ALT_EXTENDED_CLASS 0x08000000u /* C */

/* An additional compile options word is available in the compile context. */

Expand All @@ -159,13 +157,18 @@ D is inspected during pcre2_dfa_match() execution
#define PCRE2_EXTRA_ASCII_BSW 0x00000400u /* C */
#define PCRE2_EXTRA_ASCII_POSIX 0x00000800u /* C */
#define PCRE2_EXTRA_ASCII_DIGIT 0x00001000u /* C */
#define PCRE2_EXTRA_PYTHON_OCTAL 0x00002000u /* C */
#define PCRE2_EXTRA_NO_BS0 0x00004000u /* C */
#define PCRE2_EXTRA_NEVER_CALLOUT 0x00008000u /* C */
#define PCRE2_EXTRA_TURKISH_CASING 0x00010000u /* C */

/* These are for pcre2_jit_compile(). */

#define PCRE2_JIT_COMPLETE 0x00000001u /* For full matching */
#define PCRE2_JIT_PARTIAL_SOFT 0x00000002u
#define PCRE2_JIT_PARTIAL_HARD 0x00000004u
#define PCRE2_JIT_INVALID_UTF 0x00000100u
#define PCRE2_JIT_TEST_ALLOC 0x00000200u

/* These are for pcre2_match(), pcre2_dfa_match(), pcre2_jit_match(), and
pcre2_substitute(). Some are allowed only for one of the functions, and in
Expand Down Expand Up @@ -318,9 +321,29 @@ 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
#define PCRE2_ERROR_OVERSIZE_PYTHON_OCTAL 202
#define PCRE2_ERROR_CALLOUT_CALLER_DISABLED 203
#define PCRE2_ERROR_EXTRA_CASING_REQUIRES_UNICODE 204
#define PCRE2_ERROR_TURKISH_CASING_REQUIRES_UTF 205
#define PCRE2_ERROR_EXTRA_CASING_INCOMPATIBLE 206
#define PCRE2_ERROR_ECLASS_NEST_TOO_DEEP 207
#define PCRE2_ERROR_ECLASS_INVALID_OPERATOR 208
#define PCRE2_ERROR_ECLASS_UNEXPECTED_OPERATOR 209
#define PCRE2_ERROR_ECLASS_EXPECTED_OPERAND 210
#define PCRE2_ERROR_ECLASS_MIXED_OPERATORS 211
#define PCRE2_ERROR_ECLASS_HINT_SQUARE_BRACKET 212
#define PCRE2_ERROR_PERL_ECLASS_UNEXPECTED_EXPR 213
#define PCRE2_ERROR_PERL_ECLASS_EMPTY_EXPR 214
#define PCRE2_ERROR_PERL_ECLASS_MISSING_CLOSE 215
#define PCRE2_ERROR_PERL_ECLASS_UNEXPECTED_CHAR 216
#define PCRE2_ERROR_EXPECTED_CAPTURE_GROUP 217
#define PCRE2_ERROR_MISSING_OPENING_PARENTHESIS 218
#define PCRE2_ERROR_MISSING_NUMBER_TERMINATOR 219
#define PCRE2_ERROR_NULL_ERROROFFSET 220

/* "Expected" matching error codes: no match and partial match. */

Expand Down Expand Up @@ -407,6 +430,15 @@ released, the numbers must not be changed. */
#define PCRE2_ERROR_INTERNAL_DUPMATCH (-65)
#define PCRE2_ERROR_DFA_UINVALID_UTF (-66)
#define PCRE2_ERROR_INVALIDOFFSET (-67)
#define PCRE2_ERROR_JIT_UNSUPPORTED (-68)
#define PCRE2_ERROR_REPLACECASE (-69)
#define PCRE2_ERROR_TOOLARGEREPLACE (-70)
#define PCRE2_ERROR_DIFFSUBSPATTERN (-71)
#define PCRE2_ERROR_DIFFSUBSSUBJECT (-72)
#define PCRE2_ERROR_DIFFSUBSOFFSET (-73)
#define PCRE2_ERROR_DIFFSUBSOPTIONS (-74)
#define PCRE2_ERROR_BAD_BACKSLASH_K (-75)
#define PCRE2_ERROR_PARTIALSUBS (-76)


/* Request types for pcre2_pattern_info() */
Expand Down Expand Up @@ -459,7 +491,32 @@ released, the numbers must not be changed. */
#define PCRE2_CONFIG_NEVER_BACKSLASH_C 13
#define PCRE2_CONFIG_COMPILED_WIDTHS 14
#define PCRE2_CONFIG_TABLES_LENGTH 15
#define PCRE2_CONFIG_EFFECTIVE_LINKSIZE 16

/* Optimization directives for pcre2_set_optimize().
For binary compatibility, only add to this list; do not renumber. */

#define PCRE2_OPTIMIZATION_NONE 0
#define PCRE2_OPTIMIZATION_FULL 1

#define PCRE2_AUTO_POSSESS 64
#define PCRE2_AUTO_POSSESS_OFF 65
#define PCRE2_DOTSTAR_ANCHOR 66
#define PCRE2_DOTSTAR_ANCHOR_OFF 67
#define PCRE2_START_OPTIMIZE 68
#define PCRE2_START_OPTIMIZE_OFF 69

/* Types used in pcre2_set_substitute_case_callout().

PCRE2_SUBSTITUTE_CASE_LOWER and PCRE2_SUBSTITUTE_CASE_UPPER are passed to the
callout to indicate that the case of the entire callout input should be
case-transformed. PCRE2_SUBSTITUTE_CASE_TITLE_FIRST is passed to indicate that
only the first character or glyph should be transformed to Unicode titlecase,
and the rest to lowercase. */

#define PCRE2_SUBSTITUTE_CASE_LOWER 1
#define PCRE2_SUBSTITUTE_CASE_UPPER 2
#define PCRE2_SUBSTITUTE_CASE_TITLE_FIRST 3

/* Types for code units in patterns and subject strings. */

Expand Down Expand Up @@ -613,7 +670,9 @@ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
pcre2_set_parens_nest_limit(pcre2_compile_context *, uint32_t); \
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
pcre2_set_compile_recursion_guard(pcre2_compile_context *, \
int (*)(uint32_t, void *), void *);
int (*)(uint32_t, void *), void *); \
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
pcre2_set_optimize(pcre2_compile_context *, uint32_t);

#define PCRE2_MATCH_CONTEXT_FUNCTIONS \
PCRE2_EXP_DECL pcre2_match_context *PCRE2_CALL_CONVENTION \
Expand All @@ -628,6 +687,11 @@ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
pcre2_set_substitute_callout(pcre2_match_context *, \
int (*)(pcre2_substitute_callout_block *, void *), void *); \
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
pcre2_set_substitute_case_callout(pcre2_match_context *, \
PCRE2_SIZE (*)(PCRE2_SPTR, PCRE2_SIZE, PCRE2_UCHAR *, PCRE2_SIZE, int, \
void *), \
void *); \
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
pcre2_set_depth_limit(pcre2_match_context *, uint32_t); \
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
Expand Down Expand Up @@ -687,14 +751,14 @@ PCRE2_EXP_DECL pcre2_match_data *PCRE2_CALL_CONVENTION \
PCRE2_EXP_DECL pcre2_match_data *PCRE2_CALL_CONVENTION \
pcre2_match_data_create_from_pattern(const pcre2_code *, \
pcre2_general_context *); \
PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
pcre2_match_data_free(pcre2_match_data *); \
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
pcre2_dfa_match(const pcre2_code *, PCRE2_SPTR, PCRE2_SIZE, PCRE2_SIZE, \
uint32_t, pcre2_match_data *, pcre2_match_context *, int *, PCRE2_SIZE); \
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
pcre2_match(const pcre2_code *, PCRE2_SPTR, PCRE2_SIZE, PCRE2_SIZE, \
uint32_t, pcre2_match_data *, pcre2_match_context *); \
PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
pcre2_match_data_free(pcre2_match_data *); \
PCRE2_EXP_DECL PCRE2_SPTR PCRE2_CALL_CONVENTION \
pcre2_get_mark(pcre2_match_data *); \
PCRE2_EXP_DECL PCRE2_SIZE PCRE2_CALL_CONVENTION \
Expand All @@ -706,7 +770,9 @@ PCRE2_EXP_DECL uint32_t PCRE2_CALL_CONVENTION \
PCRE2_EXP_DECL PCRE2_SIZE *PCRE2_CALL_CONVENTION \
pcre2_get_ovector_pointer(pcre2_match_data *); \
PCRE2_EXP_DECL PCRE2_SIZE PCRE2_CALL_CONVENTION \
pcre2_get_startchar(pcre2_match_data *);
pcre2_get_startchar(pcre2_match_data *); \
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
pcre2_next_match(pcre2_match_data *, PCRE2_SIZE *, uint32_t *);


/* Convenience functions for handling matched substrings. */
Expand Down Expand Up @@ -740,6 +806,7 @@ PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
pcre2_substring_list_get(pcre2_match_data *, PCRE2_UCHAR ***, PCRE2_SIZE **);


/* Functions for serializing / deserializing compiled patterns. */

#define PCRE2_SERIALIZE_FUNCTIONS \
Expand Down Expand Up @@ -885,6 +952,7 @@ pcre2_compile are called by application code. */
#define pcre2_match_data_create PCRE2_SUFFIX(pcre2_match_data_create_)
#define pcre2_match_data_create_from_pattern PCRE2_SUFFIX(pcre2_match_data_create_from_pattern_)
#define pcre2_match_data_free PCRE2_SUFFIX(pcre2_match_data_free_)
#define pcre2_next_match PCRE2_SUFFIX(pcre2_next_match_)
#define pcre2_pattern_convert PCRE2_SUFFIX(pcre2_pattern_convert_)
#define pcre2_pattern_info PCRE2_SUFFIX(pcre2_pattern_info_)
#define pcre2_serialize_decode PCRE2_SUFFIX(pcre2_serialize_decode_)
Expand All @@ -907,7 +975,9 @@ pcre2_compile are called by application code. */
#define pcre2_set_newline PCRE2_SUFFIX(pcre2_set_newline_)
#define pcre2_set_parens_nest_limit PCRE2_SUFFIX(pcre2_set_parens_nest_limit_)
#define pcre2_set_offset_limit PCRE2_SUFFIX(pcre2_set_offset_limit_)
#define pcre2_set_optimize PCRE2_SUFFIX(pcre2_set_optimize_)
#define pcre2_set_substitute_callout PCRE2_SUFFIX(pcre2_set_substitute_callout_)
#define pcre2_set_substitute_case_callout PCRE2_SUFFIX(pcre2_set_substitute_case_callout_)
#define pcre2_substitute PCRE2_SUFFIX(pcre2_substitute_)
#define pcre2_substring_copy_byname PCRE2_SUFFIX(pcre2_substring_copy_byname_)
#define pcre2_substring_copy_bynumber PCRE2_SUFFIX(pcre2_substring_copy_bynumber_)
Expand Down
Loading
Loading