From de39f4561bcd76bb2e19edc6f49821292530c909 Mon Sep 17 00:00:00 2001 From: Andrei Zmievski Date: Tue, 29 Aug 2006 22:52:37 +0000 Subject: [PATCH] Check for is_utf8. --- ext/pcre/php_pcre.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index f6d75ae225..34769d32a9 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -829,12 +829,17 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec int u_len; for (i = 0; i < num_subpats; i++) { if (subpat_names[i]) { - zend_string_to_unicode_ex(UG(utf8_conv), &u, &u_len, subpat_names[i], strlen(subpat_names[i]), &status); - zend_u_hash_update(Z_ARRVAL_P(subpats), IS_UNICODE, ZSTR(u), - u_len+1, &match_sets[i], sizeof(zval *), NULL); - ZVAL_ADDREF(match_sets[i]); - efree(u); - status = U_ZERO_ERROR; + if (is_utf8) { + zend_string_to_unicode_ex(UG(utf8_conv), &u, &u_len, subpat_names[i], strlen(subpat_names[i]), &status); + zend_u_hash_update(Z_ARRVAL_P(subpats), IS_UNICODE, ZSTR(u), + u_len+1, &match_sets[i], sizeof(zval *), NULL); + ZVAL_ADDREF(match_sets[i]); + efree(u); + status = U_ZERO_ERROR; + } else { + zend_hash_update(Z_ARRVAL_P(subpats), subpat_names[i], + strlen(subpat_names[i])+1, &match_sets[i], sizeof(zval *), NULL); + } } zend_hash_next_index_insert(Z_ARRVAL_P(subpats), &match_sets[i], sizeof(zval *), NULL); } -- 2.40.0