.reload command crashes irc.php #1218

Closed
tobiasa1 opened this Issue Jun 9, 2015 · 6 comments

Projects

None yet

2 participants

@tobiasa1
tobiasa1 commented Jun 9, 2015

irc.php crashes with PHP Fatal error after issuing .reload from an IRC client.

From Log:

[Mon, 08 Jun 2015 10:52:41 +0200] Setting up IRC-Bot..
[Mon, 08 Jun 2015 10:52:41 +0200] Starting IRC-Bot..
[Mon, 08 Jun 2015 10:52:41 +0200] Opened Alert-File
[Mon, 08 Jun 2015 10:52:41 +0200] Trying to connect to irc.xxx.xxx:6697 (SSL)
[Mon, 08 Jun 2015 10:52:41 +0200] Connected
[Mon, 08 Jun 2015 10:55:54 +0200] auth ( 'xxx' )
[Mon, 08 Jun 2015 10:56:49 +0200] auth ( 'xxx' )
[Tue, 09 Jun 2015 11:05:49 +0200] help ( '' )
[Tue, 09 Jun 2015 11:06:26 +0200] reload ( '' )
PHP Fatal error: [] operator not supported for strings in /opt/librenms/includes/defaults.inc.php on line 389

@f0o f0o self-assigned this Jun 9, 2015
@f0o f0o added the Bug label Jun 9, 2015
@f0o
Member
f0o commented Jun 9, 2015

Can you try this Patch please:

diff --git a/irc.php b/irc.php
index 9e40253..4f54083 100755
--- a/irc.php
+++ b/irc.php
@@ -375,8 +375,10 @@ class ircbot {
        private function _reload() {
                if( $this->user['level'] == 10 ) {
                        global $config;
+                       $config = array();
                        include("includes/defaults.inc.php");
                        include("config.php");
+                       include("includes/definitions.inc.php");
                        $this->respond("Reloading configuration & defaults");
                        if( $config != $this->config ) {
                                return $this->__construct();
@tobiasa1
tobiasa1 commented Jun 9, 2015

Hi,
Fatal error disappeared but the process just stops. Shouldn't it be reloaded?

[Tue, 09 Jun 2015 14:51:51 +0200] Setting up IRC-Bot..
[Tue, 09 Jun 2015 14:51:51 +0200] Starting IRC-Bot..
[Tue, 09 Jun 2015 14:51:51 +0200] Opened Alert-File
[Tue, 09 Jun 2015 14:51:51 +0200] Trying to connect to irc.xxx.xxx:6697 (SSL)
[Tue, 09 Jun 2015 14:51:51 +0200] Connected
[Tue, 09 Jun 2015 14:51:55 +0200] auth ( 'tobias' )
[Tue, 09 Jun 2015 14:52:28 +0200] auth ('xxxf' )
[Tue, 09 Jun 2015 14:52:29 +0200] reload ( '' )
tobias@librenms:/opt/librenms$

@f0o
Member
f0o commented Jun 9, 2015

Yup.

Issue relies in mergecnf() redeclaration from includes/definitions.inc.php introduced in dynconfig.

Going to create a PR to move mergecnf() to an own file so re-including of includes/definitions.inc.php is allowed again.

Also PR'ing the above patch under this issue-ID as it solves the type-fatal issue.

@f0o
Member
f0o commented Jun 9, 2015

When #1222 and #1221 is merged, it will work.

@f0o
Member
f0o commented Jun 9, 2015

@tobiasa1 Please pull master and re-check if the bug is resolved

@tobiasa1

@f0o, it works! Thanks.

@f0o f0o closed this Jun 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment