Hello dear Observium Team,
I'm trying to add a device using the API and get an error 500 message instead of the expected notice that the device is not respondig to snmp.
curl -u korten:secret https://observium.domain.net/api/v0/devices/ -X
POST -d '{"hostname":"pe-lab02.domain.net", "snmp_community":"test", "ping_skip":"on"}'
<h1>500 Internal Server Error</h1><h3>flight\Engine::_json(): Argument #2 ($code) must be of type int, string given, called in /opt/observium/libs/flight3/core/Dispatcher.php on line 86 (0)</h3><pre>#0 /opt/observium/libs/flight3/core/Dispatcher.php(86): flight\Engine->_json() #1 /opt/observium/libs/flight3/core/Dispatcher.php(50): flight\core\Dispatcher->runEvent() #2 /opt/observium/libs/flight3/Engine.php(113): flight\core\Dispatcher->run() #3 [internal function]: flight\Engine->__call() #4 /opt/observium/libs/flight3/core/Dispatcher.php(287): call_user_func_array() #5 /opt/observium/libs/flight3/Flight.php(143): flight\core\Dispatcher::invokeMethod() #6 /opt/observium/html/api/v0/includes/devices.inc.php(133): Flight::__callStatic() #7 [internal function]: api_add_device() #8 /opt/observium/libs/flight3/core/Dispatcher.php(250): call_user_func_array() #9 /opt/observium/libs/flight3/core/Dispatcher.php(237): flight\core\Dispatcher::callFunction() #10 /opt/observium/libs/flight3/Engine.php(508): flight\core\Dispatcher::execute() #11 /opt/observium/libs/flight3/core/Dispatcher.php(86): flight\Engine->_start() #12 /opt/observium/libs/flight3/core/Dispatcher.php(50): flight\core\Dispatcher->runEvent() #13 /opt/observium/libs/flight3/Engine.php(113): flight\core\Dispatcher->run() #14 [internal function]: flight\Engine->__call() #15 /opt/observium/libs/flight3/core/Dispatcher.php(287): call_user_func_array() #16 /opt/observium/libs/flight3/Flight.php(143): flight\core\Dispatcher::invokeMethod() #17 /opt/observium/html/api/v0/index.php(66): Flight::__callStatic() #18 {main}</pre>
As far as I can see, the error is in:
api/v0/includes/devices.inc.php at line 133:
Flight::json($json, '400');
should be: Flight::json($json, 400);
Agree?
Thank you and have a nice day,
Nico
it looks like this is a php8 issue, we need to change all the places the codes are in quotes to being integer.
adam.
Nicolas Korten via observium wrote on 2024-06-24 13:33:
Hello dear Observium Team,
I'm trying to add a device using the API and get an error 500 message instead of the expected notice that the device is not respondig to snmp.
curl -u korten:secret https://observium.domain.net/api/v0/devices/
-X POST -d '{"hostname":"pe-lab02.domain.net", "snmp_community":"test", "ping_skip":"on"}'
<h1>500 Internal Server Error</h1><h3>flight\Engine::_json(): Argument #2 ($code) must be of type int, string given, called in /opt/observium/libs/flight3/core/Dispatcher.php on line 86 (0)</h3><pre>#0 /opt/observium/libs/flight3/core/Dispatcher.php(86): flight\Engine->_json() #1 /opt/observium/libs/flight3/core/Dispatcher.php(50): flight\core\Dispatcher->runEvent() #2 /opt/observium/libs/flight3/Engine.php(113): flight\core\Dispatcher->run() #3 [internal function]: flight\Engine->__call() #4 /opt/observium/libs/flight3/core/Dispatcher.php(287): call_user_func_array() #5 /opt/observium/libs/flight3/Flight.php(143): flight\core\Dispatcher::invokeMethod() #6 /opt/observium/html/api/v0/includes/devices.inc.php(133): Flight::__callStatic() #7 [internal function]: api_add_device() #8 /opt/observium/libs/flight3/core/Dispatcher.php(250): call_user_func_array() #9 /opt/observium/libs/flight3/core/Dispatcher.php(237): flight\core\Dispatcher::callFunction() #10 /opt/observium/libs/flight3/Engine.php(508): flight\core\Dispatcher::execute() #11 /opt/observium/libs/flight3/core/Dispatcher.php(86): flight\Engine->_start() #12 /opt/observium/libs/flight3/core/Dispatcher.php(50): flight\core\Dispatcher->runEvent() #13 /opt/observium/libs/flight3/Engine.php(113): flight\core\Dispatcher->run() #14 [internal function]: flight\Engine->__call() #15 /opt/observium/libs/flight3/core/Dispatcher.php(287): call_user_func_array() #16 /opt/observium/libs/flight3/Flight.php(143): flight\core\Dispatcher::invokeMethod() #17 /opt/observium/html/api/v0/index.php(66): Flight::__callStatic() #18 {main}</pre>
As far as I can see, the error is in:
api/v0/includes/devices.inc.php at line 133:
Flight::json($json, '400');
should be: Flight::json($json, 400);
Agree?
Thank you and have a nice day,
Nico
observium mailing list -- observium@lists.observium.org To unsubscribe send an email to observium-leave@lists.observium.org
Hi, thanks for replying!
it looks like this is a php8 issue, we need to change all the places the codes are in quotes to being integer.
Is it planned to support php8 do or do you recomend using an older php version?
Kind regards,
Nicolas
It's already fixed in SVN.
Thanks, adam.
Nicolas Korten via observium wrote on 2024-06-27 13:28:
Hi, thanks for replying!
it looks like this is a php8 issue, we need to change all the places the codes are in quotes to being integer.
Is it planned to support php8 do or do you recomend using an older php version?
Kind regards,
Nicolas
observium mailing list -- observium@lists.observium.org To unsubscribe send an email to observium-leave@lists.observium.org
Incredible! Thank you Adam.
Kind regards,
Nicolas
https://changelog.observium.org/2024/
It was done 2 days ago or so. I guess I forgot to reply originally.
:D
Nicolas Korten via observium wrote on 2024-06-27 13:46:
Incredible! Thank you Adam.
Kind regards,
Nicolas
observium mailing list -- observium@lists.observium.org To unsubscribe send an email to observium-leave@lists.observium.org
participants (2)
-
Adam Armstrong
-
Nicolas Korten