Does the development team want reports of PHP error notices for core files (except duplicate defines)? ZC v1.5.5f, PHP 7.1.18.
Dave
Does the development team want reports of PHP error notices for core files (except duplicate defines)? ZC v1.5.5f, PHP 7.1.18.
Dave
I love it when Zenners come up with the same ideas in just a few hours time difference. It's like we all share a common sense.
I have made a few PR on GitHub regarding the same issue.
see :https://github.com/zencart/zencart/pulls
One PHP notice is:
[30-Apr-2018 13:56:03 America/New_York] PHP Notice: Undefined offset: 1 in .../includes/functions/functions_email.php on line 135
The associated code is:
Line 135 is $zen_fix_replace = $zen_fix_currencies[$i+1];Code:// clean up currencies for text emails $zen_fix_currencies = preg_split("/[:,]/" , str_replace(' ', '', CURRENCIES_TRANSLATIONS)); $size = sizeof($zen_fix_currencies); for ($i=0, $n=$size; $i<$n; $i+=2) { $zen_fix_current = $zen_fix_currencies[$i]; $zen_fix_replace = $zen_fix_currencies[$i+1]; if (strlen($zen_fix_current)>0) { while (strpos($email_text, $zen_fix_current)) $email_text = str_replace($zen_fix_current, $zen_fix_replace, $email_text); } }
Looks like $zen_fix_currencies[1] is undefined. Couldn't find CURRENCIES_TRANSLATIONS defined either.
CURRENCIES_TRANSLATIONS is a constant in the database in the configuration table
Thank you Design75 for helping me find CURRENCIES_TRANSLATIONS. The problem with this error is that CURRENCIES_TRANSLATIONS can be blank like on my system that deals only with USD. Thus preg_split returns a single element array, the size is 1, so $zen_fix_currencies[1] is undefined.
Yes, there are a lot of variables like that. Checks need to be build in to see if variables are set, or are of the correct/expected type, like array or string.
Older php versions didn't care, so programming could be "sloppy", but newer versions get more tight, so now we get notices.
To solve these, try to think of a way to check, and output a correct result.