From 66da67dfc06a0ab168220e91036b1f0c5677e91d Mon Sep 17 00:00:00 2001 From: prasad <prasad@vtiger.com> Date: Mon, 6 May 2024 10:38:45 +0530 Subject: [PATCH] E_ALL - AllowDynamicProperties, php 8.2 conventions --- include/events/VTEventsManager.inc | 2 ++ include/fields/DateTimeField.php | 2 ++ include/utils/ListViewUtils.php | 4 +++- libraries/adodb_vtigerfix/adodb-xmlschema.inc.php | 8 ++++++++ libraries/adodb_vtigerfix/datadict/datadict-mysql.inc.php | 1 + modules/Install/views/Index.php | 2 +- modules/PickList/PickListUtils.php | 6 ++++-- modules/com_vtiger_workflow/VTEntityCache.inc | 1 + .../modules/CustomerPortal/CustomerPortal.php | 1 + .../modules/ExtensionStore/ExtensionStore.php | 1 + pkg/vtiger/modules/Google/modules/Google/Google.php | 1 + .../MailManager/modules/MailManager/MailManager.php | 1 + pkg/vtiger/modules/Mobile/modules/Mobile/Mobile.php | 1 + .../modules/ModTracker/modules/ModTracker/ModTracker.php | 1 + .../modules/RecycleBin/modules/RecycleBin/RecycleBin.php | 3 ++- pkg/vtiger/modules/WSAPP/modules/WSAPP/WSAPP.php | 1 + pkg/vtiger/modules/Webforms/modules/Webforms/Webforms.php | 1 + vtlib/Vtiger/Block.php | 2 +- vtlib/Vtiger/Field.php | 2 +- vtlib/Vtiger/FieldBasic.php | 1 + vtlib/thirdparty/network/Net/URL.php | 1 + vtlib/thirdparty/network/Request.php | 2 +- 22 files changed, 37 insertions(+), 8 deletions(-) diff --git a/include/events/VTEventsManager.inc b/include/events/VTEventsManager.inc index fc9a5a98c..719b1d767 100644 --- a/include/events/VTEventsManager.inc +++ b/include/events/VTEventsManager.inc @@ -12,6 +12,8 @@ * Create and trigger events in vtiger */ class VTEventsManager{ + var $adb; + function __construct($adb){ $this->adb = $adb; } diff --git a/include/fields/DateTimeField.php b/include/fields/DateTimeField.php index a3d3678b9..cec8648ff 100644 --- a/include/fields/DateTimeField.php +++ b/include/fields/DateTimeField.php @@ -13,6 +13,8 @@ class DateTimeField { static protected $databaseTimeZone = null; protected $datetime; + protected $date; + protected $time; private static $cache = array(); /** diff --git a/include/utils/ListViewUtils.php b/include/utils/ListViewUtils.php index 027c71a0d..3ea02a3d5 100755 --- a/include/utils/ListViewUtils.php +++ b/include/utils/ListViewUtils.php @@ -678,8 +678,10 @@ function decode_html($str) { // Direct Popup action or Ajax Popup action should be treated the same. if ((isset($_REQUEST['action']) && $_REQUEST['action'] == 'Popup') || (isset($_REQUEST['file']) && $_REQUEST['file'] == 'Popup')) return html_entity_decode($str); - else + else if ($str) return html_entity_decode($str, ENT_QUOTES, $default_charset); + else + return $str; } function popup_decode_html($str) { diff --git a/libraries/adodb_vtigerfix/adodb-xmlschema.inc.php b/libraries/adodb_vtigerfix/adodb-xmlschema.inc.php index 62292ae01..84bf52f06 100644 --- a/libraries/adodb_vtigerfix/adodb-xmlschema.inc.php +++ b/libraries/adodb_vtigerfix/adodb-xmlschema.inc.php @@ -1283,6 +1283,14 @@ class adoSchema { */ var $objectPrefix = ''; + /** + * @var object + * @access private + * Property used during XML Parsing. + * Added by Vtiger + */ + var $obj = null; + /** * @var long System debug * @access private diff --git a/libraries/adodb_vtigerfix/datadict/datadict-mysql.inc.php b/libraries/adodb_vtigerfix/datadict/datadict-mysql.inc.php index a1ee950a6..2edf20df4 100644 --- a/libraries/adodb_vtigerfix/datadict/datadict-mysql.inc.php +++ b/libraries/adodb_vtigerfix/datadict/datadict-mysql.inc.php @@ -22,6 +22,7 @@ // security - hide paths if (!defined('ADODB_DIR')) die(); +#[\AllowDynamicProperties] class ADODB2_mysql extends ADODB_DataDict { var $databaseType = 'mysql'; var $alterCol = ' MODIFY COLUMN'; diff --git a/modules/Install/views/Index.php b/modules/Install/views/Index.php index 4ff2d1472..8fb55655f 100644 --- a/modules/Install/views/Index.php +++ b/modules/Install/views/Index.php @@ -220,7 +220,7 @@ class Install_Index_view extends Vtiger_View_Controller { // Helper function as configuration file is still not loaded. protected function retrieveConfiguredAppUniqueKey() { include 'config.inc.php'; - return $application_unique_key; + return isset($application_unique_key) ? $application_unique_key : ""; } public function getHeaderCss(Vtiger_Request $request) { diff --git a/modules/PickList/PickListUtils.php b/modules/PickList/PickListUtils.php index 172481af6..f1bf78384 100644 --- a/modules/PickList/PickListUtils.php +++ b/modules/PickList/PickListUtils.php @@ -141,7 +141,8 @@ function getAllPickListValues($fieldName,$lang = Array() ){ * @param object $adb - the peardatabase object * @return array $pick - the editable picklist values */ -function getEditablePicklistValues($fieldName, $lang= array(), $adb){ +function getEditablePicklistValues($fieldName, $lang= array(), $adb = null){ + if ($adb == null) $adb = PearDatabase::getInstance(); $values = array(); $fieldName = $adb->sql_escape_string($fieldName); $sql="select $fieldName from vtiger_$fieldName where presence=1 and $fieldName <> '--None--'"; @@ -167,7 +168,8 @@ function getEditablePicklistValues($fieldName, $lang= array(), $adb){ * @param object $adb - the peardatabase object * @return array $pick - the no-editable picklist values */ -function getNonEditablePicklistValues($fieldName, $lang=array(), $adb){ +function getNonEditablePicklistValues($fieldName, $lang=array(), $adb = null){ + if ($adb == null) $adb = PearDatabase::getInstance(); $values = array(); $fieldName = $adb->sql_escape_string($fieldName); $sql = "select $fieldName from vtiger_$fieldName where presence=0"; diff --git a/modules/com_vtiger_workflow/VTEntityCache.inc b/modules/com_vtiger_workflow/VTEntityCache.inc index 2b5659852..fedab9844 100644 --- a/modules/com_vtiger_workflow/VTEntityCache.inc +++ b/modules/com_vtiger_workflow/VTEntityCache.inc @@ -10,6 +10,7 @@ require_once 'data/VTEntityDelta.php'; require_once 'includes/runtime/Cache.php'; +#[\AllowDynamicProperties] class VTWorkflowEntity{ function __construct($user, $id){ try { diff --git a/pkg/vtiger/modules/CustomerPortal/modules/CustomerPortal/CustomerPortal.php b/pkg/vtiger/modules/CustomerPortal/modules/CustomerPortal/CustomerPortal.php index 1fec60387..845e3bd51 100644 --- a/pkg/vtiger/modules/CustomerPortal/modules/CustomerPortal/CustomerPortal.php +++ b/pkg/vtiger/modules/CustomerPortal/modules/CustomerPortal/CustomerPortal.php @@ -8,6 +8,7 @@ * All Rights Reserved. *******************************************************************************/ + #[\AllowDynamicProperties] class CustomerPortal { /** diff --git a/pkg/vtiger/modules/ExtensionStore/modules/ExtensionStore/ExtensionStore.php b/pkg/vtiger/modules/ExtensionStore/modules/ExtensionStore/ExtensionStore.php index 890d4b4ed..761d64d5e 100644 --- a/pkg/vtiger/modules/ExtensionStore/modules/ExtensionStore/ExtensionStore.php +++ b/pkg/vtiger/modules/ExtensionStore/modules/ExtensionStore/ExtensionStore.php @@ -8,6 +8,7 @@ * All Rights Reserved. * ***********************************************************************************/ +#[\AllowDynamicProperties] class ExtensionStore { } diff --git a/pkg/vtiger/modules/Google/modules/Google/Google.php b/pkg/vtiger/modules/Google/modules/Google/Google.php index ae2dc7925..a783b4a3b 100644 --- a/pkg/vtiger/modules/Google/modules/Google/Google.php +++ b/pkg/vtiger/modules/Google/modules/Google/Google.php @@ -11,6 +11,7 @@ require_once 'vtlib/Vtiger/Module.php'; require_once('include/events/include.inc'); +#[\AllowDynamicProperties] class Google { const module = 'Google'; diff --git a/pkg/vtiger/modules/MailManager/modules/MailManager/MailManager.php b/pkg/vtiger/modules/MailManager/modules/MailManager/MailManager.php index 857b0224f..fc17d0e33 100644 --- a/pkg/vtiger/modules/MailManager/modules/MailManager/MailManager.php +++ b/pkg/vtiger/modules/MailManager/modules/MailManager/MailManager.php @@ -9,6 +9,7 @@ ************************************************************************************/ require_once 'include/Webservices/Query.php'; +#[\AllowDynamicProperties] class MailManager { static function updateMailAssociation($mailuid, $emailid, $crmid) { diff --git a/pkg/vtiger/modules/Mobile/modules/Mobile/Mobile.php b/pkg/vtiger/modules/Mobile/modules/Mobile/Mobile.php index f0940cf80..b6d345275 100644 --- a/pkg/vtiger/modules/Mobile/modules/Mobile/Mobile.php +++ b/pkg/vtiger/modules/Mobile/modules/Mobile/Mobile.php @@ -10,6 +10,7 @@ include_once dirname(__FILE__) . '/Mobile.Config.php'; +#[\AllowDynamicProperties] class Mobile { /** diff --git a/pkg/vtiger/modules/ModTracker/modules/ModTracker/ModTracker.php b/pkg/vtiger/modules/ModTracker/modules/ModTracker/ModTracker.php index 764835a3c..6fe11a49f 100644 --- a/pkg/vtiger/modules/ModTracker/modules/ModTracker/ModTracker.php +++ b/pkg/vtiger/modules/ModTracker/modules/ModTracker/ModTracker.php @@ -10,6 +10,7 @@ include_once 'vtlib/Vtiger/Event.php'; include_once 'include/Webservices/GetUpdates.php'; +#[\AllowDynamicProperties] class ModTracker { diff --git a/pkg/vtiger/modules/RecycleBin/modules/RecycleBin/RecycleBin.php b/pkg/vtiger/modules/RecycleBin/modules/RecycleBin/RecycleBin.php index 7146021a5..a1c57dbee 100644 --- a/pkg/vtiger/modules/RecycleBin/modules/RecycleBin/RecycleBin.php +++ b/pkg/vtiger/modules/RecycleBin/modules/RecycleBin/RecycleBin.php @@ -8,7 +8,8 @@ * All Rights Reserved. *******************************************************************************/ -class RecycleBin { +#[\AllowDynamicProperties] + class RecycleBin { /** * Invoked when special actions are performed on the module. diff --git a/pkg/vtiger/modules/WSAPP/modules/WSAPP/WSAPP.php b/pkg/vtiger/modules/WSAPP/modules/WSAPP/WSAPP.php index 87719404b..e7a345810 100644 --- a/pkg/vtiger/modules/WSAPP/modules/WSAPP/WSAPP.php +++ b/pkg/vtiger/modules/WSAPP/modules/WSAPP/WSAPP.php @@ -10,6 +10,7 @@ require_once('include/events/include.inc'); require_once 'modules/WSAPP/Utils.php'; +#[\AllowDynamicProperties] class WSAPP { /** diff --git a/pkg/vtiger/modules/Webforms/modules/Webforms/Webforms.php b/pkg/vtiger/modules/Webforms/modules/Webforms/Webforms.php index 18326c693..feaab5c39 100644 --- a/pkg/vtiger/modules/Webforms/modules/Webforms/Webforms.php +++ b/pkg/vtiger/modules/Webforms/modules/Webforms/Webforms.php @@ -10,6 +10,7 @@ require_once 'modules/Webforms/model/WebformsModel.php'; require_once 'include/Webservices/DescribeObject.php'; +#[\AllowDynamicProperties] class Webforms { var $LBL_WEBFORMS='Webforms'; diff --git a/vtlib/Vtiger/Block.php b/vtlib/Vtiger/Block.php index 234e6b61f..46712d329 100644 --- a/vtlib/Vtiger/Block.php +++ b/vtlib/Vtiger/Block.php @@ -192,7 +192,7 @@ class Vtiger_Block { */ static function getAllForModule($moduleInstance) { global $adb; - $instances = false; + $instances = array(); $query = "SELECT * FROM vtiger_blocks WHERE tabid=? ORDER BY sequence"; $queryParams = Array($moduleInstance->id); diff --git a/vtlib/Vtiger/Field.php b/vtlib/Vtiger/Field.php index c33b3e296..61dde1c0a 100644 --- a/vtlib/Vtiger/Field.php +++ b/vtlib/Vtiger/Field.php @@ -271,7 +271,7 @@ class Vtiger_Field extends Vtiger_FieldBasic { */ static function getAllForModule($moduleInstance) { global $adb; - $instances = false; + $instances = array(); $query = "SELECT * FROM vtiger_field WHERE tabid=? ORDER BY sequence"; $queryParams = Array($moduleInstance->id); diff --git a/vtlib/Vtiger/FieldBasic.php b/vtlib/Vtiger/FieldBasic.php index ab6c4425f..3b8a68ede 100644 --- a/vtlib/Vtiger/FieldBasic.php +++ b/vtlib/Vtiger/FieldBasic.php @@ -13,6 +13,7 @@ * Provides basic API to work with vtiger CRM Fields * @package vtlib */ +#[\AllowDynamicProperties] class Vtiger_FieldBasic { /** ID of this field instance */ diff --git a/vtlib/thirdparty/network/Net/URL.php b/vtlib/thirdparty/network/Net/URL.php index ae97c0afa..e93822761 100644 --- a/vtlib/thirdparty/network/Net/URL.php +++ b/vtlib/thirdparty/network/Net/URL.php @@ -37,6 +37,7 @@ // Net_URL Class +#[\AllowDynamicProperties] class Net_URL { var $options = array('encode_query_keys' => false); diff --git a/vtlib/thirdparty/network/Request.php b/vtlib/thirdparty/network/Request.php index 193b6e345..dbede7a08 100644 --- a/vtlib/thirdparty/network/Request.php +++ b/vtlib/thirdparty/network/Request.php @@ -932,7 +932,7 @@ class HTTP_Request $request = $this->_method . ' ' . $url . ' HTTP/' . $this->_http . "\r\n"; if (in_array($this->_method, $this->_bodyDisallowed) || - (0 == strlen($this->_body) && (HTTP_REQUEST_METHOD_POST != $this->_method || + (0 == strlen($this->_body ? $this->_body : "") && (HTTP_REQUEST_METHOD_POST != $this->_method || (empty($this->_postData) && empty($this->_postFiles))))) { $this->removeHeader('Content-Type'); -- GitLab