Closed mc12345678 closed 2 years ago
Can't repro on PHP 7.4 or PHP 8.0. What are you doing to put your cart into strict mode?
Can't repro on PHP 7.4 or PHP 8.0. What are you doing to put your cart into strict mode?
Just like @mc12345678 indicated. While not logged in, place an item into the cart, then navigate (via change to the browser's address) to /index.php?main_page=checkout_confirmation; the logs were generated in that case.
I tried this and didn't get a log, but as long as you have fixed and verified, I'm happy.
Describe the bug If a call to the class
navigationHistory->set_snapshot()
is made with an array that does not include all four keys (page
,mode
,get
, andpost
) then a notice is generated in stricter versions of PHP or when PHP is in strict mode.in the method definition: https://github.com/zencart/zencart/blob/7bd505d5bfb3bf1f471be5f9a6c8edd056d43128/includes/classes/navigation_history.php#L101-L125
all four of the keys must be defined to prevent generating a notice; however, nowhere in a default Zen Cart install are all four keys defined when calling this method. At most 2 keys are given.
Based on how the keys were otherwise treated when not provided, would recommend "presetting" the
get
andpost
keys to an empty array if they are not present in passing the array.Generally, the only time that this appears to be the case is when effectively the customer is not logged in and trying to access specific pages.
Version Zen Cart version: 1.5.7c (see that same exists in 1.5.8) PHP version: 7.4 MySQL version: N/A Plugins that may be related: N/A What older/newer versions were also tested?
To Reproduce Steps to reproduce/demonstrate the behavior:
Expected behavior No logs generated.
Debug/Error Logs