Portman Posted September 19, 2019 Share Posted September 19, 2019 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. Link to comment Share on other sites More sharing options...
BrockleyJohn Posted September 19, 2019 Share Posted September 19, 2019 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); Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released. Looking for a payment or shipping module? Maybe I've already done it. Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x Link to comment Share on other sites More sharing options...
Portman Posted September 21, 2019 Author Share Posted September 21, 2019 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. Link to comment Share on other sites More sharing options...
BrockleyJohn Posted September 21, 2019 Share Posted September 21, 2019 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. Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released. Looking for a payment or shipping module? Maybe I've already done it. Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x Link to comment Share on other sites More sharing options...
Portman Posted September 23, 2019 Author Share Posted September 23, 2019 Thanks @BrockleyJohn, that prompted me to find an error in the code that was causing the warning Link to comment Share on other sites More sharing options...
♥Gyakutsuki Posted September 23, 2019 Share Posted September 23, 2019 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 Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.