[wp-trac] [WordPress Trac] #56358: PHP8 TypeError on current_time( 'timestamp' ) if timezone is set to GMT / 0

WordPress Trac noreply at wordpress.org
Wed Aug 10 09:32:08 UTC 2022


#56358: PHP8 TypeError on current_time( 'timestamp' ) if timezone is set to GMT / 0
---------------------------+------------------------------
 Reporter:  toastercookie  |       Owner:  (none)
     Type:  defect (bug)   |      Status:  new
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  Date/Time      |     Version:  6.0
 Severity:  minor          |  Resolution:
 Keywords:                 |     Focuses:
---------------------------+------------------------------

Comment (by SergeyBiryukov):

 Hi there, welcome to WordPress Trac! Thanks for the ticket.

 Replying to [ticket:56358 toastercookie]:
 > Just a minor bug to report, seems that if you have your timezone set to
 GMT, current_time( 'timestamp' ) throws a fatal error on PHP8, I think
 because 0 is being sent as a string. I can fix by changing my timezone to
 anything else.

 I could not reproduce the error in my testing. As noted above, `'0'`
 should not be an issue, as it is still a numeric string.
 Could you look into what `get_option( 'gmt_offset' )` returns, or what is
 the value in the `wp_options` table?

 I can only reproduce this with a non-numeric string like `Europe/London`,
 but that should be in the `timezone_string` option, not in `gmt_offset`.
 Does the issue still happen on a clean install, with all plugins disabled
 and a default theme (Twenty Twenty-Two) activated?

 Replying to [comment:1 Rarst]:
 > Do you mean UTC? GMT is currently not an option in WordPress time zone
 settings and I can't reproduce it on PHP 8.1.

 It looks like the English (UK) locale
 [https://translate.wordpress.org/projects/wp/dev/en-
 gb/default/?filters%5Bstatus%5D=either&filters%5Boriginal_id%5D=2675&sort%5Bby%5D=translation_date_added&sort%5Bhow%5D=asc
 translates UTC as GMT].

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


More information about the wp-trac mailing list