lat9 / gpsf

An update to the previous Numinix version, now supporting Zen Carts 1.5.6 and above (including 1.5.8a) as well as PHP versions 5.6 through 8.2.
GNU General Public License v2.0
2 stars 2 forks source link

Protect against misconfigured attributes and missing master_categories_ids #8

Closed lat9 closed 1 year ago

lat9 commented 1 year ago

If a product's attributes are configured improperly, e.g. I found a site that has a couple of attributes with an options_id value of 0, the feed's generation results in PHP Deprecated logs similar to:

#0 [internal function]: zen_debug_error_handler()
#1 C:\xampp\htdocs\mysite\includes\classes\gpsfFeedGenerator.php(859): strtolower()
#2 C:\xampp\htdocs\mysite\includes\classes\gpsfFeedGenerator.php(335): gpsfFeedGenerator->getProductsAttributes()
#3 C:\xampp\htdocs\mysite\gpsf_main_controller.php(165): gpsfFeedGenerator->generateProductsFeed()
--> PHP Deprecated: strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in C:\xampp\htdocs\mysite\includes\classes\gpsfFeedGenerator.php on line 859.

Similar issues arise when a product's master_categories_id doesn't exist; the product's addition to the feed should be skipped in this case.