RhymeDigital / isotope_feeds

Updated implementation for creating Product Feeds in Isotope eCommerce for Contao Open Source CMS
GNU Lesser General Public License v3.0
3 stars 6 forks source link

Error during cron "Call to a member function getLocale() on null" in Helper/IsotopeFeeds.php:253 #39

Closed michb closed 1 year ago

michb commented 1 year ago

I noticed not all of my daily crons where executed. So i found following error in the logs:

[2023-03-07 12:18:12] request.CRITICAL: Uncaught PHP Exception Error: "Call to a member function getLocale() on null" at 
/var/www/html/.../vendor/rhymedigital/isotope-feeds/src/Helper/IsotopeFeeds.php line 253 {"exception":"
[object] (Error(code: 0): Call to a member function getLocale() on null at 
/var/www/html/.../vendor/rhymedigital/isotope-feeds/src/Helper/IsotopeFeeds.php:253)"} []

Then I digged deeper and found that if you check this in the "https://domain.local/_contao/cron" route there will be no error but if try to log the result in a real cron execution you recieve the above error.

Short fix for now is setting the feedLanguage in the database.

blairwinans commented 1 year ago

@michb I added a check for no request stack in 2c50180c500b17ca11264b015c6c8c786fc9f6f8, and if nothing is set up in the config, I am defaulting to 'en' when nothing is available.