All of a sudden, I'm getting defined constant errors when trying to view cached images.
Example image URL:
Notice: Constant DS already defined in app/Mage.php on line 27 Notice: Constant PS already defined in app/Mage.php on line 28 Notice: Constant BP already defined in app/Mage.php on line 29
From the searching I've done, this usually happens when Magento is being bootstrapped into an application that uses the same constants, or (for some reason) bootstrapped into itself.
However, as far as I know, none of that craziness is happening here. It's pretty vanilla Magento, and yet I'm suddenly getting these errors on some images.
Any ideas? I'm not really sure where to start.
PS: It looks like this URL path is loading
get.php and not
index.php so this isn't your normal page load. Still, I don't know why this is happening.
Update: Clearing the image cache fixed the issue, but I'd still like to find out why this happened so that I can prevent it.
Update 2: Not only is this reproducable, (just try to load any image that doesn't exist from the image cache,) and did not "go away on it's own," (I had to clear the cache to make it go away,) but I've also figured out the cause. I would appreciate it if moderators weren't so quick to close questions without actually reading the post.
Answer: Version 2.1.0 of the Extendware Full Page Cache module includes it's own autoloader at
app/code/local/Varien/Autoload.php This includes the following at the top of the file:
if (defined('DS') === false) define('DS', DIRECTORY_SEPARATOR); if (defined('PS') === false) define('PS', PATH_SEPARATOR); if (defined('BP') === false) define('BP', dirname(dirname(dirname(dirname(dirname(__FILE__))))));
app/Mage.php include this:
define('DS', DIRECTORY_SEPARATOR); define('PS', PATH_SEPARATOR); define('BP', dirname(dirname(__FILE__)));
The problem is that
get.php first includes the
Varien/Autoload.php (on line 59 in version 18.104.22.168) and then includes
app/Mage.php after that (on line 96 in version 22.214.171.124.) The end result is that
Mage.php is trying to redefine the constants. This is not an htaccess issue but is just an issue with this module.
The best solution is to have Extendware fix the issue using variables instead of these constants. (Their code is encrypted using Ioncube, so changing it myself isn't an option.)