Make WordPress Core

Opened 20 months ago

#56887 new defect (bug)

wp_exif_date2ts throws notice on slash formatted date

Reported by: domainsupport's profile domainsupport Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.2.3
Component: Date/Time Keywords:
Focuses: Cc:


When an image has an exif date in the format ...


... rather than ...


... which is happening more and more I have noticed, the following PHP notices are thrown ...

PHP Notice: Undefined offset: 1 in /var/www/ on line 710
PHP Notice: Undefined offset: 2 in /var/www/ on line 710

I think there are a lot of assumptions being made in wp_exif_date2ts() and I believe that a preg_match check like ...

if (preg_match('/^(?>\d){4}[:|\/](?>\d){2}[:|\/](?>\d){2} (?>\d){2}:(?>\d){2}:(?>\d){2}$/', $str)) {

// Process and return exif date

} else {
return false;

... should be done instead.

This is related to ticket 48204

Change History (0)

Note: See TracTickets for help on using tickets.