]> TLD Linux GIT Repositories - packages/php.git/blob - pcre-shared.patch
- updated to 7.2.34
[packages/php.git] / pcre-shared.patch
1 diff -urN php-7.2.25.orig/ext/pcre/config0.m4 php-7.2.25/ext/pcre/config0.m4
2 --- php-7.2.25.orig/ext/pcre/config0.m4 2019-12-12 23:55:51.061000000 +0100
3 +++ php-7.2.25/ext/pcre/config0.m4      2019-12-12 23:56:02.320000000 +0100
4 @@ -13,7 +13,7 @@
5  
6    if test "$PHP_PCRE_REGEX" != "yes" && test "$PHP_PCRE_REGEX" != "no"; then
7      AC_MSG_CHECKING([for PCRE headers location])
8 -    for i in $PHP_PCRE_REGEX $PHP_PCRE_REGEX/include $PHP_PCRE_REGEX/include/pcre $PHP_PCRE_REGEX/local/include; do
9 +    for i in $PHP_PCRE_REGEX $PHP_PCRE_REGEX/include $PHP_PCRE_REGEX/include/pcre $PHP_PCRE_REGEX/local/include /usr/include; do
10        test -f $i/pcre.h && PCRE_INCDIR=$i
11      done
12  
13 @@ -23,7 +23,7 @@
14      AC_MSG_RESULT([$PCRE_INCDIR])
15  
16      AC_MSG_CHECKING([for PCRE library location])
17 -    for j in $PHP_PCRE_REGEX $PHP_PCRE_REGEX/$PHP_LIBDIR; do
18 +    for j in $PHP_PCRE_REGEX $PHP_PCRE_REGEX/$PHP_LIBDIR /usr/$PHP_LIBDIR; do
19        test -f $j/libpcre.a || test -f $j/libpcre.$SHLIB_SUFFIX_NAME && PCRE_LIBDIR=$j
20      done
21  
22 @@ -52,12 +52,13 @@
23      ],[
24        -L$PCRE_LIBDIR
25      ])
26 -    PHP_ADD_LIBRARY_WITH_PATH(pcre, $PCRE_LIBDIR)
27 +    PHP_ADD_LIBRARY_WITH_PATH(pcre, $PCRE_LIBDIR, PCRE_SHARED_LIBADD)
28  
29      AC_DEFINE(HAVE_PCRE, 1, [ ])
30      PHP_ADD_INCLUDE($PCRE_INCDIR)
31 -    PHP_NEW_EXTENSION(pcre, php_pcre.c, no,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
32 +    PHP_NEW_EXTENSION(pcre, php_pcre.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
33      PHP_INSTALL_HEADERS([ext/pcre], [php_pcre.h])
34 +    EXTRA_LIBS="$EXTRA_LIBS -lpcre"
35    else
36      AC_MSG_CHECKING([for PCRE library to use])
37      AC_MSG_RESULT([bundled])
38 @@ -70,7 +71,7 @@
39                                  pcrelib/pcre_version.c pcrelib/pcre_xclass.c \
40                                  pcrelib/pcre_jit_compile.c"
41      PHP_PCRE_CFLAGS="-DHAVE_CONFIG_H -I@ext_srcdir@/pcrelib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
42 -    PHP_NEW_EXTENSION(pcre, $pcrelib_sources php_pcre.c, no,,$PHP_PCRE_CFLAGS)
43 +    PHP_NEW_EXTENSION(pcre, $pcrelib_sources php_pcre.c, $ext_shared,,$PHP_PCRE_CFLAGS)
44      PHP_ADD_BUILD_DIR($ext_builddir/pcrelib)
45      PHP_INSTALL_HEADERS([ext/pcre], [php_pcre.h pcrelib/])
46      AC_DEFINE(HAVE_BUNDLED_PCRE, 1, [ ])
47 diff -urN php-7.2.25.orig/ext/pcre/php_pcre.c php-7.2.25/ext/pcre/php_pcre.c
48 --- php-7.2.25.orig/ext/pcre/php_pcre.c 2019-12-12 23:55:51.061000000 +0100
49 +++ php-7.2.25/ext/pcre/php_pcre.c      2019-12-12 23:56:02.320000000 +0100
50 @@ -21,6 +21,9 @@
51  #include "php.h"
52  #include "php_ini.h"
53  #include "php_globals.h"
54 +#if COMPILE_DL_PCRE
55 +#define COMPILE_DL_PCRE_NOREDIRECT
56 +#endif
57  #include "php_pcre.h"
58  #include "ext/standard/info.h"
59  #include "ext/standard/basic_functions.h"
60 @@ -222,6 +225,14 @@
61         REGISTER_LONG_CONSTANT("PREG_JIT_STACKLIMIT_ERROR", PHP_PCRE_JIT_STACKLIMIT_ERROR, CONST_CS | CONST_PERSISTENT);
62         REGISTER_STRING_CONSTANT("PCRE_VERSION", (char *)pcre_version(), CONST_CS | CONST_PERSISTENT);
63  
64 +#if COMPILE_DL_PCRE
65 +       pcre_get_compiled_regex_p = pcre_get_compiled_regex;
66 +       pcre_get_compiled_regex_cache_p = pcre_get_compiled_regex_cache;
67 +       php_pcre_replace_impl_p = php_pcre_replace_impl;
68 +       php_pcre_match_impl_p = php_pcre_match_impl;
69 +       php_pcre_split_impl_p = php_pcre_split_impl;
70 +#endif
71 +
72         return SUCCESS;
73  }
74  /* }}} */
75 diff -urN php-7.2.25.orig/ext/pcre/php_pcre.h php-7.2.25/ext/pcre/php_pcre.h
76 --- php-7.2.25.orig/ext/pcre/php_pcre.h 2019-12-12 23:55:51.061000000 +0100
77 +++ php-7.2.25/ext/pcre/php_pcre.h      2019-12-12 23:56:56.743000000 +0100
78 @@ -33,7 +33,29 @@
79  #include <locale.h>
80  #endif
81  
82 +#if !defined(COMPILE_DL_PCRE_NOREDIRECT)
83 +#define pcre_get_compiled_regex (*pcre_get_compiled_regex_p)
84 +#define pcre_get_compiled_regex_cache (*pcre_get_compiled_regex_cache_p)
85 +#define php_pcre_replace_impl (*php_pcre_replace_impl_p)
86 +#define php_pcre_match_impl (*php_pcre_match_impl_p)
87 +#define php_pcre_split_impl (*php_pcre_split_impl_p)
88 +#if !defined(COMPILE_DL_PCRE_NOEXTERN)
89 +#      define PCRE_EXTERN extern
90 +#else
91 +#      define PCRE_EXTERN
92 +#endif
93 +#else
94 +// for pcre.c
95 +#define PCRE_EXTERN
96 +extern void *pcre_get_compiled_regex_p;
97 +extern void *pcre_get_compiled_regex_cache_p;
98 +extern void *php_pcre_replace_impl_p;
99 +extern void *php_pcre_match_impl_p;
100 +extern void *php_pcre_split_impl_p;
101 +#endif
102 +
103  PHPAPI zend_string *php_pcre_replace(zend_string *regex, zend_string *subject_str, char *subject, int subject_len, zend_string *replace_str, int limit, int *replace_count);
104 +PCRE_EXTERN
105  PHPAPI pcre* pcre_get_compiled_regex(zend_string *regex, pcre_extra **extra, int *options);
106  PHPAPI pcre* pcre_get_compiled_regex_ex(zend_string *regex, pcre_extra **extra, int *preg_options, int *coptions);
107  
108 @@ -56,15 +78,19 @@
109         int refcount;
110  } pcre_cache_entry;
111  
112 +PCRE_EXTERN
113  PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex);
114  PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache_ex(zend_string *regex, int locale_aware);
115  
116 +PCRE_EXTERN
117  PHPAPI void  php_pcre_match_impl(  pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value,
118         zval *subpats, int global, int use_flags, zend_long flags, zend_long start_offset);
119  
120 +PCRE_EXTERN
121  PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, zend_string *subject_str, char *subject, int subject_len, zend_string *replace_str,
122         int limit, int *replace_count);
123  
124 +PCRE_EXTERN
125  PHPAPI void  php_pcre_split_impl(  pcre_cache_entry *pce, zend_string *subject_str, zval *return_value,
126         zend_long limit_val, zend_long flags);
127  
128 diff -urN php-7.2.25.orig/ext/phar/Makefile.frag php-7.2.25/ext/phar/Makefile.frag
129 --- php-7.2.25.orig/ext/phar/Makefile.frag      2019-12-12 23:55:51.636000000 +0100
130 +++ php-7.2.25/ext/phar/Makefile.frag   2019-12-12 23:56:02.320000000 +0100
131 @@ -14,7 +14,7 @@
132                 $(top_srcdir)/build/shtool echo -n -- "$(top_builddir)/$(SAPI_CLI_PATH) -n"; \
133                 if test "x$(PHP_MODULES)" != "x"; then \
134                 $(top_srcdir)/build/shtool echo -n -- " -d extension_dir=$(top_builddir)/modules"; \
135 -               for i in spl bz2 zlib phar; do \
136 +               for i in pcre spl bz2 zlib phar; do \
137                         if test -f "$(top_builddir)/modules/$$i.la"; then \
138                                 . $(top_builddir)/modules/$$i.la; $(top_srcdir)/build/shtool echo -n -- " -d extension=$$dlname"; \
139                         fi; \
140 diff -urN php-7.2.25.orig/ext/standard/basic_functions.c php-7.2.25/ext/standard/basic_functions.c
141 --- php-7.2.25.orig/ext/standard/basic_functions.c      2019-12-12 23:55:51.046000000 +0100
142 +++ php-7.2.25/ext/standard/basic_functions.c   2019-12-12 23:56:02.321000000 +0100
143 @@ -113,6 +113,15 @@
144  PHPAPI php_basic_globals basic_globals;
145  #endif
146  
147 +#if COMPILE_DL_PCRE
148 +// for pcre shared patch symbol
149 +void *pcre_get_compiled_regex_p;
150 +void *pcre_get_compiled_regex_cache_p;
151 +void *php_pcre_replace_impl_p;
152 +void *php_pcre_match_impl_p;
153 +void *php_pcre_split_impl_p;
154 +#endif
155 +
156  #include "php_fopen_wrappers.h"
157  #include "streamsfuncs.h"
158  
159 diff -urN php-7.2.25.orig/main/php_ini.c php-7.2.25/main/php_ini.c
160 --- php-7.2.25.orig/main/php_ini.c      2019-12-12 23:55:50.942000000 +0100
161 +++ php-7.2.25/main/php_ini.c   2019-12-12 23:56:02.322000000 +0100
162 @@ -809,8 +809,8 @@
163   */
164  void php_ini_register_extensions(void)
165  {
166 -       zend_llist_apply(&extension_lists.engine, php_load_zend_extension_cb);
167         zend_llist_apply(&extension_lists.functions, php_load_php_extension_cb);
168 +       zend_llist_apply(&extension_lists.engine, php_load_zend_extension_cb);
169  
170         zend_llist_destroy(&extension_lists.engine);
171         zend_llist_destroy(&extension_lists.functions);
172 diff -urN php-7.2.25.orig/sapi/cli/tests/018.phpt php-7.2.25/sapi/cli/tests/018.phpt
173 --- php-7.2.25.orig/sapi/cli/tests/018.phpt     2019-12-12 23:55:50.890000000 +0100
174 +++ php-7.2.25/sapi/cli/tests/018.phpt  2019-12-12 23:56:02.405000000 +0100
175 @@ -20,8 +20,6 @@
176  --EXPECTF--
177  [PHP Modules]
178  %a
179 -pcre
180 -%a
181  
182  [Zend Modules]
183  %aDone