Giter Site home page Giter Site logo

Comments (8)

yvesaccoe avatar yvesaccoe commented on September 26, 2024

Hi,

We upgraded to Zabbix 6.0 .. for the latest agent 6.0 we needed to upgrade to pFsense 23.01. Which has php 8.1..
Any help would be appreciated ..

from pfsense-zabbix-template.

LegsAJimbo avatar LegsAJimbo commented on September 26, 2024

DISCLAIMER: I HAVE NO CLUE WHAT I AM DOING!

I'm not entirely sure whether this creates the desired behaviour or not, but is has suppressed the errors for me

It does seem that the is_countable may have the same effect as count > 0 and putting both like I have is pointless.

It may be that the variables are the incorrect data type as required by the php upgrade, so my modifications are preventing the duplicate removal functions from happening.

It may be that the variable does not exist yet, intentionally or not, and count is being used to check it's existence. If that is the case then I believe this should be a viable solution.

With that said, I managed to suppress the error by changing line 978 from:
if (count($leases) > 0) {
to
if (is_countable($leases) && count($leases) > 0) {

And line 982 from:
if (count($pools) > 0) {
to
if (is_countable($pools) && count($pools) > 0) {

Use at your own risk!

from pfsense-zabbix-template.

rbicelli avatar rbicelli commented on September 26, 2024

A better workaroud is to disable items related to DHCP Pool Failover instead of editing the script.

from pfsense-zabbix-template.

stephanehofman avatar stephanehofman commented on September 26, 2024

DISCLAIMER: I HAVE NO CLUE WHAT I AM DOING!

I'm not entirely sure whether this creates the desired behaviour or not, but is has suppressed the errors for me

It does seem that the is_countable may have the same effect as count > 0 and putting both like I have is pointless.

It may be that the variables are the incorrect data type as required by the php upgrade, so my modifications are preventing the duplicate removal functions from happening.

It may be that the variable does not exist yet, intentionally or not, and count is being used to check it's existence. If that is the case then I believe this should be a viable solution.

With that said, I managed to suppress the error by changing line 978 from: if (count($leases) > 0) { to if (is_countable($leases) && count($leases) > 0) {

And line 982 from: if (count($pools) > 0) { to if (is_countable($pools) && count($pools) > 0) {

Use at your own risk!

after the modification, another error :
PHP ERROR: Type: 1, File: /root/scripts/pfsense_zbx.php, Line: 1131, Message: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /root/scripts/pfsense_zbx.php:1131
Stack trace:
#0 /root/scripts/pfsense_zbx.php(1131): in_array('62399625c19f2', NULL)
#1 /root/scripts/pfsense_zbx.php(1354): pfz_get_cert_date('validFrom.max')
#2 {main}
thrown @ 2023-02-28 09:59:35
PHP ERROR: Type: 1, File: /root/scripts/pfsense_zbx.php, Line: 1139, Message: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /root/scripts/pfsense_zbx.php:1139
Stack trace:
#0 /root/scripts/pfsense_zbx.php(1139): in_array('62399625c19f2', NULL)
#1 /root/scripts/pfsense_zbx.php(1354): pfz_get_cert_date('validTo.min')
#2 {main}
thrown @ 2023-02-28 09:59:37

from pfsense-zabbix-template.

edeckers avatar edeckers commented on September 26, 2024

What happens when you put the two occurrences of crt in double quotes "crt"? I did that on my local instance last week and that seems to have solved the situation, because the crt constant doesn't exist and we actually need a "crt" to access the correct field from $cert.

This output for php 8.1.x and 7.4.x with regards to undefined constants demonstrates why it used to work:
https://onlinephp.io?s=s7EvyCjg5eLlSk3OyFdQCkktLlGyhvOTi0qsAQ%2C%2C&v=8.1.0%2C7.4.0

from pfsense-zabbix-template.

stephanehofman avatar stephanehofman commented on September 26, 2024

it change nothing...

PHP ERROR: Type: 1, File: /root/scripts/pfsense_zbx.php, Line: 1131, Message: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /root/scripts/pfsense_zbx.php:1131
Stack trace:
#0 /root/scripts/pfsense_zbx.php(1131): in_array('62399625c19f2', NULL)
#1 /root/scripts/pfsense_zbx.php(1354): pfz_get_cert_date('validFrom.max')
#2 {main}
thrown @ 2023-03-02 11:00:01
PHP ERROR: Type: 1, File: /root/scripts/pfsense_zbx.php, Line: 1139, Message: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /root/scripts/pfsense_zbx.php:1139
Stack trace:
#0 /root/scripts/pfsense_zbx.php(1139): in_array('62399625c19f2', NULL)
#1 /root/scripts/pfsense_zbx.php(1354): pfz_get_cert_date('validTo.min')
#2 {main}
thrown @ 2023-03-02 11:00:04
PHP ERROR: Type: 1, File: /root/scripts/pfsense_zbx.php, Line: 1131, Message: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /root/scripts/pfsense_zbx.php:1131
Stack trace:
#0 /root/scripts/pfsense_zbx.php(1131): in_array('62399625c19f2', NULL)
#1 /root/scripts/pfsense_zbx.php(1354): pfz_get_cert_date('validFrom.max')
#2 {main}
thrown @ 2023-03-02 11:01:02
PHP ERROR: Type: 1, File: /root/scripts/pfsense_zbx.php, Line: 1139, Message: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /root/scripts/pfsense_zbx.php:1139
Stack trace:
#0 /root/scripts/pfsense_zbx.php(1139): in_array('62399625c19f2', NULL)
#1 /root/scripts/pfsense_zbx.php(1354): pfz_get_cert_date('validTo.min')
#2 {main}
thrown @ 2023-03-02 11:01:04

from pfsense-zabbix-template.

edeckers avatar edeckers commented on September 26, 2024

I've submitted a PR #134 that fixes the issue.

I forgot about the change of this line: master...edeckers:pfsense-zabbix-template:elydeckers/fix/broken-pfsense-23-php-8-1#diff-9874529ae15a98afff9726709aa3f7ef31b25cdd0d903ed892ebe626e64a3c57R1119. That's why it didn't work for you @stephanehofman .

from pfsense-zabbix-template.

stephanehofman avatar stephanehofman commented on September 26, 2024

Hello, I have updated the script to last version, but I still have an error
PHP errors

PHP ERROR: Type: 1, File: /root/scripts/pfsense_zbx.php, Line: 1131, Message: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /root/scripts/pfsense_zbx.php:1131
Stack trace:
#0 /root/scripts/pfsense_zbx.php(1131): in_array('62399625c19f2', NULL)
#1 /root/scripts/pfsense_zbx.php(1354): pfz_get_cert_date('validFrom.max')
#2 {main}
thrown @ 2023-03-07 09:45:37
PHP ERROR: Type: 1, File: /root/scripts/pfsense_zbx.php, Line: 1139, Message: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /root/scripts/pfsense_zbx.php:1139
Stack trace:
#0 /root/scripts/pfsense_zbx.php(1139): in_array('62399625c19f2', NULL)
#1 /root/scripts/pfsense_zbx.php(1354): pfz_get_cert_date('validTo.min')
#2 {main}
thrown @ 2023-03-07 09:45:38

from pfsense-zabbix-template.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.