1
0
mirror of https://github.com/beestat/app.git synced 2025-05-24 02:14:03 -04:00

Minor changes for PHP8

This commit is contained in:
Jon Ziebell 2023-01-21 22:01:08 -05:00
parent 5942b04ca9
commit d7146e23ab
4 changed files with 12 additions and 6 deletions

View File

@ -71,7 +71,7 @@ class address extends cora\crud {
'smarty_streets',
'smarty_streets_api',
[
'street' => $address_string,
'address_string' => $address_string,
'country' => $country
]
);

View File

@ -355,6 +355,7 @@ final class database extends \mysqli {
* @return mixed The result directly from $mysqli->query.
*/
public function query($query, $resultmode = null) {
// public function query($query, $result_mode = \MYSQLI_STORE_RESULT): \mysqli_result|bool {
// If this was an insert, update or delete, start a transaction
$query_type = substr(trim($query), 0, 6);
if(
@ -518,7 +519,7 @@ final class database extends \mysqli {
}
}
foreach($json_fields as $json_field) {
$row[$json_field] = json_decode($row[$json_field], true);
$row[$json_field] = $row[$json_field] === null ? null : json_decode($row[$json_field], true);
}

View File

@ -302,7 +302,7 @@ final class request {
'user_id' => $session->get_user_id(),
'api_user_id' => $this->api_user['api_user_id'],
'ip_address' => ip2long($_SERVER['REMOTE_ADDR']),
'timestamp' => date('Y-m-d H:i:s', $this->begin_timestamp),
'timestamp' => date('Y-m-d H:i:s', intval($this->begin_timestamp)),
'request' => $this->request,
'response' => $this->response,
'error_code' => $this->response['data']['error_code'],
@ -320,7 +320,7 @@ final class request {
'user_id' => $session->get_user_id(),
'api_user_id' => $this->api_user['api_user_id'],
'ip_address' => ip2long($_SERVER['REMOTE_ADDR']),
'timestamp' => date('Y-m-d H:i:s', $this->begin_timestamp),
'timestamp' => date('Y-m-d H:i:s', intval($this->begin_timestamp)),
'request' => $this->request,
'response' => ($user['debug'] === true) ? $this->response : null,
'total_time' => $this->total_time,
@ -522,7 +522,12 @@ final class request {
// Send data to Sentry for error logging.
// https://docs.sentry.io/development/sdk-dev/event-payloads/
$api_user_id = $this->api_user['api_user_id'];
if($this->api_user !== null) {
$api_user_id = $this->api_user['api_user_id'];
} else {
$api_user_id = null;
}
if (
$reportable === true &&
$setting->get('sentry_key') !== null &&

View File

@ -195,7 +195,7 @@ class runtime extends cora\api {
'Y-m-d H:i:s',
max(
$sync_end,
strtotime($thermostat['sync_end'])
$thermostat['sync_end'] === null ? null : strtotime($thermostat['sync_end'])
)
)
]