I’ve been getting this error message (posted below) consistently on my Piwik administration dashboard and in some of my goal tracking widgets as well. I tried re-uploading Piwik to my server but that didn’t fix the problem.
Can anyone suggest a fix or a workaround?
Thanks!
There is an error. Please report the message (Piwik 2.0) and full backtrace in the Piwik forums (please do a Search first as it might have been reported already!).
Notice: Undefined index: General in /home/USER/public_html/piwik/plugins/LanguagesManager/API.php on line 132
Backtrace →
#0 Piwik\Error::errorHandler(…) called at [/home/USER/public_html/piwik/plugins/LanguagesManager/API.php:132] #1 Piwik\Plugins\LanguagesManager\API->getAvailableLanguageNames(…) called at [/home/USER/public_html/piwik/plugins/LanguagesManager/LanguagesManager.php:94] #2 Piwik\Plugins\LanguagesManager\LanguagesManager->getLanguagesSelector(…) called at [/home/USER/public_html/piwik/plugins/LanguagesManager/LanguagesManager.php:70] #3 Piwik\Plugins\LanguagesManager\LanguagesManager->showLanguagesSelector(…) called at [:] #4 call_user_func_array(…) called at [/home/USER/public_html/piwik/core/EventDispatcher.php:100] #5 Piwik\EventDispatcher->postEvent(…) called at [/home/USER/public_html/piwik/core/Piwik.php:692] #6 Piwik\Piwik::postEvent(…) called at [/home/USER/public_html/piwik/core/Menu/MenuTop.php:115] #7 Piwik\Menu\MenuTop->getMenu(…) called at [/home/USER/public_html/piwik/core/Plugin/Controller.php:516] #8 Piwik\Plugin\Controller->setGeneralVariablesView(…) called at [/home/USER/public_html/piwik/plugins/Dashboard/Controller.php:42] #9 Piwik\Plugins\Dashboard\Controller->_getDashboardView(…) called at [/home/USER/public_html/piwik/plugins/Dashboard/Controller.php:55] #10 Piwik\Plugins\Dashboard\Controller->embeddedIndex(…) called at [:] #11 call_user_func_array(…) called at [/home/USER/public_html/piwik/core/FrontController.php:117] #12 Piwik\FrontController->dispatch(…) called at [/home/USER/public_html/piwik/index.php:71]
Adding the translations line swamped me with translations, so I added just the filename line and got this:
string(2) “am” string(2) “ar” string(2) “be” string(2) “bg” string(2) “bn” string(2) “bs” string(2) “ca” string(8) “composer”
There is an error. Please report the message (Piwik 2.0) and full backtrace in the Piwik forums (please do a Search first as it might have been reported already!).
Notice: Undefined index: General in /home/USER/public_html/piwik/plugins/LanguagesManager/API.php on line 136
I checked in my lang/ directory and, indeed, there was a composer.json file that was messing this up (all the other json files should be languages). Here’s what composer.json says:
I ran the code you suggested, and it was reading normally until it came across a language called “composer”. I checked in /lang (where language files are) and found /lang/composer.json, which Piwik was trying to get language data out of since it tries to read any .json file in /lang/. Here’s composer.json:
Is it safe to delete/move this file, composer.json?
FYI, here’s one workaround I used that eliminated the error. In API.php line 66, I wrote:
if ($languages) {
foreach ($languages as $language) {
if(strpos($language, "composer") !== FALSE) continue; //LINE 66 - MY ADDITION
$languageNames[] = substr($language, $pathLength, -strlen('.json'));
}
}
It’s a bit hackish but it works. If anyone else has this problem you can use this workaround.