[wp-trac] [WordPress Trac] #58566: WP_Http::normalize_cookies does not convert cookie names to strings

WordPress Trac noreply at wordpress.org
Tue Oct 3 17:21:22 UTC 2023


#58566: WP_Http::normalize_cookies does not convert cookie names to strings
--------------------------+------------------------------
 Reporter:  nosilver4u    |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  HTTP API      |     Version:  6.2.2
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by barry.hughes):

 > Can we simply remove the thrown exception from here:
 >
 > https://github.com/WordPress/wordpress-
 develop/blob/b6b6ded79a54535b9ea80ae9c395dfa90262a4f9/src/wp-
 includes/Requests/src/Cookie.php#L83-L85

 Or widen it to allow integers? That would still offer some protection
 (against something truly unexpected, like a bool or object) while still
 accommodating both valid key types.

 {{{#!php
 if ( is_string( $name ) === false && is_integer( $name ) === false ) {
         throw InvalidArgument::create( 1, '$name', 'string|int', gettype(
 $name ) );
 }

 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58566#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list