Jump to content
Bev

PHP error CubeCart 6.2.8, PHP Ver 7.2.24

Recommended Posts

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.

 

 

Share this post


Link to post
Share on other sites

Two modules - All in one Shipping and a payment module from Handepay - neither of which I can turn off!

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Try a simple search on qwerrty. There should be no products found, and this may trigger the warning.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...