WordPress / Requests

Requests for PHP is a humble HTTP request library. It simplifies how you interact with other sites and takes away all your worries.
https://requests.ryanmccue.info/
Other
3.57k stars 494 forks source link

Allow integer values for a Cookie() name #846

Closed nosilver4u closed 9 months ago

nosilver4u commented 9 months ago

Fixes #845 so that an exception isn't thrown for legitimate numeric cookie names.

There are two changes:

  1. Modify the check for $name, to allow both string and integer cookie names.
  2. Change the exception thrown to indicate a string OR int is permitted.

Pull Request Type

This is a:

Context

Currently, multiple plugins, and possibly even WP core are throwing errors if someone has a cookie with a numeric name. Would love to see this issue go away, so that folks don't have to resort to deleting cookies in the dev tools of their browser.

Quality assurance

jrfnl commented 9 months ago

@nosilver4u Aside from the fundamental question of whether this is a valid "fix" (in contrast to the user doing it wrong), a PR will not be reviewed or even considered without unit tests documenting the use case. So without tests, this PR will be closed.

nosilver4u commented 9 months ago

I missed an update to the parse() method anyway, so I need to create a new pull request with both changes. Regarding tests, I had wondered about that, so I'll see what I can figure out on that end.