[wp-trac] [WordPress Trac] #48204: wp_exif_date2ts throws notice on empty date

WordPress Trac noreply at wordpress.org
Thu Oct 3 20:00:04 UTC 2019


#48204: wp_exif_date2ts throws notice on empty date
--------------------------+-----------------------------
 Reporter:  nosilver4u    |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Future Release
Component:  Media         |     Version:  5.2.3
 Severity:  minor         |  Resolution:
 Keywords:  needs-patch   |     Focuses:
--------------------------+-----------------------------
Changes (by joemcgill):

 * keywords:  reporter-feedback => needs-patch
 * milestone:  Awaiting Review => Future Release


Comment:

 Perfect. Thank you. Tested and am seeing the same error. The problem here
 is the assumption being made in this function is that there will only be
 one whitespace character in the string, because we're expecting a string
 formatted like `yyyy:MM:dd HH:mm:ss`, so the first `explode()` statement
 should split the date from the time, and the second `explode` should
 return the date parts. If the original string includes any additional
 whitespaces, as is the case here, those assumptions are incorrect.

 As a sidenote, the docblock for `wp_exif_date2ts()` says that this
 function will always return an `int` but it could also return `false`
 since it's just passing along the results of `strtotime()` — see:
 https://www.php.net/manual/en/function.strtotime.php

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


More information about the wp-trac mailing list