[wp-trac] [WordPress Trac] #46550: Uncaught TypeError: setcookie() expects parameter 5 to be string, bool given in...

WordPress Trac noreply at wordpress.org
Wed Aug 2 14:27:57 UTC 2023


#46550: Uncaught TypeError: setcookie() expects parameter 5 to be string, bool
given in...
-------------------------------------+-------------------------------------
 Reporter:  kmvan                    |       Owner:  (none)
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  Awaiting Review
Component:  Networks and Sites       |     Version:  5.2
 Severity:  major                    |  Resolution:
 Keywords:  reporter-feedback has-   |     Focuses:  coding-standards, php-
  patch                              |  compatibility
-------------------------------------+-------------------------------------

Comment (by Cybr):

 It causes no warnings nor errors in PHP unless strict typing is declared:
 https://3v4l.org/dEQk2.

 However, to reclarify: `setcookie()` expects a string for `$domain`.
 `false` does nothing for it.

 Nothing in WP checks against `false`, nor would a cookie have a boolean.
 This change should be fairly inconspicuous and ensures future
 compatibility, seeing how PHP is strictly typing internal functions.

 It caught my eye whilst and I thought I'd mention it in Slack for an easy
 fix.

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


More information about the wp-trac mailing list