From 52059661a4f603a107c445c2f4c052c66f3420e4 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Thu, 22 Jul 2021 10:59:19 +0200 Subject: [PATCH 1/6] Ignore undefined indexes E_NOTICE --- .../godmode/um_client/lib/UpdateManager/Client.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pandora_console/godmode/um_client/lib/UpdateManager/Client.php b/pandora_console/godmode/um_client/lib/UpdateManager/Client.php index d324df1120..a38f1fba44 100644 --- a/pandora_console/godmode/um_client/lib/UpdateManager/Client.php +++ b/pandora_console/godmode/um_client/lib/UpdateManager/Client.php @@ -1433,6 +1433,10 @@ class Client error_reporting(E_ALL ^ E_NOTICE); set_error_handler( function ($errno, $errstr) { + if (preg_match('/Undefined index/', $errstr) > 1) { + return; + } + throw new \Exception($errstr, $errno); } ); From c2eb452ec03c3cdb211416234c3ccbca4b8da320 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Thu, 22 Jul 2021 11:02:55 +0200 Subject: [PATCH 2/6] Exclude E_NOTICE by default --- pandora_console/include/config.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/config.inc.php b/pandora_console/include/config.inc.php index cafd94f27c..30ab31b3e0 100644 --- a/pandora_console/include/config.inc.php +++ b/pandora_console/include/config.inc.php @@ -30,7 +30,7 @@ /** * Do not display any ERROR */ -error_reporting(E_ALL); +error_reporting(E_ALL ^ E_NOTICE); // Display ALL errors // error_reporting(E_ERROR); From 1cbda1ce15651d75b4d73b51b583155f13170150 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Thu, 22 Jul 2021 11:06:40 +0200 Subject: [PATCH 3/6] Improved config.inc file content descriptions --- pandora_console/include/config.inc.php | 74 ++++++++++++++++---------- 1 file changed, 45 insertions(+), 29 deletions(-) diff --git a/pandora_console/include/config.inc.php b/pandora_console/include/config.inc.php index 30ab31b3e0..a3d5677729 100644 --- a/pandora_console/include/config.inc.php +++ b/pandora_console/include/config.inc.php @@ -1,38 +1,54 @@ Date: Thu, 22 Jul 2021 11:29:01 +0200 Subject: [PATCH 4/6] Always ignopre undefined indexes notices --- .../godmode/um_client/lib/UpdateManager/Client.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pandora_console/godmode/um_client/lib/UpdateManager/Client.php b/pandora_console/godmode/um_client/lib/UpdateManager/Client.php index a38f1fba44..c20aa34fdc 100644 --- a/pandora_console/godmode/um_client/lib/UpdateManager/Client.php +++ b/pandora_console/godmode/um_client/lib/UpdateManager/Client.php @@ -1340,7 +1340,7 @@ class Client error_reporting(E_ALL ^ E_NOTICE); set_error_handler( function ($errno, $errstr) { - if (preg_match('/Undefined index/', $errstr) > 1) { + if (preg_match('/Undefined index/i', $errstr) > 0) { return; } @@ -1351,7 +1351,9 @@ class Client register_shutdown_function( function () { $error = error_get_last(); - if (null !== $error) { + if (null !== $error + && preg_match('/Undefined index/i', $error['message']) !== 1 + ) { echo __('Failed to analyze package: %s', $error['message']); } } @@ -1433,7 +1435,7 @@ class Client error_reporting(E_ALL ^ E_NOTICE); set_error_handler( function ($errno, $errstr) { - if (preg_match('/Undefined index/', $errstr) > 1) { + if (preg_match('/Undefined index/i', $errstr) > 0) { return; } From d3270904bd0f58b27bbbe3197f49fd3e2ccf2d5a Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Thu, 22 Jul 2021 11:33:57 +0200 Subject: [PATCH 5/6] Avoid notice --- pandora_console/godmode/um_client/index.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pandora_console/godmode/um_client/index.php b/pandora_console/godmode/um_client/index.php index 20f209e643..c6d1b6d69d 100644 --- a/pandora_console/godmode/um_client/index.php +++ b/pandora_console/godmode/um_client/index.php @@ -70,6 +70,10 @@ if (empty($license) === true) { } $mode_str = ''; +if (isset($mode) === false) { + $mode = null; +} + if ($mode === Manager::MODE_ONLINE) { $mode_str = 'online'; } else if ($mode === Manager::MODE_OFFLINE) { From dc7d30cbf89572442ae06e111ff7f95f41833f47 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Thu, 22 Jul 2021 11:41:04 +0200 Subject: [PATCH 6/6] Stupid sexy error_get_last --- .../um_client/lib/UpdateManager/Client.php | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/pandora_console/godmode/um_client/lib/UpdateManager/Client.php b/pandora_console/godmode/um_client/lib/UpdateManager/Client.php index c20aa34fdc..3f76de4405 100644 --- a/pandora_console/godmode/um_client/lib/UpdateManager/Client.php +++ b/pandora_console/godmode/um_client/lib/UpdateManager/Client.php @@ -1340,19 +1340,16 @@ class Client error_reporting(E_ALL ^ E_NOTICE); set_error_handler( function ($errno, $errstr) { - if (preg_match('/Undefined index/i', $errstr) > 0) { - return; - } - throw new \Exception($errstr, $errno); - } + }, + E_ERROR ); register_shutdown_function( function () { $error = error_get_last(); if (null !== $error - && preg_match('/Undefined index/i', $error['message']) !== 1 + && $error['type'] === E_ERROR ) { echo __('Failed to analyze package: %s', $error['message']); } @@ -1435,12 +1432,9 @@ class Client error_reporting(E_ALL ^ E_NOTICE); set_error_handler( function ($errno, $errstr) { - if (preg_match('/Undefined index/i', $errstr) > 0) { - return; - } - throw new \Exception($errstr, $errno); - } + }, + E_ERROR ); if ($package === null) {