Skip to content

Commit a5bc5ae

Browse files
committed
Patch core for PCRE2 support
RFC https://wiki.php.net/rfc/pcre2-migration
1 parent fd463cf commit a5bc5ae

File tree

186 files changed

+39167
-125143
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

186 files changed

+39167
-125143
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -225,3 +225,4 @@ ext/sqlite3/tests/phpsql*
225225
!ext/fileinfo/libmagic.patch
226226
!ext/mbstring/oniguruma.patch
227227
!scripts/dev/generate-phpt/tests/*.php
228+
!ext/pcre/pcre2lib/config.h

ext/fileinfo/libmagic/funcs.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -471,11 +471,11 @@ file_replace(struct magic_set *ms, const char *pat, const char *rep)
471471
pcre_cache_entry *pce;
472472
zend_string *res;
473473
zend_string *repl;
474-
int rep_cnt = 0;
474+
size_t rep_cnt = 0;
475475

476476
(void)setlocale(LC_CTYPE, "C");
477477

478-
opts |= PCRE_MULTILINE;
478+
opts |= PCRE2_MULTILINE;
479479
convert_libmagic_pattern(&patt, (char*)pat, strlen(pat), opts);
480480
if ((pce = pcre_get_compiled_regex_cache(Z_STR(patt))) == NULL) {
481481
zval_ptr_dtor(&patt);

ext/fileinfo/libmagic/softmagic.c

+13-9
Original file line numberDiff line numberDiff line change
@@ -412,20 +412,24 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
412412
private int
413413
check_fmt(struct magic_set *ms, struct magic *m)
414414
{
415-
pcre *pce;
416-
int re_options, rv = -1;
417-
pcre_extra *re_extra;
415+
pcre2_code *pce;
416+
uint32_t re_options, capture_count;
417+
int rv = -1;
418418
zend_string *pattern;
419419

420420
if (strchr(m->desc, '%') == NULL)
421421
return 0;
422422

423423
(void)setlocale(LC_CTYPE, "C");
424424
pattern = zend_string_init("~%[-0-9.]*s~", sizeof("~%[-0-9.]*s~") - 1, 0);
425-
if ((pce = pcre_get_compiled_regex(pattern, &re_extra, &re_options)) == NULL) {
425+
if ((pce = pcre_get_compiled_regex(pattern, &capture_count, &re_options)) == NULL) {
426426
rv = -1;
427427
} else {
428-
rv = !pcre_exec(pce, re_extra, m->desc, strlen(m->desc), 0, re_options, NULL, 0);
428+
pcre2_match_data *match_data = php_pcre_create_match_data(capture_count, pce);
429+
if (match_data) {
430+
rv = pcre2_match(pce, m->desc, strlen(m->desc), 0, re_options, match_data, php_pcre_mctx()) > 0;
431+
php_pcre_free_match_data(match_data);
432+
}
429433
}
430434
zend_string_release(pattern);
431435
(void)setlocale(LC_CTYPE, "");
@@ -1725,10 +1729,10 @@ convert_libmagic_pattern(zval *pattern, char *val, int len, int options)
17251729
}
17261730
ZSTR_VAL(t)[j++] = '~';
17271731

1728-
if (options & PCRE_CASELESS)
1732+
if (options & PCRE2_CASELESS)
17291733
ZSTR_VAL(t)[j++] = 'i';
17301734

1731-
if (options & PCRE_MULTILINE)
1735+
if (options & PCRE2_MULTILINE)
17321736
ZSTR_VAL(t)[j++] = 'm';
17331737

17341738
ZSTR_VAL(t)[j]='\0';
@@ -1901,10 +1905,10 @@ magiccheck(struct magic_set *ms, struct magic *m)
19011905
int options = 0;
19021906
pcre_cache_entry *pce;
19031907

1904-
options |= PCRE_MULTILINE;
1908+
options |= PCRE2_MULTILINE;
19051909

19061910
if (m->str_flags & STRING_IGNORE_CASE) {
1907-
options |= PCRE_CASELESS;
1911+
options |= PCRE2_CASELESS;
19081912
}
19091913

19101914
convert_libmagic_pattern(&pattern, (char *)m->value.s, m->vallen, options);

ext/filter/logical_filters.c

+24-16
Original file line numberDiff line numberDiff line change
@@ -428,11 +428,10 @@ void php_filter_validate_regexp(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
428428
zval *option_val;
429429
zend_string *regexp;
430430
int regexp_set;
431-
pcre *re = NULL;
432-
pcre_extra *pcre_extra = NULL;
433-
int preg_options = 0;
434-
int ovector[3];
435-
int matches;
431+
pcre2_code *re = NULL;
432+
pcre2_match_data *match_data = NULL;
433+
uint32_t preg_options, capture_count;
434+
int rc;
436435

437436
/* Parse options */
438437
FETCH_STR_OPTION(regexp, "regexp");
@@ -442,14 +441,19 @@ void php_filter_validate_regexp(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
442441
RETURN_VALIDATION_FAILED
443442
}
444443

