Skip to content

Commit 5e2b352

Browse files
committed
PHP8 updates
1 parent efc329c commit 5e2b352

9 files changed

+893
-872
lines changed

3rdparty/phpmqtt/phpMQTT.php

+663-653
Large diffs are not rendered by default.

3rdparty/smarty3/sysplugins/smarty_internal_templatecompilerbase.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -1151,7 +1151,8 @@ public function trigger_template_error($args = null, $line = null, $tagline = nu
11511151
flush();
11521152
}
11531153
$e = new SmartyCompilerException($error_text);
1154-
$e->line = $line;
1154+
//$e->line = $line;
1155+
$e->setLine($line);
11551156
$e->source = trim(preg_replace('![\t\r\n]+!', ' ', $match[ $line - 1 ]));
11561157
$e->desc = $args;
11571158
$e->template = $this->template->source->filepath;

3rdparty/smarty3/sysplugins/smartycompilerexception.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ public function __toString()
2020
*
2121
* @type int|null
2222
*/
23-
public $line = null;
23+
public function setLine($line)
24+
{
25+
$this->line = $line;
26+
}
2427

2528
/**
2629
* The template source snippet relating to the error
@@ -42,4 +45,5 @@ public function __toString()
4245
* @type string|null
4346
*/
4447
public $template = null;
48+
4549
}

index.php

+9-6
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,13 @@
4141
if ($app->action != '' && $app->action != 'docs') $fake_doc = '';
4242

4343
$result = $app->run();
44-
$result = str_replace("nf.php", "index.php", $result);
45-
44+
if ($result) {
45+
$result = str_replace("nf.php", "index.php", $result);
46+
require(ROOT.'lib/utils/postprocess_general.inc.php');
47+
require(ROOT.'lib/utils/postprocess_subscriptions.inc.php');
48+
require(ROOT.'lib/utils/postprocess_result.inc.php');
49+
}
4650
endMeasure('prepare');
47-
require(ROOT.'lib/utils/postprocess_general.inc.php');
48-
require(ROOT.'lib/utils/postprocess_subscriptions.inc.php');
49-
require(ROOT.'lib/utils/postprocess_result.inc.php');
5051

5152
/**
5253
* Echo large text
@@ -75,7 +76,9 @@ function echobig($string, $bufferSize = 8192)
7576
}
7677
}
7778

78-
echobig($result);
79+
if ($result) {
80+
echobig($result);
81+
}
7982

8083
endMeasure('final_echo', 1);
8184

lib/objects.class.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,7 @@ function cleanUpValueHistory($value_id, $max_age_days, $data_type = 0)
938938
$total_removed = 0;
939939

940940
if (defined('SEPARATE_HISTORY_STORAGE') && SEPARATE_HISTORY_STORAGE == 1) {
941-
$table_name = 'phistory_value_'.$value_id;
941+
$table_name = 'phistory_value_' . $value_id;
942942
} else {
943943
$table_name = 'phistory';
944944
}
@@ -958,7 +958,7 @@ function cleanUpValueHistory($value_id, $max_age_days, $data_type = 0)
958958
}
959959

960960
$tmp = SQLSelectOne("SELECT COUNT(*) as TOTAL FROM $table_name WHERE $qry");
961-
if (isset($tmp['TOTAL']) && $tmp['TOTAL']>0) {
961+
if (isset($tmp['TOTAL']) && $tmp['TOTAL'] > 0) {
962962
$total_removed = (int)$tmp['TOTAL'];
963963
SQLExec("DELETE FROM $table_name WHERE $qry");
964964
}
@@ -968,12 +968,12 @@ function cleanUpValueHistory($value_id, $max_age_days, $data_type = 0)
968968
function cleanUpPropertyHistory($property_id, $max_age_days)
969969
{
970970
$total_removed = 0;
971-
$property = SQLSelectOne("SELECT * FROM properties WHERE ID=".(int)$property_id);
971+
$property = SQLSelectOne("SELECT * FROM properties WHERE ID=" . (int)$property_id);
972972
if (isset($property['ID'])) {
973973
$pvalues = SQLSelect("SELECT * FROM pvalues WHERE PROPERTY_ID='" . $property_id . "'");
974974
$total = count($pvalues);
975975
for ($i = 0; $i < $total; $i++) {
976-
$total_removed+=cleanUpValueHistory($pvalues[$i]['ID'], $max_age_days, $property['DATA_TYPE']);
976+
$total_removed += cleanUpValueHistory($pvalues[$i]['ID'], $max_age_days, $property['DATA_TYPE']);
977977
}
978978
}
979979
return $total_removed;
@@ -1487,7 +1487,7 @@ function objectClassChanged($object_id)
14871487
function checkOperationsQueue($topic)
14881488
{
14891489
$data = SQLSelect("SELECT * FROM operations_queue WHERE TOPIC='" . DBSafe($topic) . "' ORDER BY EXPIRE");
1490-
if ($data[0]['TOPIC']) {
1490+
if (isset($data[0]['TOPIC'])) {
14911491
SQLExec("DELETE FROM operations_queue WHERE TOPIC='" . DBSafe($topic) . "'");
14921492
}
14931493
return $data;

modules/application.class.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -192,16 +192,16 @@ function sortFiles($a, $b)
192192
}
193193

194194
if ($this->action != 'apps') {
195-
if (preg_match('/^app_\w+$/is', $this->action) || $this->action == 'xray') {
195+
if ($this->action && (preg_match('/^app_\w+$/is', $this->action) || $this->action == 'xray')) {
196196
$out['APP_ACTION'] = 1;
197197
}
198198

199-
if ($this->app_action) {
199+
if (isset($this->app_action)) {
200200
$out['APP_ACTION'] = 1;
201201
}
202202
}
203203

204-
if ($this->app_action == 'panel') {
204+
if (isset($this->app_action) && $this->app_action == 'panel') {
205205
$this->redirect(ROOTHTML . 'admin.php');
206206
}
207207

0 commit comments

Comments
 (0)