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

preg_match needs a different delimiter... #2

Closed proseLA closed 1 year ago

proseLA commented 1 year ago

i am getting the following error (on numerous products):

[20-Jun-2023 01:52:30 Europe/London] Request URI: /gpsf_main_controller.php?key=&feed=fy_un_tp&limit=0&offset=0&currency_code=USD&language_id=1, IP address: 192.168.14.72
#1  preg_match() called at [/var/www/includes/classes/gpsfFeedGenerator.php:1332]
#2  gpsfFeedGenerator->isStringInArray() called at [/var/www/includes/classes/gpsfFeedGenerator.php:851]
#3  gpsfFeedGenerator->getProductsAttributes() called at [/var/www/includes/classes/gpsfFeedGenerator.php:335]
#4  gpsfFeedGenerator->generateProductsFeed() called at [/var/www/gpsf_main_controller.php:170]
--> PHP Warning: preg_match(): Unknown modifier '3' in /var/www/includes/classes/gpsfFeedGenerator.php on line 1332.

i am no preg_match expert, but it seems that changing the delimiter to something like:

$string_to_find = '@\b' . $find_string . '\b@i';

seems to address the error.

https://github.com/lat9/gpsf/blob/3d645d4c7a457bcc6dab16e412e75d64ef28b2b4/includes/classes/gpsfFeedGenerator.php#L1328-L1335