From ce200d2b7ccf925a0572437aaa3eb2163c6a8a43 Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Sun, 18 Mar 2018 23:07:18 +0200 Subject: [PATCH] Fixed error that caused set placeholders method to break in the compiler --- admin/helpers/compiler/a_Get.php | 7 +++++++ admin/helpers/compiler/c_Fields.php | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/admin/helpers/compiler/a_Get.php b/admin/helpers/compiler/a_Get.php index 5dc5fa352..c234f44ae 100644 --- a/admin/helpers/compiler/a_Get.php +++ b/admin/helpers/compiler/a_Get.php @@ -5427,6 +5427,13 @@ class Get */ public function setPlaceholders(&$data, &$placeholder, $action = 1) { + // make sure the placeholders is an array + if (!ComponentbuilderHelper::checkArray($placeholder)) + { + // This is an error, (TODO) actualy we need to add a kind of log here to know that this happened + return $data; + } + // continue with the work of replacement if (1 == $action) // <-- just replace (default) { return str_replace(array_keys($placeholder), array_values($placeholder), $data); diff --git a/admin/helpers/compiler/c_Fields.php b/admin/helpers/compiler/c_Fields.php index 642e921e9..ba18df700 100644 --- a/admin/helpers/compiler/c_Fields.php +++ b/admin/helpers/compiler/c_Fields.php @@ -1387,7 +1387,7 @@ class Fields extends Structure // add the tabs needed $r_taber = "\t\t\t"; // get field values - $r_fieldValues = $this->setFieldAttributes($fieldData, $view, $r_name, $r_typeName, $r_multiple, $r_langLabel, $langView, $spacerCounter, $view_name_list, $view_name_single, $placeholders, true); + $r_fieldValues = $this->setFieldAttributes($fieldData, $view, $r_name, $r_typeName, $r_multiple, $r_langLabel, $langView, $view_name_list, $view_name_single, $placeholders, true); // check if values were set if (ComponentbuilderHelper::checkArray($r_fieldValues)) { @@ -1474,7 +1474,7 @@ class Fields extends Structure // add the tabs needed $r_taber = "\t\t"; // get field values - $r_fieldValues = $this->setFieldAttributes($fieldData, $view, $r_name, $r_typeName, $r_multiple, $r_langLabel, $langView, $spacerCounter, $view_name_list, $view_name_single, $placeholders, true); + $r_fieldValues = $this->setFieldAttributes($fieldData, $view, $r_name, $r_typeName, $r_multiple, $r_langLabel, $langView, $view_name_list, $view_name_single, $placeholders, true); // check if values were set if (ComponentbuilderHelper::checkArray($r_fieldValues)) {