Zen Cart Logo
Forums / Bug Reports / Checkout success array error

Checkout success array error

Views: 11,974

Results 1 to 7 of 7
04 Oct 2019, 18:33
#1
edadk avatar

edadk

Zen Follower

Join Date:
Nov 2008
Posts:
191
Plugin Contributions:
0

Checkout success array error

v156c
php 5.7x
mysql 7.2

Debug log:

--> PHP Warning: sizeof(): Parameter must be an array or an object that implements Countable in /usr/www/users/xxx/includes/modules/pages/checkout_success/header_php.php on line 114.

Line 114:

$flag_show_products_notification = (CUSTOMERS_PRODUCTS_NOTIFICATION_STATUS == '1' and sizeof($notificationsArray)>0 and $flag_global_notifications != '1') ? true : false ;
06 Oct 2019, 08:49
#2
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Checkout success array error

Agree that this is/will become an issue. Working on a PR right now to address this, unless you wish to handle it.

Essentially the variable: $notificationsArray needs to be initialized outside of the if grouping to be an array(). Similar usage of the variable $notificationsArray elsewhere in the code has done this before the identification of the sql query to be executed.

There appear to also be a few other "arrays" in that file that could possibly be not declared before their first use. Looking to also address those as well.

06 Oct 2019, 17:32
#3
edadk avatar

edadk

Zen Follower

Join Date:
Nov 2008
Posts:
191
Plugin Contributions:
0

Re: Checkout success array error

Ok, so would it be correct to make this change a few lines above the problem line:

change from this:

$flag_global_notifications = $global->fields['global_product_notifications'];

if ($flag_global_notifications != '1') {

to this:

$flag_global_notifications = $global->fields['global_product_notifications'];
$notificationsArray = array();
if ($flag_global_notifications != '1') {

Since you mentioned that there may be other defines required, I will watch for updates on that file.

19 Oct 2019, 16:59
#5
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Checkout success array error

mc12345678:

I proposed PR 2861 to address this and potentially related issues. It can be found at: https://github.com/zencart/zencart/pull/2861 with the file changes found at https://github.com/zencart/zencart/2861/files.
The above PR was incorporated (might have had some minor changes incorporated as I'm writing from memory, but those should be evident when reviewing the above.)

24 Oct 2019, 14:38
#6
edadk avatar

edadk

Zen Follower

Join Date:
Nov 2008
Posts:
191
Plugin Contributions:
0

Re: Checkout success array error

I've now implemented those changes. It took a while since testing required checking out.

Thanks for the update.

24 Oct 2019, 17:29
#7
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Checkout success array error

edadk:

I've now implemented those changes. It took a while since testing required checking out.

Thanks for the update.

Excellent. Good work on following up with positive results!