diff --git a/ext/standard/http.c b/ext/standard/http.c index 9fd6723cdca..fe37e4c075e 100644 --- a/ext/standard/http.c +++ b/ext/standard/http.c @@ -59,7 +59,8 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr, (key_type = zend_hash_get_current_key_ex(ht, &key, &key_len, &idx, 0, NULL)) != HASH_KEY_NON_EXISTANT; zend_hash_move_forward(ht) ) { - if (key_type == HASH_KEY_IS_STRING && key_len && key.s[key_len-1] == '\0') { + if ((key_type == HASH_KEY_IS_STRING || key_type == HASH_KEY_IS_UNICODE) + && key_len && key.s[key_len-1] == '\0') { /* We don't want that trailing NULL */ key_len -= 1; }