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__))))));

However, app/Mage.php include this:

define('BP', dirname(dirname(__FILE__)));

The problem is that get.php first includes the Varien/Autoload.php (on line 59 in version and then includes app/Mage.php after that (on line 96 in version 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.)

  • Was anything changed in the .htaccess? – Sander Mangel May 19 '15 at 19:49
  • Not in many months. – Tyler V. May 19 '15 at 19:50
  • obvious question.. does the image exist? Can you find it via FTP? – Sander Mangel May 19 '15 at 19:51
  • There actually wasn't even a folder at media/catalog/product/cache so I assumed it was doing some htaccess magic. I'll check it next time this happens though. – Tyler V. May 19 '15 at 19:52
  • the get.php is a fallback downloader if the file doesn't exists. still, it's weird you're not getting a 404 as it should give – Sander Mangel May 19 '15 at 19:53

Browse other questions tagged or ask your own question.