[wp-trac] [WordPress Trac] #51184: get_the_date() checks $format only for empty variable and fails on false boolean - since WP 5.5

WordPress Trac noreply at wordpress.org
Mon Aug 31 16:34:48 UTC 2020


#51184: get_the_date() checks $format only for empty variable and fails on false
boolean - since WP 5.5
-------------------------------------+-------------------------------------
 Reporter:  wittich                  |       Owner:  SergeyBiryukov
     Type:  defect (bug)             |      Status:  reopened
 Priority:  normal                   |   Milestone:  5.5.1
Component:  Date/Time                |     Version:  5.5
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch has-unit-      |     Focuses:  template, coding-
  tests commit dev-feedback fixed-   |  standards
  major                              |
-------------------------------------+-------------------------------------

Comment (by SergeyBiryukov):

 Replying to [comment:20 Rarst]:
 > note that your implementation changes return filter behavior (PR as
 worked out doesn't). Now filters would receive a default format instead of
 original format if it's empty. Feels close to BC break for me.

 Ah, good point.

 I went back and forth for a bit, as the parameter is described as `string`
 in the filter docs, so passing `false` there didn't seem like a good idea.
 But in trying to fix that, I missed that now an empty string is not passed
 either.

 I think the current code is more readable though, let's just rename the
 sanitized format variable to something like `$_format`, so that the
 original value is left untouched. That would be consistent with some other
 areas of core.

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


More information about the wp-trac mailing list