From 0daeb65bb2bb0f8105bf802000e025b0fa7b1c64 Mon Sep 17 00:00:00 2001 From: AGelzer Date: Sat, 17 Dec 2022 18:34:14 +0100 Subject: [PATCH 1/2] optimisation for Varien_Object::_addFullNames --- lib/Varien/Object.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/Varien/Object.php b/lib/Varien/Object.php index 790f897ef6d..dfdb31bbea6 100644 --- a/lib/Varien/Object.php +++ b/lib/Varien/Object.php @@ -111,12 +111,9 @@ public function __construct() protected function _addFullNames() { - $existedShortKeys = array_intersect($this->_syncFieldsMap, array_keys($this->_data)); - if (!empty($existedShortKeys)) { - foreach ($existedShortKeys as $key) { - $fullFieldName = array_search($key, $this->_syncFieldsMap); - $this->_data[$fullFieldName] = $this->_data[$key]; - } + $existedShortKeys = array_intersect_key(array_flip($this->_syncFieldsMap), $this->_data); + foreach ($existedShortKeys as $key => $fullFieldName) { + $this->_data[$fullFieldName] = $this->_data[$key]; } } From 5a816b742610c07195ad95258bf48d522b3dffe7 Mon Sep 17 00:00:00 2001 From: AGelzer Date: Sun, 18 Dec 2022 14:42:20 +0100 Subject: [PATCH 2/2] optimisation for Varien_Object::_addFullNames --- lib/Varien/Object.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/Varien/Object.php b/lib/Varien/Object.php index dfdb31bbea6..2db7d8fbeac 100644 --- a/lib/Varien/Object.php +++ b/lib/Varien/Object.php @@ -111,6 +111,10 @@ public function __construct() protected function _addFullNames() { + if (empty($this->_syncFieldsMap)) { + return; + } + $existedShortKeys = array_intersect_key(array_flip($this->_syncFieldsMap), $this->_data); foreach ($existedShortKeys as $key => $fullFieldName) { $this->_data[$fullFieldName] = $this->_data[$key];