I have updated some views in my theme so that the product images are loaded from a specific folder rather than through the CMS product images.
In order to do this, I use the PHP file_exists() function to check the file exists before trying to include it in the page.
When I enable the cache for the site, the file_exists() function always returns false regardless of what path I put in.
I have also tried the Zend_Validate_File_Exists class but that also returns false when the cache is enabled. I have also tried is_file() and is_readable() to no avail.
I have tried using relative paths as well as getcwd() and $_SERVER['DOCUMENT_ROOT'].
The code always works when the cache is disabled and never works when the cache is enabled.
Am I missing something or is this a bug?
Magento CE 22.214.171.124 and PHP 5.4