Invalid argument supplied for foreach()


(propionat) #1

Hello,

i speak not good english , but please help me.

Error:

Invalid argument supplied for foreach() 
in '/var/www/vhosts/alles-und-umsonst.de/httpdocs/piwik/core/Config.php' at the line 267

#0  Piwik_ErrorHandler(2, Invalid argument supplied for foreach(), /var/www/vhosts/alles-und-umsonst.de/httpdocs/piwik/core/Config.php, 267, Array ([allSections] => Array ())) called at [/var/www/vhosts/alles-und-umsonst.de/httpdocs/piwik/core/Config.php:267]
#1  Piwik_Config->cacheConfigArray() called at [/var/www/vhosts/alles-und-umsonst.de/httpdocs/piwik/core/Config.php:311]
#2  Piwik_Config->__get(Plugins) called at [/var/www/vhosts/alles-und-umsonst.de/httpdocs/piwik/core/FrontController.php:206]
#3  Piwik_FrontController->init() called at [/var/www/vhosts/alles-und-umsonst.de/httpdocs/piwik/index.php:58]

or see on Verschenken macht Spass bei ALLES-UND-UMSONST - kostenlose Kleinanzeigen

i have piwik 0.6.1, but after a server work, piwik goes wrong.

Thank you


(Matthieu Aubry) #2

is your config file readable by the webserver? config/config.ini.php


(propionat) #3

Yes it is.


(vipsoft) #4

please pm your phpinfo


#5

I have the same error but in the current piwik version. I unzip it, change some permissions just in case (tmp and config) and I get that error when I try to access piwik. PHP 5.2.17, no errors from php in the logs.


(vipsoft) #6

naplam: it’s probably not the exact same error if the line number is different.

Please PM your phpinfo and the error message that you’re seeing. Thanks.


(vipsoft) #7

This is the fix:


Index: /trunk/libs/upgradephp/upgrade.php
===================================================================
--- /trunk/libs/upgradephp/upgrade.php (revision 3618)
+++ /trunk/libs/upgradephp/upgrade.php (revision 4047)
@@ -558,9 +558,11 @@
 		}
 
-		for($j = 0; $j < $i; $j++) {
-			if ($process_sections === true) {
-				$result[$sections[$j]] = $values[$j];
-			} else {
-				$result[] = $values[$j];
+		for ($j = 0; $j < $i; $j++) {
+			if (isset($values[$j])) {
+				if ($process_sections === true) {
+					$result[$sections[$j]] = $values[$j];
+				} else {
+					$result[] = $values[$j];
+				}
 			}
 		}

#8

That worked perfectly! thanks a lot