Merge "Add support for PHP7 random_bytes in favor of mcrypt_create_iv"
[lhc/web/wiklou.git] / includes / libs / xmp / XMPValidate.php
index aaf6491..76ae279 100644 (file)
@@ -23,6 +23,7 @@
 
 use Psr\Log\LoggerInterface;
 use Psr\Log\LoggerAwareInterface;
+use Wikimedia\Timestamp\ConvertibleTimestamp;
 
 /**
  * This contains some static methods for
@@ -329,15 +330,15 @@ class XMPValidate implements LoggerAwareInterface {
                        // We know that if we got to this step, year, month day hour and min must be set
                        // by virtue of regex not failing.
 
-                       $unix = ( new ConvertibleTimestamp(
+                       $unix = ConvertibleTimestamp::convert( TS_UNIX,
                                $res[1] . $res[2] . $res[3] . $res[4] . $res[5] . $res[6]
-                       ) )->getTimestamp( TS_UNIX );
+                       );
                        $offset = intval( substr( $res[7], 1, 2 ) ) * 60 * 60;
                        $offset += intval( substr( $res[7], 4, 2 ) ) * 60;
                        if ( substr( $res[7], 0, 1 ) === '-' ) {
                                $offset = -$offset;
                        }
-                       $val = ( new ConvertibleTimestamp( $unix + $offset ) )->getTimestamp( TS_EXIF );
+                       $val = ConvertibleTimestamp::convert( TS_EXIF, $unix + $offset );
 
                        if ( $stripSeconds ) {
                                // If seconds weren't specified, remove the trailing ':00'.