Opened 5 years ago
Last modified 21 months ago
#48936 new enhancement
Remove mysql2date() usage from core
Reported by: | Rarst | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Date/Time | Keywords: | needs-patch needs-unit-tests |
Focuses: | Cc: |
Description
mysql2date()
was originally meant from processing times as stored by WP in database.
Unfortunately its design is very limited because both time zone of input and output is ambiguous. It is interchangeably used for local and UTC times.
As implementation detail that meant that it would produce incorrect output for formats including time zones for local time inputs. Time zone would happen be UTC from WP core setting PHP time zone to UTC on load.
In 5.3 release this behavior was flipped to produce correct local time output for local time input, as considerably more common. Accordingly now UTC input produces incorrect output for formats with time zone.
While the function is common and familiar, it is hardly irreplaceable and its design is so limited it seems to be unsalvageable.
I propose we move towards eliminating its use in core and eventually formally deprecating it.
Inside the core, we have the following usages from the function:
src/wp-content/themes/twentytwenty/classes/class-twentytwenty-walker-page.php
src/wp-admin/includes/class-wp-ms-users-list-table.php
src/wp-admin/edit-form-advanced.php
src/wp-includes/feed-atom-comments.php
src/wp-includes/feed-rdf.php
src/wp-includes/feed-rss2.php
src/wp-includes/feed-rss2-comments.php
src/wp-admin/edit-form-blocks.php
src/wp-admin/includes/template.php
src/wp-includes/class-wp.php
src/wp-includes/class-walker-page.php
src/wp-admin/includes/class-wp-ms-sites-list-table.php
src/wp-admin/includes/export.php
src/wp-includes/ms-functions.php
src/wp-admin/includes/ajax-actions.php
src/wp-includes/class-wp-customize-manager.php
src/wp-includes/comment-template.php
src/wp-includes/class-wp-editor.php
src/wp-includes/comment.php
src/wp-includes/class-wp-xmlrpc-server.php
src/wp-includes/class-wp-query.php
src/wp-includes/link-template.php
src/wp-includes/general-template.php
src/wp-admin/includes/media.php
src/wp-admin/includes/upgrade.php
src/wp-includes/functions.php
src/wp-includes/media.php