Magento - Notice: Undefined index: 0 in Config.php on line 88

Magento - Notice: Undefined index:  0 in Config.php on line 88

I just ran across an error transferring a Magento site from one host to another and wanted to share the solution here. The fix is fairly simple however the debug process to track down the fix was quite involved.

 

The Problem:

After an export/import of the Magento database I ran into the following two errors when trying to access the site.

The first error I ran into after moving the site was the following:

Notice: Undefined index:  0 in/app/code/core/Mage/Core/Model/Mysql4/Config.php on line 88 

 

The solution:

The solution to this error was to add the following two lines to the top of my sql import file.

SET FOREIGN_KEY_CHECKS = 0 ;

SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

The first line fixes a common issue with Magento when trying to export/import databases where you get an error about foreign constraints.

The second line fixes  an issue where associative id's are automatically changed by MySQL which breaks the association.The specific values that get changed and cause this error are:

Table = core_store | Values = store_id & website_id

The correct values are: 

store_idcodewebsite_idgroup_idnamesort_orderis_active
0 admin 0 0 Admin 0 1
1 default 1 1 Default Store View 0 1

Table = core_website | Values =  website_id 

The correct values are: 

website_idcodenamesort_orderdefault_group_idis_default
0 admin Admin 0 0 0
1 base Main Website 0 1 1

Basically the website_id column in core_store must match thewebsite_id column in core_website and the store_id for admin in core_store must be 0. 

 

The Second Problem:

After fixing the first issue I ran into a second error message as follows:

Recoverable Error: Argument 1 passed to Mage_Core_Model_Store::setWebsite() must be an instance 
of Mage_Core_Model_Website, null given, called in... ...app/code/core/Mage/Core/Model/App.php on 
line 341 [0] in Mage_Core_Model_Store->setWebsite(NULL) in...

 

The Second Solution:

This is because the id's from the first issue where cached so in short... delete everything in var/cache/ and you should be home free! 

 

Comments


Boise Web Design

Established in the City of Trees in Boise Idaho in 2002, Vector Network Solutions is now a leading web development company providing Boise web design with over ten years of experience. Leading the way with a proven track record on the industries top web platforms, VectorNS is capable of delivering exceptional solutions to clients around the globe. Our strategic methods afford us the ability to provide Boise with web design, development and a sharp competitive edge. Call or e-mail today to start initiating your project with the experienced professionals at VectorNS.

Free Web Tips & Ideas!

Sign up for VectorNS Web Tips and recieve occasional tips & ideas to enhance your web presence.