Bev Posted December 2, 2019 Share Posted December 2, 2019 count(): Parameter must be an array or an object that implements Countable in /home/portasol/public_html/acs/classes/db/database.class.php on line 708 I have searched this error and came up with nothing for CubeCart specifically. The code at line 708 is if (count($this->_result) >= 1 && is_array($this->_result)) { foreach ($this->_result as $row) { $output[] = $row; } // Added cleverness for auto pagination, without running a second query if (!is_null($calc_rows)) { $count_query = 'SELECT FOUND_ROWS() as Count;'; if ($count = $this->_getCached($parent_query.$count_query)) { $this->_found_rows = $count[0]['Count']; } elseif ($count = $this->misc($count_query, false)) { // Cache managed here not in DB->query $this->_found_rows = $count[0]['Count']; $this->_writeCache($count, $parent_query.$count_query); } } return ($output) ? $output : false; } return false; } Any clues please? Store Overview says CubeCart Version 6.2.8 PHP Version (7.2 Recommended) 7.2.24 MySQL Version 5.5.5-10.0.38-MariaDB The only other thing I can think of that may be relevant is that my host added IonCube at my request - phpinfo() shows This program makes use of the Zend Scripting Language Engine: Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies with the ionCube PHP Loader + ionCube24 v10.3.9, Copyright (c) 2002-2019, by ionCube Ltd. Link to comment Share on other sites More sharing options...
Noodleman Posted December 2, 2019 Share Posted December 2, 2019 per chance are you using any modules? I fixed a defect in one my modules that triggered this error recently. Link to comment Share on other sites More sharing options...
Bev Posted December 2, 2019 Author Share Posted December 2, 2019 Two modules - All in one Shipping and a payment module from Handepay - neither of which I can turn off! Link to comment Share on other sites More sharing options...
bsmither Posted December 2, 2019 Share Posted December 2, 2019 Please try to replicate what you asked CubeCart to do when you got this error. This error is probably the result of a query that returned no results. If you can do this, then perform this experiment: In /classes/db/database.class.php, near line 708, find: if (count($this->_result) >= 1 && is_array($this->_result)) { Change to: if (is_array($this->_result) && count($this->_result) >= 1) { I suspect a recent version of PHP has changed the method of quickly determining if a condition is true or false. This change will first test if the variable is an array and quit at this point when the entire condition is now determined to be false. Link to comment Share on other sites More sharing options...
Bev Posted December 2, 2019 Author Share Posted December 2, 2019 Interesting, the error has magically stopped happening. It was happened 6 times in 3 hours, and now hasn't errored for nearly 4 hours. I will play and see if I can get it to do it again. Link to comment Share on other sites More sharing options...
bsmither Posted December 2, 2019 Share Posted December 2, 2019 Try a simple search on qwerrty. There should be no products found, and this may trigger the warning. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.