close
Skip to content

Login and Registration: Check redirect_to type before calling str_contains()#5227

Closed
Krinkle wants to merge 1 commit intoWordPress:trunkfrom
Krinkle:fix-login-fatal
Closed

Login and Registration: Check redirect_to type before calling str_contains()#5227
Krinkle wants to merge 1 commit intoWordPress:trunkfrom
Krinkle:fix-login-fatal

Conversation

@Krinkle
Copy link
Copy Markdown

@Krinkle Krinkle commented Sep 16, 2023

Trac ticket: https://core.trac.wordpress.org/ticket/59373.

This prevents URLs like /wp-login.php?redirect_to[x]=y from triggering a HTTP 500 response as result of

PHP Fatal error: Uncaught TypeError: str_contains():
Argument #1 ($haystack) must be of type string, array given

I considered changing the case for "authorize-application.php" to re-use the $requested_redirect_to variable but left it as-is because this case reads from _GET whereas the variable also considers POST parameters (via _REQUEST), which might be intentional. This case was introduced in [49109] for #42790.


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

…ntains()`

This prevents URLs like `/wp-login.php?redirect_to[x]=y` from
triggering a HTTP 500 response as result of

> PHP Fatal error: Uncaught TypeError: str_contains():
> Argument WordPress#1 ($haystack) must be of type string, array given

See https://core.trac.wordpress.org/ticket/59373

I considered changing the case for "authorize-application.php" to
re-use the `$requested_redirect_to` variable but left it as-is because
this case reads from _GET whereas the variable also considers POST
parameters (via _REQUEST), which might be intentional. This case
was introduced in [49109] for #42790.

* change 49109: WordPress@1856d0f
* issue 42790: https://core.trac.wordpress.org/ticket/42790
@Krinkle Krinkle closed this Sep 18, 2023
@Krinkle Krinkle reopened this Sep 18, 2023
@Krinkle
Copy link
Copy Markdown
Author

Krinkle commented Oct 5, 2023

The End-to-end test failure appears unrelated. Closing and re-opening to re-run the tests.

@Krinkle Krinkle closed this Oct 5, 2023
@Krinkle Krinkle reopened this Oct 5, 2023
@github-actions
Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props timotijhof.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@SergeyBiryukov
Copy link
Copy Markdown
Member

Thanks for the PR! Merged in r58023.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants