6

This question already has an answer here:

Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /vendor/magento/zendframework1/library/Zend/Cache/Backend.php on line 79

this function showing on this line

   while (list($name, $value) = each($directives)) {
        if (!is_string($name)) {
            Zend_Cache::throwException("Incorrect option name : $name");
        }
        $name = strtolower($name);
        if (array_key_exists($name, $this->_directives)) {
            $this->_directives[$name] = $value;
        }

    }

marked as duplicate by liyakat, Mohit Kumar Arora, Priyank, 7ochem, sv3n Jul 15 '18 at 13:42

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

6

each() function is deprecated in php7.2 you can replace each() function to foreach()

Open file <Magento Root>/vendor/magento/zendframework1/library/Zend/Cache/Backend.php on line 79 & change this function :

    while (list($name, $value) = each($directives)) {
        if (!is_string($name)) {
            Zend_Cache::throwException("Incorrect option name : $name");
        }
        $name = strtolower($name);
        if (array_key_exists($name, $this->_directives)) {
            $this->_directives[$name] = $value;
        }
    }

To

  foreach($directives as $name => $value) {
        if (!is_string($name)) {
            Zend_Cache::throwException("Incorrect option name : $name");
        }
        $name = strtolower($name);
        if (array_key_exists($name, $this->_directives)) {
            $this->_directives[$name] = $value;
      }
  }
4

Magento 2.2 is not compatible with php7.2 You must use php7.0

"require": {
    "php": "~5.5.0|~5.6.0|~7.0.0",
    "composer/composer": "1.0.0-beta1",
    "symfony/console": "~2.3 <2.7"
},
3

Magento 2 does not support php 7.2 until version 2.3 which is not out yet (rumour is it'll be out by the end of 2018)

So your only real option here is to downgrade php to 7.1. You could also ignore this error and run the risk of hitting other compatibility issues but that wouldn't be advisable.

TIP: You really shouldn't edit core files. Bad things happen!

  • yes you are right but we always need to update. php 7.2 is released, we can't wait for magento new version. – Surendra Kumar Ahir Jul 13 '18 at 15:27
  • Then you'll be running Magento on an unsupported stack and it'll likely be unusable, but that's your choice I guess. You can pretty much guarantee that you will have tons of issues. – Gareth James Jul 13 '18 at 15:32

Not the answer you're looking for? Browse other questions tagged or ask your own question.