From 7af2075b8f59ca023e151f3cd0732150ba481623 Mon Sep 17 00:00:00 2001 From: Alexander Kaufmann Date: Tue, 1 May 2018 17:46:03 +0200 Subject: [PATCH] fix php 7.2 compatibility, each is deprecated --- library/Zend/Cache/Backend.php | 2 +- library/Zend/Config/Yaml.php | 2 +- library/Zend/Http/UserAgent/Features/Adapter/TeraWurfl.php | 2 +- .../Zend/Service/DeveloperGarden/Client/ClientAbstract.php | 2 +- library/Zend/XmlRpc/Value.php | 6 ++++-- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/library/Zend/Cache/Backend.php b/library/Zend/Cache/Backend.php index 83f1af5..3d99e09 100644 --- a/library/Zend/Cache/Backend.php +++ b/library/Zend/Cache/Backend.php @@ -76,7 +76,7 @@ public function __construct(array $options = array()) public function setDirectives($directives) { if (!is_array($directives)) Zend_Cache::throwException('Directives parameter must be an array'); - while (list($name, $value) = each($directives)) { + foreach ($directives as $name => $value) { if (!is_string($name)) { Zend_Cache::throwException("Incorrect option name : $name"); } diff --git a/library/Zend/Config/Yaml.php b/library/Zend/Config/Yaml.php index 0d10703..a315ef5 100755 --- a/library/Zend/Config/Yaml.php +++ b/library/Zend/Config/Yaml.php @@ -289,7 +289,7 @@ protected static function _decodeYaml($currentIndent, &$lines) { $config = array(); $inIndent = false; - while (list($n, $line) = each($lines)) { + foreach ($lines as $n => $line) { $lineno = $n + 1; $line = rtrim(preg_replace("/#.*$/", "", $line)); diff --git a/library/Zend/Http/UserAgent/Features/Adapter/TeraWurfl.php b/library/Zend/Http/UserAgent/Features/Adapter/TeraWurfl.php index b23dc29..4448ed5 100644 --- a/library/Zend/Http/UserAgent/Features/Adapter/TeraWurfl.php +++ b/library/Zend/Http/UserAgent/Features/Adapter/TeraWurfl.php @@ -88,7 +88,7 @@ public static function getAllCapabilities(TeraWurfl $wurflObj) if (!is_array($group)) { continue; } - while (list ($key, $value) = each($group)) { + foreach ($group as $key => $value) { if (is_bool($value)) { // to have the same type than the official WURFL API $features[$key] = ($value ? 'true' : 'false'); diff --git a/library/Zend/Service/DeveloperGarden/Client/ClientAbstract.php b/library/Zend/Service/DeveloperGarden/Client/ClientAbstract.php index ed1b023..2e3fc21 100644 --- a/library/Zend/Service/DeveloperGarden/Client/ClientAbstract.php +++ b/library/Zend/Service/DeveloperGarden/Client/ClientAbstract.php @@ -135,7 +135,7 @@ public function __construct(array $options = array()) { $this->_credential = new Zend_Service_DeveloperGarden_Credential(); - while (list($name, $value) = each($options)) { + foreach ($options as $name => $value) { switch (ucfirst($name)) { case 'Username' : $this->_credential->setUsername($value); diff --git a/library/Zend/XmlRpc/Value.php b/library/Zend/XmlRpc/Value.php index 6b22449..07de9f3 100644 --- a/library/Zend/XmlRpc/Value.php +++ b/library/Zend/XmlRpc/Value.php @@ -486,13 +486,15 @@ protected static function _createSimpleXMLElement(&$xml) */ protected static function _extractTypeAndValue(SimpleXMLElement $xml, &$type, &$value) { - list($type, $value) = each($xml); + $type = key($xml); + $value = current($xml); if (!$type and $value === null) { $namespaces = array('ex' => 'http://ws.apache.org/xmlrpc/namespaces/extensions'); foreach ($namespaces as $namespaceName => $namespaceUri) { $namespaceXml = $xml->children($namespaceUri); - list($type, $value) = each($namespaceXml); + $type = key($namespaceXml); + $value = current($namespaceXml); if ($type !== null) { $type = $namespaceName . ':' . $type; break;