[pmwiki-users] Parameter must be an array or an object that implements Countable

Petko Yotov 5ko at 5ko.fr
Fri Feb 2 11:39:40 CST 2018


Yes, for older PHP versions, or for older PmWiki installations that 
cannot upgrade, you can edit forms.php and insert @ before the second 
count() on this line (line 109 for your version, may vary for others):

   while (count($posnames) > 0 && @count(@$args['']) > 0) {


PmWiki 2.2.0 to 2.2.106 also have this problem -- before PHP 7.2 this 
was not a problem.

This was reported by DFaure a few weeks ago and fixed in Subversion for 
2.2.107 but I wanted also to include some hooks and fixes suggested by 
ChuckG before releasing 2.2.107 but could not find the time.

I'm releasing 2.2.107 today and will work on the hooks for the next 
version.

Petko

-- 
If you upgrade :  http://www.pmwiki.org/Upgrades


On 02/02/2018 18:10, Moni Kellermann wrote:
> Hi all,
> 
> I am testing skins using the latest XAMPP which runs PHP 7.2.1.
> When trying to edit a page, I get the error
> 
> Warning: count(): Parameter must be an array or an object that
> implements Countable in
> C:\xampp\htdocs\pmwiki-2.2.106\scripts\forms.php on line 109
> 
> This refers to
> 
> ##  convert any positional arguments to named arguments
>   $posnames = @$InputTags[$type][':args'];
>   if (!$posnames) $posnames = array('name', 'value');
>   while (count($posnames) > 0 && count(@$args['']) > 0) {
>     $n = array_shift($posnames);
>     if (!isset($args[$n])) $args[$n] = array_shift($args['']);
>   }
> 
> specifically the line
>   if (!$posnames) $posnames = array('name', 'value');
> 
> Is there any fix that is compatible with older PHP versions?
> 
> 
> moni k.



More information about the pmwiki-users mailing list