Skip to content

Commit

Permalink
Allow integer values for a Cookie() name
Browse files Browse the repository at this point in the history
Fixes WordPress#845 so that an exception isn't thrown for legitimate numeric cookie names.
  • Loading branch information
nosilver4u committed Nov 30, 2023
1 parent a2f7aa4 commit 9e03646
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Cookie.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ class Cookie {
* @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $reference_time argument is not an integer or null.
*/
public function __construct($name, $value, $attributes = [], $flags = [], $reference_time = null) {
if (is_string($name) === false) {
throw InvalidArgument::create(1, '$name', 'string', gettype($name));
if (is_string($name) === false && is_int($name) === false) {
throw InvalidArgument::create(1, '$name', 'string|int', gettype($name));
}

if (is_string($value) === false) {
Expand Down

0 comments on commit 9e03646

Please sign in to comment.