From 9c146c373e2e60ba71a03c206dc3b7207423c041 Mon Sep 17 00:00:00 2001 From: NathanFreeman <1056159381@qq.com> Date: Wed, 21 Aug 2024 21:49:30 +0800 Subject: [PATCH] fix scope --- ext-src/swoole_http_response.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ext-src/swoole_http_response.cc b/ext-src/swoole_http_response.cc index af2725405e6..d4a663f5580 100644 --- a/ext-src/swoole_http_response.cc +++ b/ext-src/swoole_http_response.cc @@ -350,8 +350,11 @@ void HttpContext::build_header(String *http_buffer, const char *body, size_t len ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(zheader), num_key, string_key, zvalue) { if (!string_key) { string_key = zend_long_to_str(num_key); - zend::String key(string_key, false); + } else { + zend_string_addref(string_key); } + zend::String key(string_key, false); + int key_header = parse_header_name(ZSTR_VAL(string_key), ZSTR_LEN(string_key)); if (key_header > 0) {