zendframework / zf1

This project reached its end-of-life on 2016-09-28. Contains conversion of ZF1 subversion repo to git, from version 15234 forward, and only containing master and release-1.12 branches and 1.12 tags.
https://framework.zend.com/blog/2016-06-28-zf1-eol.html
BSD 3-Clause "New" or "Revised" License
357 stars 801 forks source link

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

Open alexgit2k opened 6 years ago

alexgit2k commented 6 years ago

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

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().

- create_function() (https://wiki.php.net/rfc/deprecations_php_7_2#create_function)

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](https://framework.zend.com/blog/2016-06-28-zf1-eol.html), please note it here, if you forked ZF1 with PHP 7.2 Support.**
shaneiseminger commented 6 years ago

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 commented 6 years ago

@shaneiseminger Have same issue

Thiouzz commented 6 years ago

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

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

shaneiseminger commented 6 years ago

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 commented 6 years ago

Never mind, just saw the discussion on discourse.

falkenhawk commented 6 years ago

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 commented 6 years ago

@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, 🤓 https://github.com/zf1/zend-application/pull/2#issuecomment-343936472

deadbeef84 commented 6 years ago

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 :grin:.

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