Strict Notice: Only variables should be passed by reference in Mysql.php

Posted by Damodar Bashyal on April 11, 2012

 

I just took one website live and to my surprise i got this error for the very first time.

Strict Notice: Only variables should be passed by reference in /home/technooze/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php on line 2658

#0 /home/technooze/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(2658): mageCoreErrorHandler(2048, 'Only variables ...', '/home/technooze/...', 2658, Array)
#1 /home/technooze/public_html/lib/Varien/Data/Collection/Db.php(442): Varien_Db_Adapter_Pdo_Mysql->prepareSqlCondition('attribute_code', Array)
#2 /home/technooze/public_html/lib/Varien/Data/Collection/Db.php(376): Varien_Data_Collection_Db->_getConditionSql('attribute_code', Array)
#3 /home/technooze/public_html/app/code/core/Mage/Eav/Model/Resource/Entity/Attribute/Collection.php(413): Varien_Data_Collection_Db->addFieldToFilter('attribute_code', Array)
#4 /home/technooze/public_html/app/code/core/Mage/Eav/Model/Config.php(611): Mage_Eav_Model_Resource_Entity_Attribute_Collection->setCodeFilter(Array)
#5 /home/technooze/public_html/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php(424): Mage_Eav_Model_Config->loadCollectionAttributes('catalog_categor...', Array)
#6 /home/technooze/public_html/app/code/core/Mage/Catalog/Model/Resource/Category/Tree.php(382): Mage_Eav_Model_Entity_Collection_Abstract->addAttributeToSelect(Array)
#7 /home/technooze/public_html/app/code/core/Mage/Catalog/Model/Resource/Category/Tree.php(345): Mage_Catalog_Model_Resource_Category_Tree->_getDefaultCollection(false)
#8 /home/technooze/public_html/app/code/core/Mage/Catalog/Model/Resource/Category/Tree.php(136): Mage_Catalog_Model_Resource_Category_Tree->getCollection(false)
#9 /home/technooze/public_html/app/code/core/Mage/Catalog/Model/Resource/Category.php(576): Mage_Catalog_Model_Resource_Category_Tree->addCollectionData(NULL, false, '3', true, true)
#10 /home/technooze/public_html/app/code/core/Mage/Catalog/Model/Category.php(820): Mage_Catalog_Model_Resource_Category->getCategories('3', 0, false, false, true)
#11 /home/technooze/public_html/app/code/core/Mage/Catalog/Helper/Category.php(82): Mage_Catalog_Model_Category->getCategories('3', 0, false, false, true)
#12 /home/technooze/public_html/app/code/core/Mage/Catalog/Block/Navigation.php(117): Mage_Catalog_Helper_Category->getStoreCategories()
#13 /home/technooze/public_html/app/design/frontend/technooze/default/template/techymenu/top.phtml(42): Mage_Catalog_Block_Navigation->getStoreCategories()
#14 /home/technooze/public_html/app/code/core/Mage/Core/Block/Template.php(241): include('/home/technooze/...')
#15 /home/technooze/public_html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/technooze...')
#16 /home/technooze/public_html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#17 /home/technooze/public_html/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Template->_toHtml()
#18 /home/technooze/public_html/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml()
#19 /home/technooze/public_html/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Text_List->_toHtml()
#20 /home/technooze/public_html/app/code/core/Mage/Core/Block/Abstract.php(582): Mage_Core_Block_Abstract->toHtml()
#21 /home/technooze/public_html/app/code/core/Mage/Core/Block/Abstract.php(526): Mage_Core_Block_Abstract->_getChildHtml('topMenu', true)
#22 /home/technooze/public_html/app/design/frontend/technooze/default/template/page/html/header.phtml(47): Mage_Core_Block_Abstract->getChildHtml('topMenu')
#23 /home/technooze/public_html/app/code/core/Mage/Core/Block/Template.php(241): include('/home/technooze/...')
#24 /home/technooze/public_html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/technooze...')
#25 /home/technooze/public_html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#26 /home/technooze/public_html/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Template->_toHtml()
#27 /home/technooze/public_html/app/code/core/Mage/Core/Block/Abstract.php(582): Mage_Core_Block_Abstract->toHtml()
#28 /home/technooze/public_html/app/code/core/Mage/Core/Block/Abstract.php(526): Mage_Core_Block_Abstract->_getChildHtml('header', true)
#29 /home/technooze/public_html/app/design/frontend/technooze/default/template/page/1column.phtml(42): Mage_Core_Block_Abstract->getChildHtml('header')
#30 /home/technooze/public_html/app/code/core/Mage/Core/Block/Template.php(241): include('/home/technooze/...')
#31 /home/technooze/public_html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/technooze...')
#32 /home/technooze/public_html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#33 /home/technooze/public_html/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Template->_toHtml()
#34 /home/technooze/public_html/app/code/core/Mage/Core/Model/Layout.php(529): Mage_Core_Block_Abstract->toHtml()
#35 /home/technooze/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(391): Mage_Core_Model_Layout->getOutput()
#36 /home/technooze/public_html/app/code/core/Mage/Cms/Helper/Page.php(132): Mage_Core_Controller_Varien_Action->renderLayout()
#37 /home/technooze/public_html/app/code/core/Mage/Cms/Helper/Page.php(52): Mage_Cms_Helper_Page->_renderPage(Object(Mage_Cms_IndexController), 'home')
#38 /home/technooze/public_html/app/code/core/Mage/Cms/controllers/IndexController.php(45): Mage_Cms_Helper_Page->renderPage(Object(Mage_Cms_IndexController), 'home')
#39 /home/technooze/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(420): Mage_Cms_IndexController->indexAction()
#40 /home/technooze/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('index')
#41 /home/technooze/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#42 /home/technooze/public_html/app/code/core/Mage/Core/Model/App.php(349): Mage_Core_Controller_Varien_Front->dispatch()
#43 /home/technooze/public_html/app/Mage.php(640): Mage_Core_Model_App->run(Array)
#44 /home/technooze/public_html/index.php(80): Mage::run('', 'store')
#45 {main}

After spending a lot of time i found that eAccelerator was causing that. So, I updated my .htaccess file with this:

eaccelerator.enable 0
eaccelerator.optimizer 0

But after that I got PDO missing error, so i added this below on the same file php.ini and then it worked fine.

extension=pdo.so
extension=pdo_sqlite.so
extension=sqlite.so
extension=pdo_mysql.so

Some of the fixes for old magento/zend versions seems to be this: (i didn't needed to do)

On file: lib/Zend/Db/Select.php
Replace on about line 246

if ($correlationName === null && count($this->_parts[self::FROM])) {
    $correlationName = current(array_keys($this->_parts[self::FROM]));
}

with:

if ($correlationName === null && count($this->_parts[self::FROM])) {
    $correlationNameKeys = array_keys($this->_parts[self::FROM]);
    $correlationName = current($correlationNameKeys);
}

And, if you see this on the front end: then in Toolbar.php on around line 373 change:

return current(array_keys($this->_availableMode));

to:

$arrayKeys = array_keys($this->_availableMode);
return current($arrayKeys);

Found one more on one forum:
on file: lib/Varien/Db/Adapter/Pdo/Mysql.php in line 2602 change:

$key = key(array_intersect_key($condition, $conditionKeyMap));

to:

$tmp = array_intersect_key($condition, $conditionKeyMap);
$key = key($tmp);
 
not published on website


QR Code: Strict Notice: Only variables should be passed by reference in Mysql.php