Skip to content

Commit

Permalink
Fix bug in camera adding code which is fatal in PHP 8.2.0 (Ubuntu 23.10)
Browse files Browse the repository at this point in the history
Was:

 #4 {main}                                                                                                                                                                                                              thrown in /usr/share/bluecherry/www/lib/lib.php on line 883" while reading response header from upstream, client: 192.168.86.151, server: , request: "POST /discover-cameras/add HTTP/1.1", upstream: "fastcgi://unix:/etc/alternatives/php-fpm.sock:", host: "192.168.86.115:7001"
 2024/07/10 19:10:06 [error] 279#279: *15 FastCGI sent in stderr: "
PHP message: PHP Warning:  Undefined array key "query" in /usr/share/bluecherry/www/ajax/discoverCameras.php on line 362;
PHP message: PHP Fatal error:  Uncaught Error: Non-static method ipCamera::checkLimitDevices() cannot be called statically in /usr/share/bluecherry/www/lib/lib.php:883
 Stack trace:
 #0 /usr/share/bluecherry/www/ajax/discoverCameras.php(381): ipCamera::create()
 #1 /usr/share/bluecherry/www/lib/Controller.php(119): discoverCameras->postAdd()
 #2 /usr/share/bluecherry/www/lib/Route.php(75): Controller->start()                                                                                                                                                  #3 /usr/share/bluecherry/www/index.php(16): Route->start()
 #4 {main}                                                                                                                                                                                                              thrown in /usr/share/bluecherry/www/lib/lib.php on line 883" while reading response header from upstream, client: 192.168.86.151, server: , request: "POST /discover-cameras/add HTTP/1.1", upstream: "fastcgi://unix:/etc/alternatives/php-fpm.sock:", host: "192.168.86.115:7001"

Became:

 2024/07/10 19:20:18 [error] 281#281: *21 FastCGI sent in stderr: "
PHP message: PHP Warning:  Undefined array key "query" in /usr/share/bluecherry/www/ajax/discoverCameras.php on line 362;
PHP message: PHP Warning:  Undefined array key "hls_segment_duration" in /usr/share/bluecherry/www/lib/lib.php on line 855;
PHP message: PHP Warning:  Undefined array key "hls_segment_size" in /usr/share/bluecherry/www/lib/lib.php on line 856;
PHP message: PHP Warning:  Trying to access array offset on value of type bool in /usr/share/bluecherry/www/lib/lib.php on line 861;
PHP message: PHP Warning:  Trying to access array offset on value of type null in /usr/share/bluecherry/www/lib/lib.php on line 861" while reading response header from upstream, client: 192.168.86.151, server: , request: "POST /discover-cameras/add HTTP/1.1", upstream: "fastcgi://unix:/etc/alternatives/php-fpm.sock:", host: "192.168.86.115:7001"

Both were processed with %s/PHP message:/^M&/g
  • Loading branch information
andrey-utkin committed Jul 10, 2024
1 parent 7a668cf commit dd6f6ff
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion www/lib/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ public function changeState(){
if (!$this->info['disabled']) { self::autoConfigure($this->info['driver'], $this->info); }
return array(data::query("UPDATE Devices SET disabled=".(($this->info['disabled']) ? 0 : 1)." WHERE id={$this->info['id']}", true));
}
private function checkLimitDevices(){
private static function checkLimitDevices(){
$info = data::query("SELECT COUNT(*) as n FROM Devices WHERE protocol in ('IP-RTSP', 'IP-MJPEG', 'IP')");
$total_devices = $info[0]['n'];

Expand Down

0 comments on commit dd6f6ff

Please sign in to comment.