Opened 2 years ago
#56887 new defect (bug)
wp_exif_date2ts throws notice on slash formatted date
Reported by: | domainsupport | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 5.2.3 |
Component: | Date/Time | Keywords: | |
Focuses: | Cc: |
Description
When an image has an exif date in the format ...
YYYY/MM/DD HH:MM:SS
... rather than ...
YYYY:MM:DD HH:MM:SS
... which is happening more and more I have noticed, the following PHP notices are thrown ...
PHP Notice: Undefined offset: 1 in /var/www/tourist.org.uk/html/wp-admin/includes/image.php on line 710
PHP Notice: Undefined offset: 2 in /var/www/tourist.org.uk/html/wp-admin/includes/image.php 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 ...
<?php 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
Note: See
TracTickets for help on using
tickets.