Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 708206

Summary: net-analyzer/pnp4nagios: php 7.2 compatibility
Product: Gentoo Linux Reporter: Tomáš Mózes <hydrapolic>
Component: Current packagesAssignee: Sysadmin Bugs <sysadmin>
Status: RESOLVED FIXED    
Severity: normal Keywords: PullRequest
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://github.com/gentoo/gentoo/pull/21329
Whiteboard:
Package list:
Runtime testing required: ---

Description Tomáš Mózes 2020-02-04 11:54:57 UTC
Currently graphing shows this error (tested with php 7.2:

Please check the documentation for information about the following error.
sizeof(): Parameter must be an array or an object that implements Countable
file [line]:
application/models/data.php [979]:

Issue: https://github.com/lingej/pnp4nagios/issues/148
Patch: https://github.com/lingej/pnp4nagios/pull/141
Comment 1 Tomáš Mózes 2020-02-04 11:57:36 UTC
This seems to work:

--- /usr/share/pnp/application/models/data.php   2018-01-17 09:28:58.267916299 +0000
+++ /usr/share/pnp/application/models/data.php   2020-02-04 11:55:58.645508204 +0000
@@ -962,7 +962,7 @@
                 die("Cannot open directory:  $path");
             }
         }
-        if(sizeof($pages)>0){
+        if(is_array($pages) && sizeof($pages)>0){
             
             natsort($pages);
         }else{
@@ -976,7 +976,7 @@
     */
     public function getFirstPage(){
         $pages = $this->getPages();
-        if(sizeof($pages) > 0 ){
+        if(is_array($pages) && sizeof($pages) > 0 ){
             return urldecode($pages[0]);
         }else{
             return FALSE;
Comment 2 onkobu 2020-12-12 17:04:43 UTC
Bumped into the same, also see https://github.com/lingej/pnp4nagios/issues/176 asking if still maintained/ release planned.

Can confirm fix. Original repo contains other fixes, too see https://github.com/lingej/pnp4nagios/issues/148#issuecomment-708674604
Comment 3 Larry the Git Cow gentoo-dev 2021-06-20 16:13:06 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5f94cc0f46dbc761fb220af23abada6f310ecbcd

commit 5f94cc0f46dbc761fb220af23abada6f310ecbcd
Author:     Tomáš Mózes <hydrapolic@gmail.com>
AuthorDate: 2021-06-19 15:34:21 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2021-06-20 16:13:01 +0000

    net-analyzer/pnp4nagios: add php 7.4 compatibility
    
    Closes: https://bugs.gentoo.org/708206
    Closes: https://bugs.gentoo.org/765643
    Signed-off-by: Tomáš Mózes <hydrapolic@gmail.com>
    Closes: https://github.com/gentoo/gentoo/pull/21329
    Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>

 .../files/pnp4nagios-0.6.26-magic-quotes.patch     |  23 ++
 .../files/pnp4nagios-0.6.26-sizeof.patch           | 357 +++++++++++++++++++++
 .../pnp4nagios/pnp4nagios-0.6.26-r11.ebuild        | 104 ++++++
 3 files changed, 484 insertions(+)