Phpmyadmin export issue: count(): Parameter must be an array or an object that implements Countable
It seems we can't remove all the issues from PhpMyAdmin with PHP 7.2+. But we can remove this issue by change in one line in file libraries/plugin_interface.lib.php
file at line no 532.
Below is the screenshot for the fix.
Before fix code looks like:-
After fix code looks like:-
Above is the only fix to solve error messages in export database screen.
Trying to update to PHP 7.4 but getting this error in an element, Warning: count(): Parameter must be an array or an object that implements Countable
from the WordPress documentation about get_the_terms
:
Return: Array of WP_Term objects on success, false, if there are no terms or the post, does not exist, WP_Error on failure.
that means get_the_terms
function will return 1 of these 3 options :
- false
- error
- array
if the post has some "terms" then you will get no warnings, but it occurs when you try to count some results that are not a valid array (or any countable object).
so you can check for it befor you try to count the fetched terms :
if(is_array($type_terms))
$type_count = count($type_terms);
else
$type_count = [];
or with ternary operation:
$type_count = is_array($type_terms) ? count($type_terms); : [] ;
Related Topics
How to Limit File Upload Type File Size in PHP
How to Get the Total Number of Rows of a Group by Query
How to Get Ssl Certificate Info with Curl in PHP
How to Run PHP Files on My Computer
PHP Move_Uploaded_File() Error
Multidimensional Array Array_Sum
Remove Duplicate from String in PHP
Php: Check If a File Is Loaded Directly Instead of Including
Replace Multiple Newlines, Tabs, and Spaces
Special Characters in PHP/Mysql
Utf-8 Safe Equivalent of Ord or Charcodeat() in PHP
Shorthand for Arrays: Is There a Literal Syntax Like {} or []
How to Increase Memory Limit for PHP Over 2Gb
How to Add Anchor Tag to a Url from Text Input