Warning: count(): Parameter must be an array or an object that implements Countable

I’m getting this error message when clicking the FILES link inside my Projects page. I’ve already added a base directory in file away. Thanks

Warning : count(): Parameter must be an array or an object that implements Countable in C:\xampp\htdocs\home\wp-content\plugins\file-away\lib\cls\class.fileaway.php on line 71.

I can see from the URL that you’re working on localhost, on a XAMPP based environment. If you’re using the latest XAMPP (7.3.4) that one uses PHP 7.3.4

And in the file C:\xampp\htdocs\home\wp-content\plugins\file-away\lib\cls\class.fileaway.php on line 71 there is an issue with the parameter passed to the count function.

Since PHP 7.2 count() yields a warning on invalid countable types passed to the array_or_countable parameter, see this: https://www.php.net/manual/en/function.count.php

So what you can do is either:

  1. contact the plugin support and let them know about this error or

  2. switch back to a previous version of PHP, PHP 7.0 or

  3. navigate to C:\xampp\htdocs\home\wp-content\plugins\file-away\lib\cls\class.fileaway.php in the File Away plugin folder, on line 71 and replace this:

$fcount = count($rawnames);

with this:

$fcount = (is_array($rawnames)) ? count($rawnames) : 0;
1 Like

Thanks! That did it. I appreciate the help.