[wp-trac] [WordPress Trac] #57728: PHP 8.1 deprecation notice for gmt_offset on wp-admin/options.php

WordPress Trac noreply at wordpress.org
Tue Jul 4 13:41:11 UTC 2023


#57728: PHP 8.1 deprecation notice for gmt_offset on wp-admin/options.php
-----------------------------+-----------------------------
 Reporter:  SergeyBiryukov   |       Owner:  SergeyBiryukov
     Type:  defect (bug)     |      Status:  closed
 Priority:  normal           |   Milestone:  6.3
Component:  Date/Time        |     Version:
 Severity:  normal           |  Resolution:  fixed
 Keywords:  php81 has-patch  |     Focuses:
-----------------------------+-----------------------------
Changes (by SergeyBiryukov):

 * owner:  (none) => SergeyBiryukov
 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"56132" 56132]:
 {{{
 #!CommitTicketReference repository="" revision="56132"
 Options, Meta APIs: Check if the `gmt_offset` value is numeric in
 `sanitize_option()`.

 When saving the settings via the admin UI, the default value for any
 options not passed in the current `$_POST` request is set to `null` in
 `wp-admin/options.php`. Some options, e.g. `blog_public`, then rely on
 `null` being passed to `update_option()` to determine whether the value
 was changed or not.

 This commit resolves a PHP 8.1 deprecation notice when saving the
 `gmt_offset` option without any changes:
 {{{
 Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of
 type array|string is deprecated
 }}}

 Includes a similar fix for the `blog_charset` option.

 Follow-up to [4112], [4329], [5541], [21849].

 Props adi3890, dhrupo, hrdelwar, hasanmisbah, oglekler, mukesh27,
 SergeyBiryukov.
 Fixes #57728.
 }}}

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


More information about the wp-trac mailing list