Jump to content

Recommended Posts

Hi, 

Im hoping this is a quick question with an easy answer...

I have just updated my server from 5.6 to 7.3 and am just experiencing an error I can't work out how to fix...

the error is;

PHP Warning:  sizeof(): Parameter must be an array or an object that implements Countable in.....

and the line of code in question is;

                for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {

Any help would be appreciated.

Share this post


Link to post
Share on other sites

The easy answer is: turn off displaying warnings.

It's a warning not an error until some future version of php.

in includes/application_top.php find:

  error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT);
  ini_set('display_errors',1);

on a live site you may not want to display any error messages to the public, in which case in the second line change 1 to 0 (zero) or if you want only to suppress warnings, change the first line to

  error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_WARNING);

 


For a new install or if your store isn't mobile-friendly, get the community-supported responsive osCommerce (Phoenix).

here: on the official osc download page

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Share this post


Link to post
Share on other sites

Thanks @BrockleyJohn,

I will apply your suggestion - I'm a bit bummed though because I was hoping it was the cause to a problem I was having with this module... sigh, time to keep searching for a solution.

Share this post


Link to post
Share on other sites

It's throwing that warning because the order instance it's trying to process has no products in it. That doesn't sound like a valid order to me, and could well indicate a problem with the construction of the order instance. If it's an existing order read from the database, check the database order to make sure it was created properly.

 


For a new install or if your store isn't mobile-friendly, get the community-supported responsive osCommerce (Phoenix).

here: on the official osc download page

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Share this post


Link to post
Share on other sites
for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {

by

if (is_array($order->products) {
for ($i=0, $n=count($order->products); $i<$n; $i++) {

 



Regards
-----------------------------------------
Loïc

Contact me by skype for business
Contact me @gyakutsuki for an answer on the forum

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×