[wp-trac] [WordPress Trac] #57332: setcookie() not working with null

WordPress Trac noreply at wordpress.org
Fri Dec 16 22:03:13 UTC 2022


#57332: setcookie() not working with null
-------------------------------------------+------------------------------
 Reporter:  kikanirita                     |       Owner:  (none)
     Type:  defect (bug)                   |      Status:  new
 Priority:  normal                         |   Milestone:  Awaiting Review
Component:  General                        |     Version:
 Severity:  normal                         |  Resolution:
 Keywords:  reporter-feedback php81 close  |     Focuses:
-------------------------------------------+------------------------------
Changes (by jrf):

 * keywords:  reporter-feedback php81 => reporter-feedback php81 close


Comment:

 [https://www.php.net/manual/en/function.setcookie.php `setcookie()`] is a
 PHP native function and never allowed the `null` value, it was just that
 PHP was tolerant about it and "juggled" `null` to the expected type.

 In other words: that code was always wrong and should be fixed.

 As of PHP 8.1,
 [https://www.php.net/manual/en/migration81.deprecated.php#migration81.deprecated.core
 .null-not-nullable-internal PHP has deprecated the tolerance for passing a
 `null` value where it is not expected or allowed].

 This has literally nothing to do with WordPress.

 Considering the phrasing of the report "I cannot pass `null` value to
 `setcookie()`", this sounds like developer error and I would like to
 suggest you keep up with changes in PHP and - as a minimum - read
 [https://www.php.net/manual/en/migration81.php the migration guide].

 If this would be a deprecation which is coming from code within WordPress,
 a backtrace is needed to find out where the offending code is.

 As things stand, however, this doesn't sound like a WP issue.

 Suggest: close.

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


More information about the wp-trac mailing list