From d2b5fe4839d56630af307160a17b46a448033700 Mon Sep 17 00:00:00 2001 From: Alex <40072887+alexdcrane@users.noreply.github.com> Date: Wed, 19 Nov 2025 15:56:10 -0700 Subject: [PATCH] Check if destination_actions is empty to fix a PHP warning (#7633) --- app/destinations/app_defaults.php | 46 ++++++++++++++++--------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/app/destinations/app_defaults.php b/app/destinations/app_defaults.php index eca5a212de..3eb9b1b850 100644 --- a/app/destinations/app_defaults.php +++ b/app/destinations/app_defaults.php @@ -146,31 +146,33 @@ if ($domains_processed == 1) { //loop through the array foreach ($destinations as $row) { $i = 0; - foreach (json_decode($row['destination_actions'], true) as $action) { - //build the array of destinations - if ($i == 0 ) { - $destination_action = $action['destination_app'] . ' ' . $action['destination_data']; - if ($destination_action !== $row['destination_app'] . ' ' . $row['destination_data']) { - $array['destinations'][$z]['destination_uuid'] = $row['destination_uuid']; - $array['destinations'][$z]['destination_number'] = $row['destination_number']; - $array['destinations'][$z]['destination_app'] = $action['destination_app']; - $array['destinations'][$z]['destination_data'] = $action['destination_data']; - $z++; + if (!empty(json_decode($row['destination_actions'], true))) { + foreach (json_decode($row['destination_actions'], true) as $action) { + //build the array of destinations + if ($i == 0 ) { + $destination_action = $action['destination_app'] . ' ' . $action['destination_data']; + if ($destination_action !== $row['destination_app'] . ' ' . $row['destination_data']) { + $array['destinations'][$z]['destination_uuid'] = $row['destination_uuid']; + $array['destinations'][$z]['destination_number'] = $row['destination_number']; + $array['destinations'][$z]['destination_app'] = $action['destination_app']; + $array['destinations'][$z]['destination_data'] = $action['destination_data']; + $z++; + } } - } - if ($i == 1) { - $destination_action = $action['destination_app'] . ' ' . $action['destination_data']; - if ($destination_action !== $row['destination_alternate_app'] . ' ' . $row['destination_alternate_data']) { - $array['destinations'][$z]['destination_uuid'] = $row['destination_uuid']; - $array['destinations'][$z]['destination_number'] = $row['destination_number']; - $array['destinations'][$z]['destination_alternate_app'] = $action['destination_app']; - $array['destinations'][$z]['destination_alternate_data'] = $action['destination_data']; - $z++; + if ($i == 1) { + $destination_action = $action['destination_app'] . ' ' . $action['destination_data']; + if ($destination_action !== $row['destination_alternate_app'] . ' ' . $row['destination_alternate_data']) { + $array['destinations'][$z]['destination_uuid'] = $row['destination_uuid']; + $array['destinations'][$z]['destination_number'] = $row['destination_number']; + $array['destinations'][$z]['destination_alternate_app'] = $action['destination_app']; + $array['destinations'][$z]['destination_alternate_data'] = $action['destination_data']; + $z++; + } } - } - //increment the id - $i++; + //increment the id + $i++; + } } //process a chunk of the array