Skip to content
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

Fix for ticket 42957, preventing some users from creating accounts #1095

Closed
wants to merge 12 commits into from

Conversation

daveagp
Copy link

@daveagp daveagp commented Mar 14, 2021

On my website we get about one email a month from a person who can't create an account. This turns out to be caused by https://core.trac.wordpress.org/ticket/42957

  • you're using gmail
  • you try to create an account name ending in a period, e.g. Dave P.
  • the email is sent containing https://blah...&login=Dave%20P.
  • gmail generally assumes links ending in periods have the periods added by humans and thus ignores them
  • so clicking on it, you arrive at https://blah...&login=Dave%20P and the user's told the link is invalid

Fixes this by encoding the trailing period as an entity.

This is my first submitted pull request to WP, thanks in advance for telling me if any more steps are needed.

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

@github-actions
Copy link

Hi @daveagp! 👋

Thank you for your contribution to WordPress! 💖

It looks like this is your first pull request to wordpress-develop. Here are a few things to be aware of that may help you out!

No one monitors this repository for new pull requests. Pull requests must be attached to a Trac ticket to be considered for inclusion in WordPress Core. To attach a pull request to a Trac ticket, please include the ticket's full URL in your pull request description.

Pull requests are never merged on GitHub. The WordPress codebase continues to be managed through the SVN repository that this GitHub repository mirrors. Please feel free to open pull requests to work on any contribution you are making.

More information about how GitHub pull requests can be used to contribute to WordPress can be found in this blog post.

Please include automated tests. Including tests in your pull request is one way to help your patch be considered faster. To learn about WordPress' test suites, visit the Automated Testing page in the handbook.

If you have not had a chance, please review the Contribute with Code page in the WordPress Core Handbook.

The Developer Hub also documents the various coding standards that are followed:

Thank you,
The WordPress Project

* Renames file and test class
* Adds more test scenarios
* Relocates data provider for consistency
* Adds keys for named test datasets 
* Adds keys in each test dataset  to match test method parameters
* Names data provider the same as the test except with `data` instead of `test`.
* Adds ticket number to test method
* Renames to tell what it does when invoked, i.e. it encodes an ending period in a URL.
* Guards to ensure a string is given as a URL to avoid errors when passing to PHP native functions.
* Trims any surrounding spaces.
* Uses str_ends_with() and rtrim() instead of prep_replace(). Why? More performant. str_ends_with()` polyfill was added to Core during 5.9. It's now available for use. Here's the benchmark for it https://3v4l.org/WdWih#v8.0.12
* @covers ::wp_url_encode_ending_period
*/
class Tests_Functions_WpUrlEncodeEndingPeriod extends WP_UnitTestCase {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope it's failing because this PR is set to master and not trunk. Will reopen a new PR and reference this one.

@hellofromtonya
Copy link
Contributor

Closing as this PR is based on master instead of trunk. PR #1896 supersedes it.

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