445-
re = pcre_get_compiled_regex(regexp, &pcre_extra, &preg_options);
444+
re = pcre_get_compiled_regex(regexp, &capture_count, &preg_options);
446445
if (!re) {
447446
RETURN_VALIDATION_FAILED
448447
}
449-
matches = pcre_exec(re, NULL, Z_STRVAL_P(value), (int)Z_STRLEN_P(value), 0, 0, ovector, 3);
448+
match_data = php_pcre_create_match_data(capture_count, re);
449+
if (!match_data) {
450+
RETURN_VALIDATION_FAILED
451+
}
452+
rc = pcre2_match(re, Z_STRVAL_P(value), Z_STRLEN_P(value), 0, preg_options, match_data, php_pcre_mctx());
453+
php_pcre_free_match_data(match_data);
450454

451455
/* 0 means that the vector is too small to hold all the captured substring offsets */
452-
if (matches < 0) {
456+
if (rc < 0) {
453457
RETURN_VALIDATION_FAILED
454458
}
455459
}
@@ -599,12 +603,11 @@ void php_filter_validate_email(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
599603
* Feel free to use and redistribute this code. But please keep this copyright notice.
600604
*
601605
*/
602-
pcre *re = NULL;
603-
pcre_extra *pcre_extra = NULL;
604-
int preg_options = 0;
605-
int ovector[150]; /* Needs to be a multiple of 3 */
606-
int matches;
606+
pcre2_code *re = NULL;
607+
pcre2_match_data *match_data = NULL;
608+
uint32_t preg_options = 0, capture_count;
607609
zend_string *sregexp;
610+
int rc;
608611
const char regexp0[] = "/^(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){255,})(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){65,}@)(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E\\pL\\pN]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F\\pL\\pN]|(?:\\x5C[\\x00-\\x7F]))*\\x22))(?:\\.(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E\\pL\\pN]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F\\pL\\pN]|(?:\\x5C[\\x00-\\x7F]))*\\x22)))*@(?:(?:(?!.*[^.]{64,})(?:(?:(?:xn--)?[a-z0-9]+(?:-+[a-z0-9]+)*\\.){1,126}){1,}(?:(?:[a-z][a-z0-9]*)|(?:(?:xn--)[a-z0-9]+))(?:-+[a-z0-9]+)*)|(?:\\[(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){7})|(?:(?!(?:.*[a-f0-9][:\\]]){7,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?)))|(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){5}:)|(?:(?!(?:.*[a-f0-9]:){5,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3}:)?)))?(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))(?:\\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))){3}))\\]))$/iDu";
609612
const char regexp1[] = "/^(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){255,})(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){65,}@)(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F]|(?:\\x5C[\\x00-\\x7F]))*\\x22))(?:\\.(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F]|(?:\\x5C[\\x00-\\x7F]))*\\x22)))*@(?:(?:(?!.*[^.]{64,})(?:(?:(?:xn--)?[a-z0-9]+(?:-+[a-z0-9]+)*\\.){1,126}){1,}(?:(?:[a-z][a-z0-9]*)|(?:(?:xn--)[a-z0-9]+))(?:-+[a-z0-9]+)*)|(?:\\[(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){7})|(?:(?!(?:.*[a-f0-9][:\\]]){7,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?)))|(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){5}:)|(?:(?!(?:.*[a-f0-9]:){5,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3}:)?)))?(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))(?:\\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))){3}))\\]))$/iD";
610613
const char *regexp;
@@ -624,16 +627,21 @@ void php_filter_validate_email(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
624627
}
625628

626629
sregexp = zend_string_init(regexp, regexp_len, 0);
627-
re = pcre_get_compiled_regex(sregexp, &pcre_extra, &preg_options);
630+
re = pcre_get_compiled_regex(sregexp, &capture_count, &preg_options);
628631
if (!re) {
629632
zend_string_release(sregexp);
630633
RETURN_VALIDATION_FAILED
631634
}
632635
zend_string_release(sregexp);
633-
matches = pcre_exec(re, NULL, Z_STRVAL_P(value), (int)Z_STRLEN_P(value), 0, 0, ovector, 3);
636+
match_data = php_pcre_create_match_data(capture_count, re);
637+
if (!match_data) {
638+
RETURN_VALIDATION_FAILED
639+
}
640+
rc = pcre2_match(re, Z_STRVAL_P(value), Z_STRLEN_P(value), 0, preg_options, match_data, php_pcre_mctx());
641+
php_pcre_free_match_data(match_data);
634642

635643
/* 0 means that the vector is too small to hold all the captured substring offsets */
636-
if (matches < 0) {
644+
if (rc < 0) {
637645
RETURN_VALIDATION_FAILED
638646
}
639647

ext/opcache/zend_accelerator_blacklist.c

+18-6
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
#define ZEND_BLACKLIST_BLOCK_SIZE 32
4444

4545
struct _zend_regexp_list {
46-
pcre *re;
46+
pcre2_code *re;
4747
zend_regexp_list *next;
4848
};
4949

@@ -73,10 +73,12 @@ static void blacklist_report_regexp_error(const char *pcre_error, int pcre_error
7373

7474
static void zend_accel_blacklist_update_regexp(zend_blacklist *blacklist)
7575
{
76-
const char *pcre_error;
77-
int i, pcre_error_offset;
76+
PCRE2_UCHAR pcre_error[256];
77+
int i, errnumber;
78+
PCRE2_SIZE pcre_error_offset;
7879
zend_regexp_list **regexp_list_it, *it;
7980
char regexp[12*1024], *p, *end, *c, *backtrack = NULL;
81+
pcre2_compile_context *cctx = php_pcre_cctx();
8082

8183
if (blacklist->pos == 0) {
8284
/* we have no blacklist to talk about */
@@ -177,8 +179,9 @@ static void zend_accel_blacklist_update_regexp(zend_blacklist *blacklist)
177179
}
178180
it->next = NULL;
179181

180-
if ((it->re = pcre_compile(regexp, PCRE_NO_AUTO_CAPTURE, &pcre_error, &pcre_error_offset, 0)) == NULL) {
182+
if ((it->re = pcre2_compile(regexp, PCRE2_ZERO_TERMINATED, PCRE2_NO_AUTO_CAPTURE, &errnumber, &pcre_error_offset, cctx)) == NULL) {
181183
free(it);
184+
pcre2_get_error_message(errnumber, pcre_error, sizeof(pcre_error));
182185
blacklist_report_regexp_error(pcre_error, pcre_error_offset);
183186
return;
184187
}
@@ -207,7 +210,7 @@ void zend_accel_blacklist_shutdown(zend_blacklist *blacklist)
207210
if (blacklist->regexp_list) {
208211
zend_regexp_list *temp, *it = blacklist->regexp_list;
209212
while (it) {
210-
pcre_free(it->re);
213+
pcre2_code_free(it->re);
211214
temp = it;
212215
it = it->next;
213216
free(temp);
@@ -338,15 +341,24 @@ zend_bool zend_accel_blacklist_is_blacklisted(zend_blacklist *blacklist, char *v
338341
{
339342
int ret = 0;
340343
zend_regexp_list *regexp_list_it = blacklist->regexp_list;
344+
pcre2_match_context *mctx = php_pcre_mctx();
341345

342346
if (regexp_list_it == NULL) {
343347
return 0;
344348
}
345349
while (regexp_list_it != NULL) {
346-
if (pcre_exec(regexp_list_it->re, NULL, verify_path, strlen(verify_path), 0, 0, NULL, 0) >= 0) {
350+
pcre2_match_data *match_data = php_pcre_create_match_data(0, regexp_list_it->re);
351+
if (!match_data) {
352+
/* Alloc failed, but next one could still come through and match. */
353+
continue;
354+
}
355+
int rc = pcre2_match(regexp_list_it->re, verify_path, strlen(verify_path), 0, 0, match_data, mctx);
356+
if (rc >= 0) {
347357
ret = 1;
358+
php_pcre_free_match_data(match_data);
348359
break;
349360
}
361+
php_pcre_free_match_data(match_data);
350362
regexp_list_it = regexp_list_it->next;
351363
}
352364
return ret;

ext/pcre/config.w32

+5-3
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22
// vim:ft=javascript
33

44
EXTENSION("pcre", "php_pcre.c", false /* never shared */,
5-
"-Iext/pcre/pcrelib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
6-
ADD_SOURCES("ext/pcre/pcrelib", "pcre_chartables.c pcre_ucd.c pcre_compile.c pcre_config.c pcre_exec.c pcre_fullinfo.c pcre_get.c pcre_globals.c pcre_maketables.c pcre_newline.c pcre_ord2utf8.c pcre_refcount.c pcre_study.c pcre_tables.c pcre_valid_utf8.c pcre_version.c pcre_xclass.c pcre_jit_compile.c", "pcre");
5+
"-Iext/pcre/pcre2lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
6+
ADD_SOURCES("ext/pcre/pcre2lib", "pcre2_auto_possess.c pcre2_chartables.c pcre2_compile.c pcre2_config.c pcre2_context.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 ", "pcre");
77
ADD_DEF_FILE("ext\\pcre\\php_pcre.def");
88

99
AC_DEFINE('HAVE_BUNDLED_PCRE', 1, 'Using bundled PCRE library');
1010
AC_DEFINE('HAVE_PCRE', 1, 'Have PCRE library');
11+
AC_DEFINE('PCRE2_CODE_UNIT_WIDTH', 8, 'Have PCRE library');
12+
AC_DEFINE("PCRE2_STATIC", 1, "");
1113
PHP_PCRE="yes";
12-
PHP_INSTALL_HEADERS("ext/pcre", "php_pcre.h pcrelib/");
14+
PHP_INSTALL_HEADERS("ext/pcre", "php_pcre.h pcre2lib/");
1315
ADD_FLAG("CFLAGS_PCRE", " /D HAVE_CONFIG_H");
1416

1517
ARG_WITH("pcre-jit", "Enable PCRE JIT support", "yes");

ext/pcre/config0.m4

+22-21
Original file line numberDiff line numberDiff line change
@@ -14,66 +14,67 @@ PHP_ARG_WITH(pcre-jit,,[ --with-pcre-jit Enable PCRE JIT functionality
1414
if test "$PHP_PCRE_REGEX" != "yes" && test "$PHP_PCRE_REGEX" != "no"; then
1515
AC_MSG_CHECKING([for PCRE headers location])
1616
for i in $PHP_PCRE_REGEX $PHP_PCRE_REGEX/include $PHP_PCRE_REGEX/include/pcre $PHP_PCRE_REGEX/local/include; do
17-
test -f $i/pcre.h && PCRE_INCDIR=$i
17+
test -f $i/pcre2.h && PCRE_INCDIR=$i
1818
done
1919

2020
if test -z "$PCRE_INCDIR"; then
21-
AC_MSG_ERROR([Could not find pcre.h in $PHP_PCRE_REGEX])
21+
AC_MSG_ERROR([Could not find pcre2.h in $PHP_PCRE_REGEX])
2222
fi
2323
AC_MSG_RESULT([$PCRE_INCDIR])
2424

2525
AC_MSG_CHECKING([for PCRE library location])
2626
for j in $PHP_PCRE_REGEX $PHP_PCRE_REGEX/$PHP_LIBDIR; do
27-
test -f $j/libpcre.a || test -f $j/libpcre.$SHLIB_SUFFIX_NAME && PCRE_LIBDIR=$j
27+
test -f $j/libpcre2.a || test -f $j/libpcre2.$SHLIB_SUFFIX_NAME && PCRE_LIBDIR=$j
2828
done
2929

3030
if test -z "$PCRE_LIBDIR" ; then
31-
AC_MSG_ERROR([Could not find libpcre.(a|$SHLIB_SUFFIX_NAME) in $PHP_PCRE_REGEX])
31+
AC_MSG_ERROR([Could not find libpcre2.(a|$SHLIB_SUFFIX_NAME) in $PHP_PCRE_REGEX])
3232
fi
3333
AC_MSG_RESULT([$PCRE_LIBDIR])
3434

3535
changequote({,})
36-
pcre_major=`grep PCRE_MAJOR $PCRE_INCDIR/pcre.h | sed -e 's/[^0-9]//g'`
37-
pcre_minor=`grep PCRE_MINOR $PCRE_INCDIR/pcre.h | sed -e 's/[^0-9]//g'`
36+
pcre_major=`grep PCRE2_MAJOR $PCRE_INCDIR/pcre2.h | sed -e 's/[^0-9]//g'`
37+
pcre_minor=`grep PCRE2_MINOR $PCRE_INCDIR/pcre2.h | sed -e 's/[^0-9]//g'`
3838
changequote([,])
3939
pcre_minor_length=`echo "$pcre_minor" | wc -c | sed -e 's/[^0-9]//g'`
4040
if test "$pcre_minor_length" -eq 2 ; then
4141
pcre_minor="$pcre_minor"0
4242
fi
4343
pcre_version=$pcre_major$pcre_minor
44-
if test "$pcre_version" -lt 660; then
45-
AC_MSG_ERROR([The PCRE extension requires PCRE library version >= 6.6])
44+
if test "$pcre_version" -lt 1030; then
45+
AC_MSG_ERROR([The PCRE extension requires PCRE library version >= 10.30])
4646
fi
4747

48-
PHP_CHECK_LIBRARY(pcre, pcre_jit_exec,
48+
PHP_CHECK_LIBRARY(pcre2, pcre2_jit_exec,
4949
[
5050
AC_DEFINE(HAVE_PCRE_JIT_SUPPORT, 1, [ ])
5151
],[
5252
],[
5353
-L$PCRE_LIBDIR
5454
])
55-
PHP_ADD_LIBRARY_WITH_PATH(pcre, $PCRE_LIBDIR)
55+
PHP_ADD_LIBRARY_WITH_PATH(pcre2, $PCRE_LIBDIR)
5656

5757
AC_DEFINE(HAVE_PCRE, 1, [ ])
58+
AC_DEFINE(PCRE2_CODE_UNIT_WIDTH, 8, [ ])
5859
PHP_ADD_INCLUDE($PCRE_INCDIR)
5960
PHP_NEW_EXTENSION(pcre, php_pcre.c, no,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
6061
PHP_INSTALL_HEADERS([ext/pcre], [php_pcre.h])
6162
else
6263
AC_MSG_CHECKING([for PCRE library to use])
6364
AC_MSG_RESULT([bundled])
64-
pcrelib_sources="pcrelib/pcre_chartables.c pcrelib/pcre_ucd.c \
65-
pcrelib/pcre_compile.c pcrelib/pcre_config.c pcrelib/pcre_exec.c \
66-
pcrelib/pcre_fullinfo.c pcrelib/pcre_get.c pcrelib/pcre_globals.c \
67-
pcrelib/pcre_maketables.c pcrelib/pcre_newline.c \
68-
pcrelib/pcre_ord2utf8.c pcrelib/pcre_refcount.c pcrelib/pcre_study.c \
69-
pcrelib/pcre_tables.c pcrelib/pcre_valid_utf8.c \
70-
pcrelib/pcre_version.c pcrelib/pcre_xclass.c \
71-
pcrelib/pcre_jit_compile.c"
72-
PHP_PCRE_CFLAGS="-DHAVE_CONFIG_H -I@ext_srcdir@/pcrelib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
65+
pcrelib_sources="pcre2lib/pcre2_auto_possess.c pcre2lib/pcre2_chartables.c pcre2lib/pcre2_compile.c \
66+
pcre2lib/pcre2_config.c pcre2lib/pcre2_context.c pcre2lib/pcre2_dfa_match.c pcre2lib/pcre2_error.c \
67+
pcre2lib/pcre2_jit_compile.c pcre2lib/pcre2_maketables.c pcre2lib/pcre2_match.c pcre2lib/pcre2_match_data.c \
68+
pcre2lib/pcre2_newline.c pcre2lib/pcre2_ord2utf.c pcre2lib/pcre2_pattern_info.c pcre2lib/pcre2_serialize.c \
69+
pcre2lib/pcre2_string_utils.c pcre2lib/pcre2_study.c pcre2lib/pcre2_substitute.c pcre2lib/pcre2_substring.c \
70+
pcre2lib/pcre2_tables.c pcre2lib/pcre2_ucd.c pcre2lib/pcre2_valid_utf.c pcre2lib/pcre2_xclass.c \
71+
pcre2lib/pcre2_find_bracket.c pcre2lib/pcre2_convert.c"
72+
PHP_PCRE_CFLAGS="-DHAVE_CONFIG_H -I@ext_srcdir@/pcre2lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
7373
PHP_NEW_EXTENSION(pcre, $pcrelib_sources php_pcre.c, no,,$PHP_PCRE_CFLAGS)
74-
PHP_ADD_BUILD_DIR($ext_builddir/pcrelib)
75-
PHP_INSTALL_HEADERS([ext/pcre], [php_pcre.h pcrelib/])
74+
PHP_ADD_BUILD_DIR($ext_builddir/pcre2lib)
75+
PHP_INSTALL_HEADERS([ext/pcre], [php_pcre.h pcre2lib/])
7676
AC_DEFINE(HAVE_BUNDLED_PCRE, 1, [ ])
77+
AC_DEFINE(PCRE2_CODE_UNIT_WIDTH, 8, [ ])
7778

7879
if test "$PHP_PCRE_REGEX" != "no"; then
7980
AC_MSG_CHECKING([whether to enable PCRE JIT functionality])

0 commit comments

Comments
 (0)