diff --git a/api/address.php b/api/address.php index 0106d53..94521df 100644 --- a/api/address.php +++ b/api/address.php @@ -71,7 +71,7 @@ class address extends cora\crud { 'smarty_streets', 'smarty_streets_api', [ - 'street' => $address_string, + 'address_string' => $address_string, 'country' => $country ] ); diff --git a/api/cora/database.php b/api/cora/database.php index 9966bed..7e8817a 100644 --- a/api/cora/database.php +++ b/api/cora/database.php @@ -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); } diff --git a/api/cora/request.php b/api/cora/request.php index e58d738..a3a5bc6 100644 --- a/api/cora/request.php +++ b/api/cora/request.php @@ -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 && diff --git a/api/runtime.php b/api/runtime.php index 074d5d3..a057105 100644 --- a/api/runtime.php +++ b/api/runtime.php @@ -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']) ) ) ]