absailesh / vqmod

Automatically exported from code.google.com/p/vqmod
0 stars 0 forks source link

PHP Warning: Invalid argument supplied for foreach() in /vqmod/vqmod.php on line 107 #77

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
to fix this error
I've replaced the following lines
foreach($this->_mods as $modObject) {
    foreach($modObject->mods as $path => $mods) {
        if($this->_checkMatch($path, $sourcePath)) {
            $modObject->applyMod($mods, $fileData);
        }
    }
}

with the following lines

if (is_array($this->_mods)) foreach($this->_mods as $modObject) {
    foreach($modObject->mods as $path => $mods) {
        if($this->_checkMatch($path, $sourcePath)) {
            $modObject->applyMod($mods, $fileData);
        }
    }
}

Original issue reported on code.google.com by Abdullah...@gmail.com on 5 Feb 2013 at 2:14

GoogleCodeExporter commented 9 years ago
Again, this is due to you not having mods or your mods.cache being corrupt. 
This is not actually valid

Original comment by DJG6...@gmail.com on 5 Feb 2013 at 2:25

GoogleCodeExporter commented 9 years ago
This code helped. But correctly reset the cache to remove an error?

Original comment by Xolo...@gmail.com on 20 May 2014 at 9:23

GoogleCodeExporter commented 9 years ago
Same warning applies to 2.4.1. For those who might roll without any vqmods 
listed time to time.

Find:

        foreach(self::$_modFileList as $file) {
            if(file_exists($file)) {
                $lastMod = filemtime($file);
                if($lastMod > self::$_lastModifiedTime){
                    self::$_lastModifiedTime = $lastMod;
                }
            }
        }

Change to:

        if (is_array(self::_modFileList)) {
            foreach(self::$_modFileList as $file) {
                if(file_exists($file)) {
                    $lastMod = filemtime($file);
                    if($lastMod > self::$_lastModifiedTime){
                        self::$_lastModifiedTime = $lastMod;
                    }
                }
            }
        }

Original comment by i...@tim-international.net on 25 Sep 2014 at 9:46