Skip to content
This repository was archived by the owner on Jan 8, 2020. It is now read-only.
This repository was archived by the owner on Jan 8, 2020. It is now read-only.

PHP-function each() has been deprecated (ZF2) #7777

Open
@alexgit2k

Description

@alexgit2k

The PHP-function each() has been deprecated as of PHP 7.2.0 (https://wiki.php.net/rfc/deprecations_php_7_2#each), but is still used in ZF 2.4:

library/Zend/XmlRpc/AbstractValue.php: list($type, $value) = each($xmlAsArray);
library/Zend/XmlRpc/AbstractValue.php: list($type, $value) = each($namespaceXml);

tests/ZendTest/Db/Sql/Platform/Mysql/MysqlTest.php: list($type, $decorator) = each($decorators);
tests/ZendTest/Db/Sql/Platform/SqlServer/SqlServerTest.php: list($type, $decorator) = each($decorators);
tests/ZendTest/Form/View/Helper/FormSelectTest.php: list($value, $label) = each($options);
tests/ZendTest/ServiceManager/TestAsset/FooInitializer.php: list($key, $value) = each($this->var);
tests/ZendTest/XmlRpc/RequestTest.php: while (list(, $node) = each($result)) {
tests/ZendTest/XmlRpc/RequestTest.php: while (list(, $node) = each($result)) {

So each() should be replaced by foreach() which is also 10 times faster.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions