Skip to content

After PHP 8: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array -- Quick fix #32

Description

@MBQ2000

Guess no one is using this anymore...

I gave it a go and have the Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array...
Error in Table.php.

I modified the getRowsCount and getColumnsCount functions to address the issue: (starting line 794)

public function getRowsCount()
{   
    if (is_countable($this->_rows)) {
        return count($this->_rows);
	} else { 
	    return 0;
	}
}

public function getColumnsCount()
{
    if (is_countable($this->_columns)) {
		return count($this->_columns);
	} else {
	    return 0;
	}
}

Appears to work fine.
Cheers!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions