Skip to content

Fix unreachable code in URL output handler #19056

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 7, 2025

Conversation

cla7aye15I4nd
Copy link
Contributor

Description

This PR fixes a logical issue in the URL output handler where the final else branch was unreachable due to redundant conditionals.

Problem

The existing code had the following structure:

if (ZSTR_LEN(url_state->url_app.s) != 0) {
    // handle non-empty case
} else if (ZSTR_LEN(url_state->url_app.s) == 0) {
    // handle empty case  
} else {
    // unreachable branch
    *handled_output = NULL;
}

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.

@Girgias Girgias merged commit b068ee3 into php:master Jul 7, 2025
9 checks passed
@Girgias
Copy link
Member

Girgias commented Jul 7, 2025

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants