Announcement

#1 2020-10-30 09:42:31

piwent
Member
2020-10-24
92

[Community] plugin PHP warning:Parameter must be an array or an object

Hello/Hi/Greetings,

I believe this is a bug in the Community plugin.

When I try to Explore>Edit Photo>Add Keywords I get the following error after having added a keyword and clicked "Apply Action":

Code:

Warning
: count(): Parameter must be an array or an object that implements Countable in
{my directory}/plugins/community/edit_photos.php
on line
338

Warning
: count(): Parameter must be an array or an object that implements Countable in
{my directory}/include/functions_html.inc.php
on line
639

The section in community/edit_photos.php is

Code:

if (count($page['infos']) != 0)
{
  $template->assign('infos', $page['infos']);
}

The section in include/functions_html.inc.php is

Code:

if (count($page[$mode]) != 0)
      {
        $template->assign($mode, $page[$mode]);
      }

After writing all this up I realized that these are warning not errors. The tags do in fact get added. Is this some PHP compatibility issue? If it is, would someone be so kind to add it in the bug tracker if that is needed. I don't really know about those things.

I'm also realizing that Piwigo shouldn't be showing those messages unless I have enabled them, which I don't think I have. Maybe there is some new default that turns them on in new installs?

Piwigo 2.10.2
    Operating system: Linux
    PHP: 7.2.34 (Show info) [2020-10-30 01:10:53]
    MySQL: 5.7.28-log [2020-10-30 01:10:53]
    Graphics Library: ImageMagick 6.9.7-4

Offline

 

#2 2020-10-30 11:36:59

homdax
Member
Skåne, Sweden
2015-02-02
212

Re: [Community] plugin PHP warning:Parameter must be an array or an object

There are a couple of things you can check... depending on what you have access to on your web hosting platform.

If you can access PHP settings and values:

While PHP code execution may trigger warnings, being informational warnings, errors or about function deprecations, you can mostly turn that off. PHP has a parameter for showing errors, check if it is enabled.

You are running PHP 7.2 branch, see if you can upgrade to 7.4 branch.

---

In order to add things to the bug tracker I am afraid you may have to do that yourself on Github...with a Github account... https://github.com/Piwigo

Offline

 

#3 2020-10-30 11:43:47

homdax
Member
Skåne, Sweden
2015-02-02
212

Re: [Community] plugin PHP warning:Parameter must be an array or an object

BTW I also use the Community plugin but don't get those errors, don't recognise them at all.

Best plugin ever, really the pure lifeblood for a couple of my sites.

Last edited by homdax (2020-10-30 11:44:26)

Offline

 

#4 2020-10-30 12:34:46

piwent
Member
2020-10-24
92

Re: [Community] plugin PHP warning:Parameter must be an array or an object

@Homdax Thanks! I was able to disable the warnings by adding $conf['show_php_errors'] = E_ERROR;
to my localfiles config.

I think I was at 7.4 earlier but downgraded to solve some other problem. I've been doing so much modding and debugging that I can't remember why.

And yes, Community almost seems like it should be core, or at least installed with a new site. The site I am building couldn't exist without Community. Thank you to the devs!

Offline

 

#5 2020-10-30 15:59:00

homdax
Member
Skåne, Sweden
2015-02-02
212

Re: [Community] plugin PHP warning:Parameter must be an array or an object

piwent wrote:

I think I was at 7.4 earlier but downgraded to solve some other problem. I've been doing so much modding and debugging that I can't remember why.

I don't want to know. I have a entire site dedicated to keep track of every detail in my projects, running http://qdpm.net/...

Offline

 

#6 2020-10-31 02:30:51

executive
Member
2017-08-16
1099

Re: [Community] plugin PHP warning:Parameter must be an array or an object

if you have cPanel then error reporting can be configured in PHP options

https://piwigo.org/forum/viewtopic.php? … 58#p177358

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2021 · Contact