Jump to content

PHP error CubeCart 6.2.8, PHP Ver 7.2.24


Bev

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.

 

 

Link to comment
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.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...