[wp-trac] [WordPress Trac] #28992: mysql2date() return empty string not false sometimes added doing it wrong message
WordPress Trac
noreply at wordpress.org
Thu Aug 29 09:53:22 UTC 2019
#28992: mysql2date() return empty string not false sometimes added doing it wrong
message
--------------------------------------+-----------------------------
Reporter: pbearne | Owner: SergeyBiryukov
Type: defect (bug) | Status: reopened
Priority: normal | Milestone: 5.3
Component: Date/Time | Version: 3.8
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses:
--------------------------------------+-----------------------------
Comment (by Rarst):
Ok, so the old behavior is compound failure really:
1. `strtotime()` fails and returns false.
2. `date()` receives `false` instead of timestamp, but it gets cast to 0
This causes XML RPC to create post with invalid date as 1970-01-01
However this isn't normal for creating WP posts, they would default to
current date without date input.
So making `mysql2date` fail consistently makes XMLRPC behavior consistent
with "normal" post creation.
Since the failing tests were originally meant to test for ''error'', not
specifically to codify zero time as correct outcome, I suggest we update
the tests.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/28992#comment:21>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list