Skip to content

Commit

Permalink
Fix "Invalid argument supplied for foreach()" in newVersionFound()
Browse files Browse the repository at this point in the history
  • Loading branch information
blackcoder87 committed Mar 10, 2020
1 parent 68c3c74 commit 4519d8e
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions application/libraries/Ilch/Transfer.php
Expand Up @@ -255,18 +255,24 @@ public function setVersionNow($versionNow)
}

/**
* @return true/false
* Gets the versionslist and checks if there is a new version available.
*
* @return bool
*/
public function newVersionFound()
{
foreach ($this->getVersionsList() as $version => $requirements) {
if (version_compare(preg_replace('/\s+/', '', $version), $this->getVersionNow(), '>')) {
$this->setNewVersion(trim(preg_replace('/\s\s+/','', $version)));
$this->zipFile = $this->getZipSavePath().'Master-'.$this->getNewVersion().'.zip';
$this->checkRequirements($requirements);
return true;
$versionsList = $this->getVersionsList();
if ($versionsList !== null) {
foreach ($this->getVersionsList() as $version => $requirements) {
if (version_compare(preg_replace('/\s+/', '', $version), $this->getVersionNow(), '>')) {
$this->setNewVersion(trim(preg_replace('/\s\s+/','', $version)));
$this->zipFile = $this->getZipSavePath().'Master-'.$this->getNewVersion().'.zip';
$this->checkRequirements($requirements);
return true;
}
}
}

return false;
}

Expand Down

0 comments on commit 4519d8e

Please sign in to comment.