From 4fb705a03dc73bfafbd81bd1ba23b30b0ec2a502 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 14 Apr 2020 17:17:38 +0200 Subject: Add zend_string_concat2 API --- ext/pcre/php_pcre.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ext/pcre/php_pcre.c') diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 26ed8b43e7..a5e806b30c 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -597,9 +597,9 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache_ex(zend_string *regex, in 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); - memcpy(ZSTR_VAL(key) + ZSTR_LEN(BG(locale_string)), ZSTR_VAL(regex), ZSTR_LEN(regex) + 1); + key = zend_string_concat2( + ZSTR_VAL(BG(locale_string)), ZSTR_LEN(BG(locale_string)), + ZSTR_VAL(regex), ZSTR_LEN(regex)); } else { key = regex; } -- cgit v1.2.1