Merge pull request #2 from Cadoles/issue#1

vérification fichier de cache vide ou xml erronné
This commit is contained in:
scriptted 2019-09-24 09:19:38 -04:00 committed by GitHub
commit 87350704d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 0 deletions

View File

@ -93,6 +93,16 @@ class WsdlDownloader
if ($isRemoteFile || $this->resolveRemoteIncludes) {
$cacheFilePath = $this->cacheDir.DIRECTORY_SEPARATOR.'wsdl_'.md5($wsdl).'.cache';
if (file_exists($cacheFilePath)) {
clearstatcache();
$xml = \XMLReader::open($cacheFilePath);
$xml->setParserProperty(\XMLReader::VALIDATE, true);
if (!filesize($cacheFilePath) || !$xml->isValid()) {
unlink($cacheFilePath);
throw new \Exception('There is something wrong with the WSDL file formatting. The file has been deleted from the cache and will be downloaded again on the next request.');
}
}
if (!$this->cacheEnabled || !file_exists($cacheFilePath) || (filemtime($cacheFilePath) + $this->cacheTtl) < time()) {
if ($isRemoteFile) {
// execute request