From 1bead7cc4672d1773988cb48c24d3e7e05214d7b Mon Sep 17 00:00:00 2001 From: "Hahn Axel (hahn)" <axel.hahn@iml.unibe.ch> Date: Thu, 8 Jun 2017 09:48:28 +0200 Subject: [PATCH] task-1462: replace usage of ARRAY_FILTER_USE_BOTH for older php versions --- public_html/deployment/classes/foremanapi.class.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/public_html/deployment/classes/foremanapi.class.php b/public_html/deployment/classes/foremanapi.class.php index afde157b..3e458925 100644 --- a/public_html/deployment/classes/foremanapi.class.php +++ b/public_html/deployment/classes/foremanapi.class.php @@ -383,10 +383,13 @@ class ForemanApi { } $aReturn=array(); foreach($aTmp as $aItem){ - $aReturn[] = array_filter($aItem, function($key) { - return array_search($key, $this->_aRequest['response']) !==false; - }, ARRAY_FILTER_USE_KEY - ); + $aReturnitem=array(); + foreach($this->_aRequest['response'] as $sKey){ + if (array_key_exists($sKey, $aItem)){ + $aReturnitem[$sKey]=$aItem[$sKey]; + } + } + $aReturn[] = $aReturnitem; } return ($bIsList==1) ? $aReturn -- GitLab