Skip to content

Commit b068ee3

Browse files
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.
1 parent 3b45b9d commit b068ee3

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

ext/standard/url_scanner_ex.re

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ static inline void php_url_scanner_session_handler_impl(char *output, size_t out
701701
len = UINT_MAX;
702702
}
703703
*handled_output_len = len;
704-
} else if (ZSTR_LEN(url_state->url_app.s) == 0) {
704+
} else {
705705
url_adapt_state_ex_t *ctx = url_state;
706706
if (ctx->buf.s && ZSTR_LEN(ctx->buf.s)) {
707707
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
715715
} else {
716716
*handled_output = estrndup(output, *handled_output_len = output_len);
717717
}
718-
} else {
719-
*handled_output = NULL;
720718
}
721719
}
722720

0 commit comments

Comments
 (0)