diff --git a/include/fields/CurrencyField.php b/include/fields/CurrencyField.php
index 46114dc612142677eee91cb3c034f757778b3caf..294438a77efaaac85382768bacc8b5a88feb36f2 100644
--- a/include/fields/CurrencyField.php
+++ b/include/fields/CurrencyField.php
@@ -447,7 +447,7 @@ class CurrencyField {
 				$decimalSeparator = $user->currency_decimal_separator;
 			}
 
-			$fieldValue = explode(decode_html($decimalSeparator), $value);
+			$fieldValue = vtlib_array(explode(decode_html($decimalSeparator), $value));
 			if(strlen($fieldValue[1]) <= 1){
 				if(strlen($fieldValue[1]) == 1) {
 					return $value = $fieldValue[0].$decimalSeparator.$fieldValue[1];
diff --git a/include/utils/VtlibUtils.php b/include/utils/VtlibUtils.php
index 9f0390e7432e4da24e815de18954c1e9345cc283..c28552ff02faac95f50945f3482da392d25099d3 100644
--- a/include/utils/VtlibUtils.php
+++ b/include/utils/VtlibUtils.php
@@ -103,8 +103,8 @@ function vtlib_isModuleActive($module) {
 
 	if(!isset($__cache_module_activeinfo[$module])) {
 		include 'tabdata.php';
-		$tabId = $tab_info_array[$module];
-		$presence = $tab_seq_array[$tabId];
+		$tabId = vtlib_array($tab_info_array)[$module];
+		$presence = vtlib_array($tab_seq_array)[$tabId];
 		$__cache_module_activeinfo[$module] = $presence;
 	} else {
 		$presence = $__cache_module_activeinfo[$module];
@@ -722,7 +722,9 @@ function vtlib_purify($input, $ignore = false) {
                 $value = purifyHtmlEventAttributes($value, true);
             }
         }
-        $purified_cache[$md5OfInput] = $value;
+		if (isset($md5OfInput)) {
+			$purified_cache[$md5OfInput] = $value;
+		}
     }
     
     if(is_array($value)) {
@@ -980,6 +982,14 @@ function vtlib_addSettingsLink($linkName, $linkURL, $blockName = false) {
 	return $success;
 }
 
+/**
+ * PHP Strict helpers.
+ */
+require_once "vtlib/Vtiger/Utils/GuardedArray.php";
+function vtlib_array($data = null) {
+	return new Vtiger_GuardedArray($data);
+}
+
 /**
  * PHP7 support for split function
  * split : Case sensitive.
diff --git a/includes/runtime/Controller.php b/includes/runtime/Controller.php
index 2b80dfa254004586c80c125a16b1fdc4aa1fecbc..a1cccd704e8bebee2792f5f0e5a2e43318b1c098 100644
--- a/includes/runtime/Controller.php
+++ b/includes/runtime/Controller.php
@@ -227,6 +227,11 @@ abstract class Vtiger_View_Controller extends Vtiger_Action_Controller {
 
 			// Popupview
 			$viewer->assign('IS_MODULE_DISABLED', false);
+
+			// Widgets
+			$viewer->assign('SCRIPTS', array());
+			$viewer->assign('STYLES', array());
+			$viewer->assign('SETTING_EXIST', false);
 		}
 		return $this->viewer;
 	}
diff --git a/includes/runtime/Viewer.php b/includes/runtime/Viewer.php
index 45b490ba1315a989ebc60e2a1a17e8d295f7adb3..c2271e765c6aa0c92341b7a3e4da3a8174cea630 100644
--- a/includes/runtime/Viewer.php
+++ b/includes/runtime/Viewer.php
@@ -70,6 +70,30 @@ class Vtiger_Viewer extends Smarty {
 			
 			$this->log("URI: $debugViewerURI, TYPE: " . $_SERVER['REQUEST_METHOD']);
 		}
+
+		$classes = array('Vtiger_MenuStructure_Model', 'Users_Privileges_Model', 
+			'Vtiger_Module_Model', 'Settings_MenuEditor_Module_Model', 'Vtiger_Util_Helper', 
+			'ZEND_JSON', 'Zend_Json', 'Zend_JSON',
+			'Vtiger_Theme', 'Users_Record_Model', 'Vtiger_Module_Model', 'Vtiger_Field_Model', 
+			'Settings_Picklist_Module_Model', 'CustomView_Record_Model', 'Vtiger_Extension_View',
+			'Vtiger_Tag_Model',
+			'Vtiger_Functions', 'Users', 'CurrencyField');
+		foreach ($classes as $clazz) {
+			if (class_exists($clazz)) {
+				$this->registerClass($clazz, $clazz);
+			}
+		}
+
+		$modifiers = array('vtranslate', 'vtlib_isModuleActive', 'vimage_path', 'strstr', 'stripos', 'strpos', 'date', 'vtemplate_path', 'vresource_url', 
+			'decode_html', 'vtlib_purify', 'php7_count', 'getUserFullName', 'array_flip', 'explode', 'trim', 'array_push',
+			'array_map', 'array_key_exists', 'get_class', 'vtlib_array', 'getDuplicatesPreventionMessage', 'htmlentities',
+			'getCurrencySymbolandCRate', 'mb_substr', 'isPermitted', 'getEntityName',
+			'strtolower', 'strtoupper');
+		foreach ($modifiers as $modifier) {
+			if (function_exists($modifier)) {
+				$this->registerPlugin('modifier', $modifier, $modifier);
+			}
+		}
 	}
 
 	// Backward compatible to SmartyBC
diff --git a/layouts/v7/modules/Vtiger/uitypes/OwnerFieldSearchView.tpl b/layouts/v7/modules/Vtiger/uitypes/OwnerFieldSearchView.tpl
index 8ba31e8f28cd35375ba13b7fc8790695aec36c81..d53a45072ea6771f12db6ad5b29edd59fba86f6e 100644
--- a/layouts/v7/modules/Vtiger/uitypes/OwnerFieldSearchView.tpl
+++ b/layouts/v7/modules/Vtiger/uitypes/OwnerFieldSearchView.tpl
@@ -10,7 +10,7 @@
  ********************************************************************************/
 -->*}
 {strip}
-    {assign var="FIELD_INFO" value=$FIELD_MODEL->getFieldInfo()}
+    {assign var="FIELD_INFO" value=$FIELD_MODEL->getFieldInfo()|vtlib_array}
     <div class="select2_search_div">
     {assign var=ASSIGNED_USER_ID value=$FIELD_MODEL->get('name')}
     {assign var=ALL_ACTIVEUSER_LIST value=$FIELD_INFO['picklistvalues'][vtranslate('LBL_USERS')]}
@@ -49,4 +49,4 @@
         {/if}
 	</select>
     </div>
-{/strip}
\ No newline at end of file
+{/strip}
diff --git a/modules/Calendar/models/Record.php b/modules/Calendar/models/Record.php
index f19a72b9380ea282b6ddf7cd21f33310e094a402..d13c3c4ba7320c12ca4e9cd774b9d005efdb8937 100644
--- a/modules/Calendar/models/Record.php
+++ b/modules/Calendar/models/Record.php
@@ -142,6 +142,7 @@ class Calendar_Record_Model extends Vtiger_Record_Model {
 	 * @return <Array> - which contains Recurring Information
 	 */
 	public function getRecurringDetails() {
+		global $currentModule;
 		$recurringObject = $this->getRecurringObject();
 		if ($recurringObject) {
 			$recurringInfoDisplayData = $recurringObject->getDisplayRecurringInfo();
diff --git a/modules/Leads/models/Module.php b/modules/Leads/models/Module.php
index 08ba884402b00928f9b1247cd125a8eded5018f7..91754b926895cc27ed0b187d0cac9e210a3dc730 100644
--- a/modules/Leads/models/Module.php
+++ b/modules/Leads/models/Module.php
@@ -136,6 +136,7 @@ class Leads_Module_Model extends Vtiger_Module_Model {
 			$ownerSql = ' AND '.$ownerSql;
 		}
 		
+		$dateFilterSql = '';
 		$params = array();
 		if(!empty($dateFilter)) {
 			$dateFilterSql = ' AND createdtime BETWEEN ? AND ? ';
diff --git a/modules/PickList/PickListUtils.php b/modules/PickList/PickListUtils.php
index 944ab639309c96b7d0d815020b71a2807a99e2dc..172481af680e7ff09005d854bad8627f8c4594ee 100644
--- a/modules/PickList/PickListUtils.php
+++ b/modules/PickList/PickListUtils.php
@@ -101,6 +101,8 @@ function get_available_module_picklist($picklist_details){
  * @return array $arr - the array containing the picklist values
  */
 function getAllPickListValues($fieldName,$lang = Array() ){
+	$lang = vtlib_array($lang);
+	
 	global $adb;
 	if(Vtiger_Cache::get('AllPicklistValues',$fieldName)){
 		return Vtiger_Cache::get('AllPicklistValues',$fieldName);
diff --git a/modules/Users/UserTimeZonesArray.php b/modules/Users/UserTimeZonesArray.php
index 96392ab9ac68dc72a83c397182766d8ba622fbaf..f39629134b5dce62b06b60b1372d1f991f2e127c 100644
--- a/modules/Users/UserTimeZonesArray.php
+++ b/modules/Users/UserTimeZonesArray.php
@@ -13,7 +13,7 @@
  * Contributor(s): ______________________________________.
  ********************************************************************************/
 class UserTimeZones{
-	function userTimeZones(){
+	function __construct(){
 		$arrayOfSupportedTimeZones = array(
 										'Pacific/Midway',
 										'Pacific/Samoa',
@@ -116,4 +116,4 @@ class UserTimeZones{
 	}
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/modules/Users/models/Record.php b/modules/Users/models/Record.php
index 06fc11f1d9f6f949b04adb8d509f6fe295f8fee1..6f97b8683a93af086395be540933538b237e638d 100644
--- a/modules/Users/models/Record.php
+++ b/modules/Users/models/Record.php
@@ -598,7 +598,8 @@ class Users_Record_Model extends Vtiger_Record_Model {
 	function getTagCloudStatus() {
 		$db = PearDatabase::getInstance();
 		$query = "SELECT visible FROM vtiger_homestuff WHERE userid=? AND stufftype='Tag Cloud'";
-		$visibility = $db->query_result($db->pquery($query, array($this->getId())), 0, 'visible');
+		$rs = $db->pquery($query, array($this->getId()));
+		$visibility = $db->query_result($rs, 0, 'visible');
 		if($visibility == 0) {
 			return true;
 		} 
diff --git a/modules/Vtiger/actions/SaveWidgetPositions.php b/modules/Vtiger/actions/SaveWidgetPositions.php
index 742d68ea75a710805aee2d93345f5e416a7d67d4..66c7a7b4675ed8f1674c6b9359d4a9972a7cc2cb 100644
--- a/modules/Vtiger/actions/SaveWidgetPositions.php
+++ b/modules/Vtiger/actions/SaveWidgetPositions.php
@@ -24,7 +24,7 @@ class Vtiger_SaveWidgetPositions_Action extends Vtiger_IndexAjax_View {
 	public function process(Vtiger_Request $request) {
 		$currentUser = Users_Record_Model::getCurrentUserModel();
 		
-		$positionsMap = $request->get('positionsmap');
+		$positionsMap = vtlib_array($request->get('positionsmap'));
 		
 		if ($positionsMap) {
 			foreach ($positionsMap as $id => $position) {
diff --git a/modules/Vtiger/models/Module.php b/modules/Vtiger/models/Module.php
index 0c578baf6e5460c1658ede89049baa656dae4ce7..35d844b881a7deec5a3a96154992240093544e33 100644
--- a/modules/Vtiger/models/Module.php
+++ b/modules/Vtiger/models/Module.php
@@ -1229,6 +1229,7 @@ class Vtiger_Module_Model extends Vtiger_Module {
 	public function getOwnerWhereConditionForDashBoards ($owner) {
 		$currentUserModel = Users_Record_Model::getCurrentUserModel();
 		$sharingAccessModel = Settings_SharingAccess_Module_Model::getInstance($this->getName());
+		$ownerSql = '';
 		$params = array();
 		if(!empty($owner) && $currentUserModel->isAdminUser()) {//If admin user, then allow users data
 			$ownerSql =  ' smownerid = '. $owner;
diff --git a/modules/Vtiger/uitypes/Time.php b/modules/Vtiger/uitypes/Time.php
index 9c64034cfa01c3d3dd81a2c42f71e78d04d4fa28..4ee1b37e0efbef87245f4d8120cfc3b1349d872c 100644
--- a/modules/Vtiger/uitypes/Time.php
+++ b/modules/Vtiger/uitypes/Time.php
@@ -35,6 +35,7 @@ class Vtiger_Time_UIType extends Vtiger_Base_UIType {
 	 */
 	public static function getTimeValueInAMorPM($time) {
 		if($time){
+			if (substr_count($time, ':') < 2) $time .= ':'; /* to overcome notice of missing index 2 (seconds) below */
 			list($hours, $minutes, $seconds) = explode(':', $time);
 			$format = vtranslate('PM');
 
diff --git a/modules/Vtiger/views/ShowWidget.php b/modules/Vtiger/views/ShowWidget.php
index 44a71522fe75891ee3e9c5fa3b6bcaf4fc181772..a4fecce69f5787bd72fcf6b2c591e29606e45155 100644
--- a/modules/Vtiger/views/ShowWidget.php
+++ b/modules/Vtiger/views/ShowWidget.php
@@ -58,6 +58,7 @@ class Vtiger_ShowWidget_View extends Vtiger_IndexAjax_View {
 				$createdTime = $request->get('createdtime');
 				//user format dates should be used in getSearchParams() api
 				$request->set('dateFilter', $createdTime);
+				$dates = array();
 				if(!empty($createdTime)) {
 					$startDate = Vtiger_Date_UIType::getDBInsertedValue($createdTime['start']);
 					$dates['start'] = getValidDBInsertDateTimeValue($startDate . ' 00:00:00');
diff --git a/vtlib/Vtiger/Utils/GuardedArray.php b/vtlib/Vtiger/Utils/GuardedArray.php
new file mode 100644
index 0000000000000000000000000000000000000000..f522a01418bf56084dbde5f5b762c6710e08fbd8
--- /dev/null
+++ b/vtlib/Vtiger/Utils/GuardedArray.php
@@ -0,0 +1,36 @@
+<?php
+/*+***********************************************************************************
+ * The contents of this file are subject to the vtiger CRM Public License Version 1.0
+ * ("License"); You may not use this file except in compliance with the License
+ * The Original Code is:  vtiger CRM Open Source
+ * The Initial Developer of the Original Code is vtiger.
+ * Portions created by vtiger are Copyright (C) vtiger.
+ * All Rights Reserved.
+ *************************************************************************************/
+
+class Vtiger_GuardedArray implements \ArrayAccess {
+    private $data;
+
+    function __construct($data = null) {
+        $this->data = is_null($data) ? array() : $data;
+    }
+
+    function offsetExists($key) {
+        return isset($this->data[$key]) && array_key_exists($key, $this->data);
+    }
+
+    function offsetGet($key) {
+        if ($this->offsetExists($key)) {
+            return $this->data[$key];
+        }
+        return null;
+    }
+    
+    function offsetSet($key, $value) {
+        $this->data[$key] = $value;
+    }
+
+    function offsetUnset($key) {
+        unset($this->data[$key]);
+    }
+}
\ No newline at end of file