ERR (3): Notice: Uninitialized string offset: 0
-
29-09-2020 - |
Question
Magento 1.9.2.3 Extension Causing error: Ameex Admin Activity Logger (Commerce Bees) Error in system.log - over and over again
Full error: ERR (3): Notice: Uninitialized string offset: 0 in /MyServerInfo/public_html/app/code/community/Ameex/Adminlog/Model/Observer.php on line 27
Code from line 27 of Observer.php:
$currentId = $request->getParam($dynamicValues[0]);
Full section of code that seems related to this error:
$adminlog = Mage::getModel('adminlog/adminlog');
$dynamicValues = $this->_getDynamicValues($controllerName);
$currentId = $request->getParam($dynamicValues[0]);
$storeId = $request->getParam('store');
$store = Mage::getModel('core/store')->load($storeId);
Otherwise the extension seems to work fine, but I would like to stop this error occurring. First of all because I'm not sure what it could be doing that I don't see and because it's filling up my system.log file and I don't like errors. I contacted Extension creator, but there has been no response in several weeks. Any help would be appreciated.
Solution
It is not an error, it is just a notice, you can ignore it.
Otherwise fix it in this way:
$currentId = count($dynamicValues) ? $request->getParam($dynamicValues[0]) : null;
Also try:
$currentId = isset($dynamicValues[0]) ? $request->getParam($dynamicValues[0]) : null;
You can also suppress notices in PHP by changing the error_reporting
php ini value.
You probably have E_ALL
. You can safely change it to E_ALL & ~E_NOTICE
.