This is what happens when you don’t pay attention. I was working on a project that started out when Magento was the latest stable version. There is a bit of development left, but I decided to upgrade the install to 1.4.2 via subversion. I go get some coffee, come back, and assume the upgrade is done.

Then I try to load the homepage, and I get a blank screen. Eh, ok. Time to display errors by commenting the following line in index.php.

ini_set(‘display_errors’, 1);

Lets see what the logs say:

PHP Fatal error: Undefined class constant ‘TYPE_CONDITION’ in /home/dev/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php on line 296

Well, what exactly is the code throwing this error? In Abstract.php:

 if (!empty($conditionSql)) { $this-&gt;getSelect()-&gt;where($conditionSql, null, Varien_Db_Select::TYPE_CONDITION); } else { Mage::throwException(‘Invalid attribute identifier for filter (‘.get_class($attribute).’)’); }<br /><br /> return $this; }

How can Varien_Db_Select::TYPE_CONDITION not exist? I looked at my Varien/DB/Select.php and there was no TYPE_CONDITION. Then I looked at Varien_Db_Select in the Magento docs, and it was there. Weird.

Then I looked back at the terminal which was doing Subversion update, and noticed that there was an error. Apparently my Internet connection had died and the update didn’t complete. Ugh.

After restarting the Subversion update, I look at Varien_Db_Select:

class Varien_Db_Select extends Zend_Db_Select{ const TYPE_CONDITION = ‘TYPE_CONDITION’;<br /><br /> const STRAIGHT_JOIN_ON = ‘straight_join’; const STRAIGHT_JOIN = ‘straightjoin’; const SQL_STRAIGHT_JOIN = ‘STRAIGHT_JOIN’;

There it is.

Moral of the story. Make sure your updates actually complete before making such an assumption.

Make Haste Slowly

Are you tired of all the bullshit business, marketing and technology news out there? Do you have a bad case of FOMO? The signal to noise ratio is entirely out of whack nowadays. All the incentives are misaligned. If you want an unbiased view on on the intersection of technology, marketing, products/services and the impacts on consumers, businesses, and society in general, sign up below.

You have Successfully Subscribed!