Skip to content

soap: do not overwrite the parsed host on a protocol-relative redirect#22434

Closed
iliaal wants to merge 1 commit into
php:PHP-8.4from
iliaal:soap-protorel-redirect-8.4
Closed

soap: do not overwrite the parsed host on a protocol-relative redirect#22434
iliaal wants to merge 1 commit into
php:PHP-8.4from
iliaal:soap-protorel-redirect-8.4

Conversation

@iliaal

@iliaal iliaal commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

When a redirect Location is a protocol-relative reference (//host/path), php_url_parse() already fills new_url->host, but the scheme-less redirect handling overwrote it with a copy of the request host without releasing the parsed one.

That leaks a zend_string per such redirect and pins the redirect back to the original host instead of the one the server named. Host and port are now inherited from the request URL only when new_url->host is NULL, mirroring the scheme guard above.

This is the PHP-8.4 (legacy php_url_parse) counterpart of the URI-parser fix in #22431.

When a redirect Location is a protocol-relative reference (//host/path),
php_url_parse() already fills new_url->host, but the scheme-less redirect
handling overwrote it with a copy of the request host without releasing
the parsed one. That leaks a zend_string per such redirect and pins the
redirect back to the original host instead of the one the server named.
Inherit host and port from the request URL only when new_url->host is
NULL, mirroring the scheme guard directly above.
iliaal added a commit that referenced this pull request Jun 24, 2026
When a redirect Location is a protocol-relative reference (//host/path),
php_url_parse() already fills new_url->host, but the scheme-less redirect
handling overwrote it with a copy of the request host without releasing
the parsed one. That leaks a zend_string per such redirect and pins the
redirect back to the original host instead of the one the server named.
Inherit host and port from the request URL only when new_url->host is
NULL, mirroring the scheme guard directly above.

Closes GH-22434
@iliaal iliaal closed this Jun 24, 2026
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