Skip to content
This repository has been archived by the owner on May 16, 2018. It is now read-only.

PHP-functions each() and create_function() have been deprecated #747

Open
alexgit2k opened this issue Dec 5, 2017 · 8 comments
Open

PHP-functions each() and create_function() have been deprecated #747

alexgit2k opened this issue Dec 5, 2017 · 8 comments
Labels

Comments

@alexgit2k
Copy link

alexgit2k commented Dec 5, 2017

The PHP-functions each() and create_function() have been deprecated as of PHP 7.2.0, but are still used in ZF1:

demos/Zend/Mobile/Push/ApnsFeedback.php: while(list($token, $time) = each($tokens)) {

documentation/manual/en/module_specs/Zend_Mobile_Push-Apns.xml:while(list($token, $time) = each($tokens)) {

library/Zend/Cache/Backend.php: while (list($name, $value) = each($directives)) {
library/Zend/Config/Yaml.php: while (list($n, $line) = each($lines)) {
library/Zend/Http/UserAgent/Features/Adapter/TeraWurfl.php: while (list ($key, $value) = each($group)) {
library/Zend/XmlRpc/Value.php: list($type, $value) = each($xml);
library/Zend/XmlRpc/Value.php: list($type, $value) = each($namespaceXml);

tests/Zend/XmlRpc/RequestTest.php: while (list( , $node) = each($result)) {
tests/Zend/XmlRpc/RequestTest.php: while (list( , $node) = each($result)) {
tests/runalltests.php: while(list(, $file)=each($files)) {

So each() should be replaced by foreach() which is also 10 times faster or key()/current()/next().

library/Zend/Feed/Element.php: return array_map(create_function('$e', 'return new Zend_Feed_Element($e);'), $nodes);

Note

As ZF1 reached its End of Life, please note it here, if you forked ZF1 with PHP 7.2 Support.

@alexgit2k alexgit2k changed the title PHP-function each() has been deprecated PHP-functions each() and create_function() have been deprecated Dec 6, 2017
@shaneiseminger
Copy link

Zend_Rest_Route::assemble() signature needs to be modified like so for compatibility with Zend_Controller_Router_Route_Module::assemble.

library/Zend/Rest/Route.php: public function assemble($data = array(), $reset = false, $encode = true, $partial = false)

@Bukashk0zzz
Copy link

@shaneiseminger Have same issue

@Thiouzz
Copy link

Thiouzz commented Jan 26, 2018

setDirectives() in Zend\Cache\Backend.php have to be modified too:

foreach ($directives as $name => $value) {
...
}

@shaneiseminger
Copy link

What is the goal on this ticket? Has anyone created a 7.2 public forked project that these can be contributed to? Or is it just for everyone to maintain their own forks?

@shaneiseminger
Copy link

Never mind, just saw the discussion on discourse.

@falkenhawk
Copy link

Please take a look at https://github.com/zf1s - a “composeable” zf1 with some fixes added. All components are available on packagist.org with zf1s/ namespace and we are still keeping php 7.2+ compatibility.

@holtkamp
Copy link
Contributor

holtkamp commented May 14, 2018

@unhawkable https://github.com/zf1s is a fork of https://github.com/zf1

Is / will it be (better) maintained? Is @deadbeef84 involved in this as well?

Mmm, seems I already asked this, 🤓 zf1/zend-application#2 (comment)

@deadbeef84
Copy link

Sorry guys, I'm no longer involved in the PHP community; also I never intended to maintain this fork apart from mirroring the official library. Since zf1 reached its EOL more than 1½ year ago, I think it's about time to look for other frameworks 😁.

If there's anyone willing to take over and maintain this repo, let me know and I'll consider it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

8 participants