]> TLD Linux GIT Repositories - packages/php.git/blob - pcre-shared.patch
- partial PLD merge
[packages/php.git] / pcre-shared.patch
1 diff -urN php-7.3.12.orig/ext/pcre/config0.m4 php-7.3.12/ext/pcre/config0.m4
2 --- php-7.3.12.orig/ext/pcre/config0.m4 2019-12-12 21:43:24.775000000 +0100
3 +++ php-7.3.12/ext/pcre/config0.m4      2019-12-12 21:43:36.336000000 +0100
4 @@ -84,8 +84,9 @@
5        ])
6      fi
7  
8 -    PHP_NEW_EXTENSION(pcre, php_pcre.c, no,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
9 +    PHP_NEW_EXTENSION(pcre, php_pcre.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
10      PHP_INSTALL_HEADERS([ext/pcre], [php_pcre.h])
11 +    EXTRA_LIBS="$EXTRA_LIBS -lpcre2-8"
12    else
13      AC_MSG_CHECKING([for PCRE library to use])
14      AC_MSG_RESULT([bundled])
15 diff -urN php-7.3.12.orig/ext/pcre/php_pcre.c php-7.3.12/ext/pcre/php_pcre.c
16 --- php-7.3.12.orig/ext/pcre/php_pcre.c 2019-12-12 21:43:24.775000000 +0100
17 +++ php-7.3.12/ext/pcre/php_pcre.c      2019-12-12 21:43:36.339000000 +0100
18 @@ -19,6 +19,9 @@
19  #include "php.h"
20  #include "php_ini.h"
21  #include "php_globals.h"
22 +#if COMPILE_DL_PCRE
23 +#define COMPILE_DL_PCRE_NOREDIRECT
24 +#endif
25  #include "php_pcre.h"
26  #include "ext/standard/info.h"
27  #include "ext/standard/basic_functions.h"
28 @@ -290,6 +293,17 @@
29                 pcre2_set_match_limit(mctx, (uint32_t)PCRE_G(backtrack_limit));
30         }
31  
32 +#if COMPILE_DL_PCRE
33 +       pcre_get_compiled_regex_p = pcre_get_compiled_regex;
34 +       pcre_get_compiled_regex_cache_p = pcre_get_compiled_regex_cache;
35 +       php_pcre_replace_impl_p = php_pcre_replace_impl;
36 +       php_pcre_match_impl_p = php_pcre_match_impl;
37 +       php_pcre_split_impl_p = php_pcre_split_impl;
38 +       php_pcre_create_match_data_p = php_pcre_create_match_data;
39 +       php_pcre_free_match_data_p = php_pcre_free_match_data;
40 +       php_pcre_mctx_p = php_pcre_mctx;
41 +#endif
42 +
43         return SUCCESS;
44  }/*}}}*/
45  
46 diff -urN php-7.3.12.orig/ext/pcre/php_pcre.h php-7.3.12/ext/pcre/php_pcre.h
47 --- php-7.3.12.orig/ext/pcre/php_pcre.h 2019-12-12 21:43:24.777000000 +0100
48 +++ php-7.3.12/ext/pcre/php_pcre.h      2019-12-12 21:45:10.506000000 +0100
49 @@ -31,7 +31,35 @@
50  #include <locale.h>
51  #endif
52  
53 +#if !defined(COMPILE_DL_PCRE_NOREDIRECT)
54 +#define pcre_get_compiled_regex (*pcre_get_compiled_regex_p)
55 +#define pcre_get_compiled_regex_cache (*pcre_get_compiled_regex_cache_p)
56 +#define php_pcre_replace_impl (*php_pcre_replace_impl_p)
57 +#define php_pcre_match_impl (*php_pcre_match_impl_p)
58 +#define php_pcre_split_impl (*php_pcre_split_impl_p)
59 +#define php_pcre_create_match_data (*php_pcre_create_match_data_p)
60 +#define php_pcre_free_match_data (*php_pcre_free_match_data_p)
61 +#define php_pcre_mctx (*php_pcre_mctx_p)
62 +#if !defined(COMPILE_DL_PCRE_NOEXTERN)
63 +#      define PCRE_EXTERN extern
64 +#else
65 +#      define PCRE_EXTERN
66 +#endif
67 +#else
68 +// for pcre.c
69 +#define PCRE_EXTERN
70 +extern void *pcre_get_compiled_regex_p;
71 +extern void *pcre_get_compiled_regex_cache_p;
72 +extern void *php_pcre_replace_impl_p;
73 +extern void *php_pcre_match_impl_p;
74 +extern void *php_pcre_split_impl_p;
75 +extern void *php_pcre_create_match_data_p;
76 +extern void *php_pcre_free_match_data_p;
77 +extern void *php_pcre_mctx_p;
78 +#endif
79 +
80  PHPAPI zend_string *php_pcre_replace(zend_string *regex, zend_string *subject_str, char *subject, size_t subject_len, zend_string *replace_str, size_t limit, size_t *replace_count);
81 +PCRE_EXTERN
82  PHPAPI pcre2_code* pcre_get_compiled_regex(zend_string *regex, uint32_t *capture_count, uint32_t *options);
83  PHPAPI pcre2_code* pcre_get_compiled_regex_ex(zend_string *regex, uint32_t *capture_count, uint32_t *preg_options, uint32_t *coptions);
84  
85 @@ -43,21 +71,26 @@
86  
87  typedef struct _pcre_cache_entry pcre_cache_entry;
88  
89 +PCRE_EXTERN
90  PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex);
91  PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache_ex(zend_string *regex, int locale_aware);
92  
93 +PCRE_EXTERN
94  PHPAPI void  php_pcre_match_impl(  pcre_cache_entry *pce, char *subject, size_t subject_len, zval *return_value,
95         zval *subpats, int global, int use_flags, zend_long flags, zend_off_t start_offset);
96  
97 +PCRE_EXTERN
98  PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, zend_string *subject_str, char *subject, size_t subject_len, zend_string *replace_str,
99         size_t limit, size_t *replace_count);
100  
101 +PCRE_EXTERN
102  PHPAPI void  php_pcre_split_impl(  pcre_cache_entry *pce, zend_string *subject_str, zval *return_value,
103         zend_long limit_val, zend_long flags);
104  
105  PHPAPI void  php_pcre_grep_impl(   pcre_cache_entry *pce, zval *input, zval *return_value,
106         zend_long flags);
107  
108 +PCRE_EXTERN
109  PHPAPI pcre2_match_context *php_pcre_mctx(void);
110  PHPAPI pcre2_general_context *php_pcre_gctx(void);
111  PHPAPI pcre2_compile_context *php_pcre_cctx(void);
112 @@ -65,7 +98,9 @@
113  PHPAPI void php_pcre_pce_decref(pcre_cache_entry *);
114  PHPAPI pcre2_code *php_pcre_pce_re(pcre_cache_entry *);
115  /* capture_count can be ignored, re is required. */
116 +PCRE_EXTERN
117  PHPAPI pcre2_match_data *php_pcre_create_match_data(uint32_t, pcre2_code *);
118 +PCRE_EXTERN
119  PHPAPI void php_pcre_free_match_data(pcre2_match_data *);
120  
121  ZEND_BEGIN_MODULE_GLOBALS(pcre)
122 diff -urN php-7.3.12.orig/ext/phar/Makefile.frag php-7.3.12/ext/phar/Makefile.frag
123 --- php-7.3.12.orig/ext/phar/Makefile.frag      2019-12-12 21:43:24.654000000 +0100
124 +++ php-7.3.12/ext/phar/Makefile.frag   2019-12-12 21:43:36.358000000 +0100
125 @@ -14,7 +14,7 @@
126                 $(top_srcdir)/build/shtool echo -n -- "$(top_builddir)/$(SAPI_CLI_PATH) -n"; \
127                 if test "x$(PHP_MODULES)" != "x"; then \
128                 $(top_srcdir)/build/shtool echo -n -- " -d extension_dir=$(top_builddir)/modules"; \
129 -               for i in spl bz2 zlib phar; do \
130 +               for i in pcre spl bz2 zlib phar; do \
131                         if test -f "$(top_builddir)/modules/$$i.la"; then \
132                                 . $(top_builddir)/modules/$$i.la; $(top_srcdir)/build/shtool echo -n -- " -d extension=$$dlname"; \
133                         fi; \
134 diff -urN php-7.3.12.orig/ext/standard/basic_functions.c php-7.3.12/ext/standard/basic_functions.c
135 --- php-7.3.12.orig/ext/standard/basic_functions.c      2019-12-12 21:43:24.765000000 +0100
136 +++ php-7.3.12/ext/standard/basic_functions.c   2019-12-12 21:43:36.361000000 +0100
137 @@ -112,6 +112,18 @@
138  PHPAPI php_basic_globals basic_globals;
139  #endif
140  
141 +#if COMPILE_DL_PCRE
142 +// Declare the pointers in core library
143 +void *pcre_get_compiled_regex_p;
144 +void *pcre_get_compiled_regex_cache_p;
145 +void *php_pcre_replace_impl_p;
146 +void *php_pcre_match_impl_p;
147 +void *php_pcre_split_impl_p;
148 +void *php_pcre_create_match_data_p;
149 +void *php_pcre_free_match_data_p;
150 +void *php_pcre_mctx_p;
151 +#endif
152 +
153  #include "php_fopen_wrappers.h"
154  #include "streamsfuncs.h"
155  
156 diff -urN php-7.3.12.orig/main/php_ini.c php-7.3.12/main/php_ini.c
157 --- php-7.3.12.orig/main/php_ini.c      2019-12-12 21:43:24.549000000 +0100
158 +++ php-7.3.12/main/php_ini.c   2019-12-12 21:43:36.364000000 +0100
159 @@ -807,8 +807,8 @@
160   */
161  void php_ini_register_extensions(void)
162  {
163 -       zend_llist_apply(&extension_lists.engine, php_load_zend_extension_cb);
164         zend_llist_apply(&extension_lists.functions, php_load_php_extension_cb);
165 +       zend_llist_apply(&extension_lists.engine, php_load_zend_extension_cb);
166  
167         zend_llist_destroy(&extension_lists.engine);
168         zend_llist_destroy(&extension_lists.functions);
169 diff -urN php-7.3.12.orig/sapi/cli/tests/018.phpt php-7.3.12/sapi/cli/tests/018.phpt
170 --- php-7.3.12.orig/sapi/cli/tests/018.phpt     2019-12-12 21:43:24.534000000 +0100
171 +++ php-7.3.12/sapi/cli/tests/018.phpt  2019-12-12 21:43:36.364000000 +0100
172 @@ -20,8 +20,6 @@
173  --EXPECTF--
174  [PHP Modules]
175  %a
176 -pcre
177 -%a
178  
179  [Zend Modules]
180  %aDone