From a2078500cfd301c4f28a27632b27e111913d0c34 Mon Sep 17 00:00:00 2001
From: prasad <prasad@vtiger.com>
Date: Mon, 6 May 2024 13:37:34 +0530
Subject: [PATCH] E_ALL - AllowDynamicProperties, declare var before use,
 array_key_exists typecast

---
 include/QueryGenerator/QueryGenerator.php | 1 +
 include/Webservices/WebserviceField.php   | 1 +
 include/utils/VTCacheUtils.php            | 3 ++-
 includes/runtime/BaseModel.php            | 2 +-
 includes/runtime/Controller.php           | 1 +
 modules/CustomView/CustomView.php         | 1 +
 6 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/include/QueryGenerator/QueryGenerator.php b/include/QueryGenerator/QueryGenerator.php
index 2e102314d..649312e74 100644
--- a/include/QueryGenerator/QueryGenerator.php
+++ b/include/QueryGenerator/QueryGenerator.php
@@ -19,6 +19,7 @@ require_once 'include/Webservices/RelatedModuleMeta.php';
  *
  * @author MAK
  */
+#[\AllowDynamicProperties]
 class QueryGenerator {
 	protected $module;
 	protected $customViewColumnList;
diff --git a/include/Webservices/WebserviceField.php b/include/Webservices/WebserviceField.php
index d1ca206d4..d7c4dc921 100644
--- a/include/Webservices/WebserviceField.php
+++ b/include/Webservices/WebserviceField.php
@@ -11,6 +11,7 @@
 require_once 'includes/runtime/Cache.php';
 require_once 'vtlib/Vtiger/Runtime.php';
 
+#[\AllowDynamicProperties]
 class WebserviceField{
 	private $fieldId;
 	private $uitype;
diff --git a/include/utils/VTCacheUtils.php b/include/utils/VTCacheUtils.php
index 7974ec1a8..579ee771d 100644
--- a/include/utils/VTCacheUtils.php
+++ b/include/utils/VTCacheUtils.php
@@ -129,6 +129,7 @@ class VTCacheUtils {
 
         // If modulefields are already loaded then no need of this again
         if(!$modulefields){
+            $modulefields = array();
             $fieldInfo = Vtiger_Cache::get('ModuleFields',$tabid);
             if($fieldInfo){
                 foreach($fieldInfo as $block => $blockFields){
@@ -461,4 +462,4 @@ class VTCacheUtils {
 	}
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/includes/runtime/BaseModel.php b/includes/runtime/BaseModel.php
index b4ba08451..08f7b2e93 100644
--- a/includes/runtime/BaseModel.php
+++ b/includes/runtime/BaseModel.php
@@ -85,7 +85,7 @@ class Vtiger_Base_Model {
 	 * @param String $key
 	 */
 	public function has($key) {
-		return array_key_exists($key, $this->valueMap);
+		return array_key_exists($key, (array)$this->valueMap); // valueMap can be array or TrackableObject
 	}
 
 	/**
diff --git a/includes/runtime/Controller.php b/includes/runtime/Controller.php
index a1cccd704..760ca75ff 100644
--- a/includes/runtime/Controller.php
+++ b/includes/runtime/Controller.php
@@ -11,6 +11,7 @@
 /**
  * Abstract Controller Class
  */
+#[\AllowDynamicProperties]
 abstract class Vtiger_Controller {
 
 	function __construct() { }
diff --git a/modules/CustomView/CustomView.php b/modules/CustomView/CustomView.php
index da85eff7f..0fc173362 100644
--- a/modules/CustomView/CustomView.php
+++ b/modules/CustomView/CustomView.php
@@ -433,6 +433,7 @@ class CustomView extends CRMEntity {
 			$sSQL .= " inner join vtiger_customview on vtiger_customview.cvid = vtiger_cvcolumnlist.cvid";
 			$sSQL .= " where vtiger_customview.cvid =? order by vtiger_cvcolumnlist.columnindex";
 			$result = $adb->pquery($sSQL, array($cvid));
+			$columnlist = array();
 			while ($columnrow = $adb->fetch_array($result)) {
 				$columnlist[$columnrow['columnindex']] = $columnrow['columnname'];
 			}
-- 
GitLab