From: Andrei Zmievski Date: Tue, 29 Aug 2006 22:52:37 +0000 (+0000) Subject: Check for is_utf8. X-Git-Tag: RELEASE_1_0_0RC1~1853 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=de39f4561bcd76bb2e19edc6f49821292530c909;p=php Check for is_utf8. --- 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); }