From 351638fe1a4c75598e428daf8d87cafd0a1993cf Mon Sep 17 00:00:00 2001 From: Jeff Standen Date: Wed, 4 Sep 2024 16:09:07 -0700 Subject: [PATCH] 10.5: [Code Cleanup] --- features/cerberusweb.core/api/dao/mail_transport.php | 2 +- features/cerberusweb.core/api/dao/snippet.php | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/features/cerberusweb.core/api/dao/mail_transport.php b/features/cerberusweb.core/api/dao/mail_transport.php index 0ed199f20c..562b75f212 100644 --- a/features/cerberusweb.core/api/dao/mail_transport.php +++ b/features/cerberusweb.core/api/dao/mail_transport.php @@ -240,7 +240,7 @@ static private function _getObjectsFromResult($rs) { $object->updated_at = $row['updated_at']; // Unserialize JSON params - if(false != (@$params = json_decode($row['params_json'], true))) + if(false !== ($params = json_decode($row['params_json'] ?: '', true))) $object->params = $params; $objects[$object->id] = $object; diff --git a/features/cerberusweb.core/api/dao/snippet.php b/features/cerberusweb.core/api/dao/snippet.php index 53356a2138..9cfd36b4e2 100644 --- a/features/cerberusweb.core/api/dao/snippet.php +++ b/features/cerberusweb.core/api/dao/snippet.php @@ -872,8 +872,12 @@ public function getPrompts() : array { foreach($prompts as $prompt_key => &$prompt) { list($prompt_type, $prompt_name) = array_pad(explode('/', $prompt_key, 2), 2, null); + + if(!is_array($prompt)) + $prompt = []; + $prompt['type'] = $prompt_type; - $prompt['name'] = $prompt_name; + $prompt['name'] = $prompt_name ?: $prompt_type; // Sanitize if(array_key_exists('default', $prompt) && !is_scalar($prompt['default'])) {