pnp4nagios icon indicating copy to clipboard operation
pnp4nagios copied to clipboard

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

Open sfassotte opened this issue 7 years ago • 15 comments

application/models/data.php [979]:

Ubuntu 18.04 php 7.2

solution: change if(sizeof($pages) > 0 ){ to if(is_arrary($pages) && sizeof($pages) > 0 ){

sfassotte avatar Jun 15 '18 04:06 sfassotte

This works to fix the error in PHP 7.2

aaronpollock avatar Jul 31 '18 18:07 aaronpollock

Thanks for the fix and especially the comment :) where is the donate button?

majed17 avatar Nov 06 '18 06:11 majed17

there is a typo "arrary" in the fix.

tcpo6 avatar Nov 20 '18 16:11 tcpo6

that's an eagle eye :) I didn't catch it until now but the pnp graphs worked anyway for some reason..

majed17 avatar Nov 21 '18 08:11 majed17

There is another if(sizeof($pages)>0){ in getPages() function but I only changed the one in getFirstPage()

Make sure to use the correct spelling of array :)

application/models/data.php [979]: Ubuntu 18.04 php 7.2

solution: change if(sizeof($pages) > 0 ){ to if(is_array($pages) && sizeof($pages) > 0 ){

ghost avatar Sep 13 '19 04:09 ghost

Thank you very much for the fix!

sshilton avatar Sep 28 '19 06:09 sshilton

Fixing it with sed:

sed -i 's:if(sizeof(\$pages:if(is_array(\$pages) \&\& sizeof(\$pages:' /usr/local/pnp4nagios/share/application/models/data.php

larsen0815 avatar Oct 30 '19 15:10 larsen0815

I believe this issue was solved with PR #141.

hrubsa avatar Dec 17 '19 10:12 hrubsa

Hi , where did you make that changue, in what configuration file?

jhonatanriv avatar Jun 07 '20 10:06 jhonatanriv

application/models/data.php

webdawg avatar Jul 02 '20 04:07 webdawg

It is today. So 2020, and I needed to apply this to work on 0.6 with php newest on archlinux.

Is package distribution just messed up...should everyone be using git?

Why are there no git releases? And this seems like something important for 0.6? so why not release 0.7?

if this issue is closed I would be going crazy right now.

THANKS FOR WORKING ON THIS.

Are source forge releases dead?

webdawg avatar Jul 02 '20 04:07 webdawg

I have the same issue. I run sed -i 's:if(sizeof($pages:if(is_array($pages) && sizeof($pages:' /usr/local/pnp4nagios/share/application/models/data.php

The graphs are shown, but have error image

Somebody have fix about this case? The error is

Fatal error: Method View::__toString() must not throw an exception, caught Error: Call to undefined function is_arrary() in /usr/local/pnp4nagios/share/application/views/graph.php on line 0

iovcho avatar Jul 23 '20 11:07 iovcho

Somewhere you have misspelled "is_array" as "is_arrary"

D/\N

dan-m-joh avatar Jul 23 '20 11:07 dan-m-joh

Thanks - that's was the issue.

iovcho avatar Jul 23 '20 17:07 iovcho

Was this issue fixed with d5e04540d52238dfcb877d7116316ba1be8c1963 ?

RincewindsHat avatar Oct 14 '20 21:10 RincewindsHat