com php-src: Merge branch 'PHP-7.2' into PHP-7.3: ext/pcre/php _pcre.c ext/pcre/php_pcre.h
| From: | Nikita Popov | Date: | Tue, 08 Oct 2019 14:13:17 +0000 |
| Subject: | com php-src: Merge branch 'PHP-7.2' into PHP-7.3: ext/pcre/php _pcre.c ext/pcre/php_pcre.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-108809@lists.php.net to get a copy of this message | ||
Commit: 736af5f6602145a267dcd9d795414a6dbffa07dc
Author: Nikita Popov <nikita.ppv@gmail.com> Tue, 8 Oct 2019 16:13:17 +0200
Parents: 9fd555f99e3385e91a65b6145eb403908a629759 a8f60ac9dd3ba8fed24370799603b92487fdf362
Branches: PHP-7.3 PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=736af5f6602145a267dcd9d795414a6dbffa07dc
Log:
Merge branch 'PHP-7.2' into PHP-7.3
Changed paths:
MM ext/pcre/php_pcre.c
MM ext/pcre/php_pcre.h
Diff:
diff --cc ext/pcre/php_pcre.c
index 59217349b50,f919faa298e..e82dc252b27
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@@ -527,14 -322,14 +527,14 @@@ static zend_always_inline size_t calcul
/* {{{ pcre_get_compiled_regex_cache
*/
- PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
+ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache_ex(zend_string *regex, int locale_aware)
{
- pcre *re = NULL;
- pcre_extra *extra;
- int coptions = 0;
- int soptions = 0;
- const char *error;
- int erroffset;
+ pcre2_code *re = NULL;
+ uint32_t coptions = 0;
+ uint32_t extra_coptions = PHP_PCRE_DEFAULT_EXTRA_COPTIONS;
+ PCRE2_UCHAR error[128];
+ PCRE2_SIZE erroffset;
+ int errnumber;
char delimiter;
char start_delimiter;
char end_delimiter;
@@@ -549,10 -342,9 +549,10 @@@
pcre_cache_entry new_entry;
int rc;
zend_string *key;
+ pcre_cache_entry *ret;
#if HAVE_SETLOCALE
- if (BG(locale_string) &&
+ if (locale_aware && BG(locale_string) &&
(ZSTR_LEN(BG(locale_string)) != 1 && ZSTR_VAL(BG(locale_string))[0] != 'C')) {
key = zend_string_alloc(ZSTR_LEN(regex) + ZSTR_LEN(BG(locale_string)) + 1, 0);
memcpy(ZSTR_VAL(key), ZSTR_VAL(BG(locale_string)), ZSTR_LEN(BG(locale_string)) + 1);
@@@ -867,9 -636,17 +867,17 @@@
}
/* }}} */
+ /* {{{ pcre_get_compiled_regex_cache
+ */
+ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
+ {
+ return pcre_get_compiled_regex_cache_ex(regex, 1);
+ }
+ /* }}} */
+
/* {{{ pcre_get_compiled_regex
*/
-PHPAPI pcre* pcre_get_compiled_regex(zend_string *regex, pcre_extra **extra, int *preg_options)
+PHPAPI pcre2_code *pcre_get_compiled_regex(zend_string *regex, uint32_t *capture_count, uint32_t
*preg_options)
{
pcre_cache_entry * pce = pcre_get_compiled_regex_cache(regex);
diff --cc ext/pcre/php_pcre.h
index 4c240cbaf9a,62edb29da88..9fd8259b401
--- a/ext/pcre/php_pcre.h
+++ b/ext/pcre/php_pcre.h
@@@ -41,15 -43,27 +41,16 @@@ extern zend_module_entry pcre_module_en
#include "php_version.h"
#define PHP_PCRE_VERSION PHP_VERSION
-typedef struct {
- pcre *re;
- pcre_extra *extra;
- int preg_options;
- int capture_count;
- int name_count;
-#if HAVE_SETLOCALE
- unsigned const char *tables;
-#endif
- int compile_options;
- int refcount;
-} pcre_cache_entry;
+typedef struct _pcre_cache_entry pcre_cache_entry;
PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex);
+ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache_ex(zend_string *regex, int locale_aware);
-PHPAPI void php_pcre_match_impl( pcre_cache_entry *pce, char *subject, int subject_len, zval
*return_value,
- zval *subpats, int global, int use_flags, zend_long flags, zend_long start_offset);
+PHPAPI void php_pcre_match_impl( pcre_cache_entry *pce, char *subject, size_t subject_len, zval
*return_value,
+ zval *subpats, int global, int use_flags, zend_long flags, zend_off_t start_offset);
-PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, zend_string *subject_str, char
*subject, int subject_len, zend_string *replace_str,
- int limit, int *replace_count);
+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,
+ size_t limit, size_t *replace_count);
PHPAPI void php_pcre_split_impl( pcre_cache_entry *pce, zend_string *subject_str, zval
*return_value,
zend_long limit_val, zend_long flags);