From b068ee307f3185ecd4d2a2f476c005bcc24e873a Mon Sep 17 00:00:00 2001 From: Zheng Yu Date: Mon, 7 Jul 2025 05:57:43 -0400 Subject: [PATCH] Fix unreachable code in URL output handler (#19056) Since `ZSTR_LEN()` returns a `size_t` (unsigned integer), the value can only be either "not equal to 0" or "equal to 0". The third `else` branch was unreachable, making the `*handled_output = NULL;` assignment dead code. --- ext/standard/url_scanner_ex.re | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ext/standard/url_scanner_ex.re b/ext/standard/url_scanner_ex.re index e3c4477cde3..46254bf3808 100644 --- a/ext/standard/url_scanner_ex.re +++ b/ext/standard/url_scanner_ex.re @@ -701,7 +701,7 @@ static inline void php_url_scanner_session_handler_impl(char *output, size_t out len = UINT_MAX; } *handled_output_len = len; - } else if (ZSTR_LEN(url_state->url_app.s) == 0) { + } else { url_adapt_state_ex_t *ctx = url_state; if (ctx->buf.s && ZSTR_LEN(ctx->buf.s)) { smart_str_append(&ctx->result, ctx->buf.s); @@ -715,8 +715,6 @@ static inline void php_url_scanner_session_handler_impl(char *output, size_t out } else { *handled_output = estrndup(output, *handled_output_len = output_len); } - } else { - *handled_output = NULL; } }