Bug in Magento 1.6.1.0/1.6.2.0 affecting development sites using base_url

Advertisements

I installed a copy of Magento 1.6.1.0 on a dev site I setup to do some testing with Varnish with (more on that later). However, in the requirement to be able to get to Magento using 2 different URL’s, I stumbled across this quite annoying bug.

a:5:{i:0;s:67:"Illegal scheme supplied, only alphanumeric characters are permitted";i:1;s:729:"#0 /home/dan/workspace/magento1610/app/code/core/Mage/Core/Model/Store.php(712): Zend_Uri::factory('{{base_url}}')
#1 /home/dan/workspace/magento1610/app/code/core/Mage/Core/Controller/Varien/Front.php(313): Mage_Core_Model_Store->isCurrentlySecure()
#2 /home/dan/workspace/magento1610/app/code/core/Mage/Core/Controller/Varien/Front.php(161): Mage_Core_Controller_Varien_Front->_checkBaseUrl(Object(Mage_Core_Controller_Request_Http))
#3 /home/dan/workspace/magento1610/app/code/core/Mage/Core/Model/App.php(349): Mage_Core_Controller_Varien_Front->dispatch()
#4 /home/dan/workspace/magento1610/app/Mage.php(640): Mage_Core_Model_App->run(Array)
#5 /home/dan/workspace/magento1610/index.php(80): Mage::run('', 'store')
#6 {main}";s:3:"url";s:85:"/index.php/admin/system_config/edit/section/web/key/41c8c3d3f4bcb72e3c267ae0b73333d7/";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:7:"default";}

Bug reports on Magento’s site here, here, here and here. Not being patient enough for Varien to fix it, I developed a small extension which resolves the problem. It’s available to download below.

Put the tarball in the Magento webroot and extract. After you install this extension, you’ll need to empty the cache manually (if it was enabled). I assume if you’re reading this, then your Magento installation is broken. To do this, simply remove the contents of var/cache in Magento’s webroot.

When you re-visit your Magento’s front or backend, the problem should vanish.

[download id=”24″ format=”7″]

Updated 9th January 2012: It apparent that, attempting to login before applying this update with {{base_url}} set screws up the admin login cookies somehow. When you apply this patch, you’ll probably need to empty out your chosen browser’s cookie jar before attempting to login. You can tell if you need to or not by trying to login, and Magento coming back to you with a login screen, with no failed login message.

Updated 12th January 2012: Magento 1.6.2.0 was released today. I can confirm that this problem still exists and has not yet been fixed (despite what the developers have written on one of the bug reports).

Updated 25th April 2012: I can confirm that this problem has been resolved in the latest 1.7.0.0 version, released 24th April 2012.

Join the Conversation

89 Comments

  1. Hello,

    I still can’t login even after clearing the var/cache folder and my browser (google chrome). Any idea as to what may be going?

  2. Amazing! This worked like a charm. I wish I was this good at fixing Magento! Great job and thank you!!!

  3. Thank you very much for this great post. I’hv finally installed magento in my localhost.

    Also need a little help on installing the sample data. Still i’m unable to import. Every time it’s exceeding mysql execution time limit. Can you please help me to resolve this issue?

  4. First time user of Magento and installed on Wampserver and loaded sample data. Then couldn’t login into admin store and then finally the error reported as above. I’m not clear on how to install the tz extension on Wampserver. Any assistance would be apprecieated. Cheers.

  5. This is not working with 1.6.2!
    Clear browser cookies, remove cache and install update but still login screen coming back.

    No success for far!

  6. @pankaj;
    This plugin is only for resolving the use of {{base_url}} in the base secure and unsecure URL fields in Magento’s admin for development purposes. It looks like your store isn’t configured with {{base_url}}, so this extention won’t help you.

    What value do you have in your base_secure_url and base_unsecure_url (search the core_config_data table for ‘path LIKE “web/%secure/base_url”‘)? They should be in the form “http://www.giftistic.com/” and “https://www.giftistic.com/”. If it’s not these, change them, then you’ll need to flush Magento’s caches manually, by simply removing the contents of var/cache. If you use memcached or APC you’ll need to flush that too.

Leave a comment

Your email address will not be published. Required fields are marked *