Skip to content

Commit

Permalink
Changed while (list() = each()) to foreach as it is throws deprecated…
Browse files Browse the repository at this point in the history
… errors
  • Loading branch information
Max Böhme authored and Sieg committed Jun 19, 2018
1 parent f105622 commit 31a8eef
Show file tree
Hide file tree
Showing 18 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion source/Application/Component/CurrencyComponent.php
Expand Up @@ -107,7 +107,7 @@ public function render()

if ($this->getConfig()->getConfigParam('bl_perfLoadCurrency')) {
reset($this->aCurrencies);
while (list(, $oItem) = each($this->aCurrencies)) {
foreach ($this->aCurrencies as $oItem) {
$oItem->link = $oUrlUtils->processUrl($sUrl, true, ["cur" => $oItem->id]);
}
}
Expand Down
4 changes: 2 additions & 2 deletions source/Application/Component/LanguageComponent.php
Expand Up @@ -36,8 +36,8 @@ public function render()
if ($this->getConfig()->getConfigParam('bl_perfLoadLanguages')) {
$aLanguages = \OxidEsales\Eshop\Core\Registry::getLang()->getLanguageArray(null, true, true);
reset($aLanguages);
while (list($sKey, $oVal) = each($aLanguages)) {
$aLanguages[$sKey]->link = $this->getConfig()->getTopActiveView()->getLink($oVal->id);
foreach ($aLanguages as $oVal) {
$oVal->link = $this->getConfig()->getTopActiveView()->getLink($oVal->id);
}

return $aLanguages;
Expand Down
Expand Up @@ -413,7 +413,7 @@ protected function _prepareWhereQuery($whereQuery, $fullQuery)
{
if (count($whereQuery)) {
$myUtilsString = \OxidEsales\Eshop\Core\Registry::getUtilsString();
while (list($identifierName, $fieldValue) = each($whereQuery)) {
foreach ($whereQuery as $identifierName => $fieldValue) {
$fieldValue = trim($fieldValue);

//check if this is search string (contains % sign at beginning and end of string)
Expand Down
2 changes: 1 addition & 1 deletion source/Application/Controller/Admin/ArticleExtendAjax.php
Expand Up @@ -82,7 +82,7 @@ protected function _getDataFields($sQ)
$minimalPosition = null;
$minimalValue = null;
reset($dataFields);
while (list($position, $fields) = each($dataFields)) {
foreach ($dataFields as $position => $fields) {
// already set ?
if ($fields['_3'] == '0') {
$minimalPosition = null;
Expand Down
Expand Up @@ -133,7 +133,7 @@ public function render()

// assign all member variables to template
$aClassVars = get_object_vars($this);
while (list($name, $value) = each($aClassVars)) {
foreach ($aClassVars as $name => $value) {
$this->_aViewData[$name] = $value;
}

Expand Down
Expand Up @@ -36,7 +36,7 @@ public function render()
$aSystemInfo = [];
$aSystemInfo['pkg.info'] = $myConfig->getPackageInfo();
$oSmarty = \OxidEsales\Eshop\Core\Registry::getUtilsView()->getSmarty();
while (list($name, $value) = each($aClassVars)) {
foreach ($aClassVars as $name => $value) {
if (gettype($value) == "object") {
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion source/Application/Controller/Admin/ToolsList.php
Expand Up @@ -126,7 +126,7 @@ protected function _processFiles()
{
if (isset($_FILES['myfile']['name'])) {
// process all files
while (list($key, $value) = each($_FILES['myfile']['name'])) {
foreach ($_FILES['myfile']['name'] as $key => $value) {
$aSource = $_FILES['myfile']['tmp_name'];
$sSource = $aSource[$key];
$aFiletype = explode("@", $key);
Expand Down
2 changes: 1 addition & 1 deletion source/Application/Controller/Admin/UserMain.php
Expand Up @@ -64,7 +64,7 @@ public function render()
if (!($oUser->oxuser__oxrights->value == "malladmin" && !$blisMallAdmin)) {
// generate selected right
reset($aUserRights);
while (list(, $val) = each($aUserRights)) {
foreach ($aUserRights as $val) {
if ($val->id == $oUser->oxuser__oxrights->value) {
$val->selected = 1;
break;
Expand Down
4 changes: 2 additions & 2 deletions source/Application/Model/Basket.php
Expand Up @@ -619,7 +619,7 @@ public function removeItem($sItemKey)
protected function _clearBundles()
{
reset($this->_aBasketContents);
while (list($sItemKey, $oBasketItem) = each($this->_aBasketContents)) {
foreach ($this->_aBasketContents as $sItemKey => $oBasketItem) {
if ($oBasketItem->isBundle()) {
$this->removeItem($sItemKey);
}
Expand Down Expand Up @@ -1852,7 +1852,7 @@ public function getBasketArticles()
$aSelList = $oBasketItem->getSelList();
if (is_array($aSelList) && ($aSelectlist = $oProduct->getSelectLists($sItemKey))) {
reset($aSelList);
while (list($conkey, $iSel) = each($aSelList)) {
foreach ($aSelList as $conkey => $iSel) {
$aSelectlist[$conkey][$iSel]->selected = 1;
}
$oProduct->setSelectlist($aSelectlist);
Expand Down
2 changes: 1 addition & 1 deletion source/Core/Config.php
Expand Up @@ -1622,7 +1622,7 @@ public function getCurrencyArray($currency = null)
// processing currency configuration data
$currencies = [];
reset($confCurrencies);
while (list($key, $val) = each($confCurrencies)) {
foreach ($confCurrencies as $key => $val) {
if ($val) {
$cur = new stdClass();
$cur->id = $key;
Expand Down
2 changes: 1 addition & 1 deletion source/Core/DebugInfo.php
Expand Up @@ -22,7 +22,7 @@ public function formatTemplateData($viewData = [])
{
$log = '';
reset($viewData);
while (list($viewName, $viewDataObject) = each($viewData)) {
foreach ($viewData as $viewName => $viewDataObject) {
// show debbuging information
$log .= "TemplateData[$viewName] : <br />\n";
$log .= print_r($viewDataObject, 1);
Expand Down
2 changes: 1 addition & 1 deletion source/Core/Language.php
Expand Up @@ -303,7 +303,7 @@ public function getLanguageArray($iLanguage = null, $blOnlyActive = false, $blSo
if (is_array($aConfLanguages)) {
$i = 0;
reset($aConfLanguages);
while (list($key, $val) = each($aConfLanguages)) {
foreach ($aConfLanguages as $key => $val) {
if ($blOnlyActive && is_array($aLangParams)) {
//skipping non active languages
if (!$aLangParams[$key]['active']) {
Expand Down
4 changes: 2 additions & 2 deletions source/Core/Model/BaseModel.php
Expand Up @@ -381,7 +381,7 @@ public function __clone()
public function oxClone($object)
{
$classVariables = get_object_vars($object);
while (list($name, $value) = each($classVariables)) {
foreach ($classVariables as $name => $value) {
if (is_object($object->$name)) {
$this->$name = clone $object->$name;
} else {
Expand Down Expand Up @@ -697,7 +697,7 @@ public function buildSelectString($whereCondition = null)

if ($whereCondition) {
reset($whereCondition);
while (list($name, $value) = each($whereCondition)) {
foreach ($whereCondition as $name => $value) {
$query .= ' and ' . $name . ' = ' . $database->quote($value);
}
}
Expand Down
4 changes: 2 additions & 2 deletions source/Core/Utils.php
Expand Up @@ -103,7 +103,7 @@ public function assignValuesFromText($sIn, $dVat = null)
{
$aRet = [];
$aPieces = explode('@@', $sIn);
while (list($sKey, $sVal) = each($aPieces)) {
foreach ($aPieces as $sVal) {
if ($sVal) {
$aName = explode('__', $sVal);
if (isset($aName[0]) && isset($aName[1])) {
Expand All @@ -126,7 +126,7 @@ public function assignValuesToText($aIn)
{
$sRet = "";
reset($aIn);
while (list($sKey, $sVal) = each($aIn)) {
foreach ($aIn as $sKey => $sVal) {
$sRet .= $sKey;
$sRet .= "__";
$sRet .= $sVal;
Expand Down
2 changes: 1 addition & 1 deletion source/Core/UtilsFile.php
Expand Up @@ -424,7 +424,7 @@ public function processFiles($oObject = null, $aFiles = [], $blUseMasterImage =

$oEx = oxNew(\OxidEsales\Eshop\Core\Exception\ExceptionToDisplay::class);
// process all files
while (list($sKey, $sValue) = each($aFiles['myfile']['name'])) {
foreach ($aFiles['myfile']['name'] as $sKey => $sValue) {
$sSource = $aSource[$sKey];
$iError = $aError[$sKey];
$aFiletype = explode("@", $sKey);
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Application/Model/UserTest.php
Expand Up @@ -233,7 +233,7 @@ protected function createUser($sUserName = null, $iActive = 1, $sRights = 'user'
$oPayment->setDynValues($oUtils->assignValuesFromText($oPayment->oxpayments__oxvaldesc->value, true, true, true));

$aDynValues = $oPayment->getDynValues();
while (list($key, $oVal) = each($aDynValues)) {
foreach ($aDynValues as $key => $oVal) {
$oVal = new oxField($aDynValue[$oVal->name], oxField::T_RAW);
$oPayment->setDynValue($key, $oVal);
$aDynVal[$oVal->name] = $oVal->value;
Expand Down
8 changes: 4 additions & 4 deletions tests/Unit/Core/BaseTest.php
Expand Up @@ -1004,7 +1004,7 @@ public function testSetFieldData()
$oBase = new _oxBase();
$oBase->init("oxactions");
$rs = array("oxid" => "oxstart", "oxtitle" => "Startseite unten");
while (list($name, $value) = each($rs)) {
foreach ($rs as $name => $value) {
$oBase->setFieldData($name, $value);
}
$this->assertEquals($oBase->oxactions__oxid->value, "oxstart");
Expand All @@ -1021,7 +1021,7 @@ public function testSetFieldDataLongName()
$oBase = new _oxBase();
$oBase->init("oxactions");
$rs = array("oxid" => "oxstart", "oxactions__oxtitle" => "Startseite unten");
while (list($name, $value) = each($rs)) {
foreach ($rs as $name => $value) {
$oBase->setFieldData($name, $value);
}
$this->assertEquals($oBase->oxactions__oxid->value, "oxstart");
Expand All @@ -1039,7 +1039,7 @@ public function testSetFieldDataNonExistingLazyLoading()
$oBase->setClassVar("_blUseLazyLoading", true);
$oBase->init("oxactions");
$rs = array("oxid" => "oxstart", "oxactions__oxtestval" => "Startseite unten", "oxtestval2" => "TestVal2");
while (list($name, $value) = each($rs)) {
foreach ($rs as $name => $value) {
$oBase->setFieldData($name, $value);
}
//standard field
Expand All @@ -1065,7 +1065,7 @@ public function testSetFieldDataNonExistingNonLazyLoading()
$aFieldNames = $oBase->getNonPublicVar('_aFieldNames');
$this->assertFalse(isset($aFieldNames['oxtitle']));
$rs = array("oxid" => "oxstart", "oxtitle" => "Startseite unten");
while (list($name, $value) = each($rs)) {
foreach ($rs as $name => $value) {
$oBase->UNITsetFieldData($name, $value);
}
//standard field
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Core/ListTest.php
Expand Up @@ -428,7 +428,7 @@ public function testUnsetWhile()
$iTotal = count($oList);
$this->assertEquals(4, $iTotal);
reset($oList);
while (list($sKey, $sVal) = each($oList->aList)) {
foreach ($oList->aList as $sKey => $sVal) {
$this->assertEquals($iTotal, count($oList));
$this->assertEquals('cnt' . $iTotal, $sVal);

Expand Down

0 comments on commit 31a8eef

Please sign in to comment.