{"action":"opened","issue":{"url":"https://api.github.com/repos/browscap/browscap-php/issues/89","labels_url":"https://api.github.com/repos/browscap/browscap-php/issues/89/labels{/name}","comments_url":"https://api.github.com/repos/browscap/browscap-php/issues/89/comments","events_url":"https://api.github.com/repos/browscap/browscap-php/issues/89/events","html_url":"https://github.com/browscap/browscap-php/issues/89","id":85573369,"number":89,"title":"[3.x] RemoteLoader::getMTime returns 0 instead of timestamp","user":{"login":"fyrye","id":302306,"avatar_url":"https://avatars.githubusercontent.com/u/302306?v=3","gravatar_id":"","url":"https://api.github.com/users/fyrye","html_url":"https://github.com/fyrye","followers_url":"https://api.github.com/users/fyrye/followers","following_url":"https://api.github.com/users/fyrye/following{/other_user}","gists_url":"https://api.github.com/users/fyrye/gists{/gist_id}","starred_url":"https://api.github.com/users/fyrye/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fyrye/subscriptions","organizations_url":"https://api.github.com/users/fyrye/orgs","repos_url":"https://api.github.com/users/fyrye/repos","events_url":"https://api.github.com/users/fyrye/events{/privacy}","received_events_url":"https://api.github.com/users/fyrye/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-06-05T16:24:33Z","updated_at":"2015-06-05T16:24:33Z","closed_at":null,"body":"The `RemoteLoader` dependency retrieves the response string from the remote source and then converts it to an int.\r\nIn the case of http://browscap.org/version the resposne string is a RFC 2822 date string `Mon, 01 Jun 2015 08:53:57 +0000`\r\n\r\nFileloader\\Loader\\RemoteLoader\r\n```php\r\n    public function getMTime()\r\n    {\r\n        $remoteVersionUrl = $this->getLoader()->getRemoteVerUrl();\r\n        $remoteDatetime   = $this->getConnector()->getRemoteData($remoteVersionUrl);\r\n        if (!$remoteDatetime) {\r\n            throw new Exception('Bad datetime format from ' . $remoteVersionUrl, Exception::INVALID_DATETIME);\r\n        }\r\n        //$remoteDatetime = 'Mon, 01 Jun 2015 08:53:57 +0000'\r\n        return (int) $remoteDatetime; //0\r\n    }\r\n````\r\n\r\nTo satisfy both browscap.org/version and original RemoteLoader::getMTime behavior I suggest using\r\n```php\r\n$rfcDate = \\DateTime::createFromFormat(\\DateTime::RFC2822, $remoteDatetime);\r\n$timestamp = ($rfcDate instanceof \\DateTime ? $rfcDate->getTimestamp() : (int) $remoteDatetime);\r\nif (!$timestamp) {\r\n    throw new Exception('Bad datetime format from ' . $remoteVersionUrl, Exception::INVALID_DATETIME);\r\n}\r\nreturn $timestamp;\r\n```"}}