GordonLesti / Lesti_Fpc

Simple Magento Fullpagecache
https://gordonlesti.com/lesti-fpc-documentationversion-1-4-5/
Other
358 stars 159 forks source link

error 500 lesti fpc update to 1.4.8 #332

Open mbensoussan opened 5 years ago

mbensoussan commented 5 years ago

Hi, after a big update :

magento version 1.9.3.10 php : 7.2.11 lesti_fpc : 1.4.8

when i turn on lesti_fpc in the cache management, all my website show me an error 500.

you can see the erro bellow, if you have an idea...

Fatal error: Uncaught Error: Call to undefined method Lesti_Fpc_Helper_Data::getContentType() in /var/www/clients/client1/web1/web/magento/app/code/community/Lesti/Fpc/Model/Observer.php:137 Stack trace:

0 /var/www/clients/client1/web1/web/magento/app/code/core/Mage/Core/Model/App.php(1358): Lesti_Fpc_Model_Observer->httpResponseSendBefore(Object(Varien_Event_Observer))

1 /var/www/clients/client1/web1/web/magento/app/code/core/Mage/Core/Model/App.php(1337): Mage_Core_Model_App->_callObserverMethod(Object(Lesti_Fpc_Model_Observer), 'httpResponseSen...', Object(Varien_Event_Observer)) #2 /var/www/clients/client1/web1/web/magento/app/Mage.php(451): Mage_Core_Model_App->dispatchEvent('http_response_s...', Array)

3 /var/www/clients/client1/web1/web/magento/app/code/core/Mage/Core/Controller/Response/Http.php(83): Mage::dispatchEvent('http_response_s...', Array)

4 /var/www/clients/client1/web1/web/magento/app/code/core/Mage/Core/Controller/Varien/Front.php(184): Mage_Core_Controller_Response_Http->sendResponse()

5 /var/www in /var/www/clients/client1/web1/web/magento/app/code/community/Lesti/Fpc/Model/Observer.php on line 137

GordonLesti commented 5 years ago

Dear @mbensoussan I guess something went wrong with your update. The method Lesti_Fpc_Helper_Data::getContentType exists and it is callable. Please double check if the code in your shop matches with the one at Github.

Best Regards Gordon

mbensoussan commented 5 years ago

yes i confirm all the files are the same,, If i comment the line bellow (observer line 137), the website work again

            /*$this->_getFpc()->save(
                new Lesti_Fpc_Model_Fpc_CacheItem($body, time(), Mage::helper('fpc')->getContentType($response)),
                $key,
                $this->_cacheTags
            );*/

i continu my investigation... but for the moment i don't understand.

mbensoussan commented 5 years ago

the bug come from this line : new Lesti_Fpc_Model_Fpc_CacheItem($body, time(), Mage::helper('fpc')->getContentType($response)),

if i replace with : new Lesti_Fpc_Model_Fpc_CacheItem($body, time(), 'text/html; charset=UTF-8'),

the website work, but it's not the solution.

mbensoussan commented 5 years ago

ok so,

when the function :

public function getContentType(\Mage_Core_Controller_Response_Http $response) { foreach ($response->getHeaders() as $header) { if (isset($header['name']) && $header['name'] === 'Content-Type' && isset($header['value'])) { return $header['value']; } } return 'text/html; charset=UTF-8'; }

is in lesti/fpc/helper/data.php, it's like magento don't found him

but if i copy paste the function in lesti/fpc/helper/abstract.php it's work and i have no error.

so i think the files lesti/fpc/helper/data.php don't extends Lesti_Fpc_Helper_Abstract.

why ... for the moment i don't know.

mbensoussan commented 5 years ago

i really don't understand what happen, if you have an idea ?

GordonLesti commented 5 years ago

Did you made sure that your Magento version runs fine with PHP 7.2? https://community.magento.com/t5/News-Announcements/PHP-7-2-Support-Patches-for-Magento-1-are-now-available/td-p/106999

mbensoussan commented 5 years ago

yes, i have make a big test from all the website. i will found the solution ..

perhaps i can now if the abstract class is instantiate ?

mbensoussan commented 5 years ago

all it's work.. i'm just so bad.

i forgot that i have make a surchage in the local directory about the helper data...

sorry for the time. and thank's for you module, it's make a really good job !