I am getting below error in Magento 2.1 using PHP 7.2.

main.CRITICAL: Exception: Deprecated Functionality: The each() function is deprecated. This message will be suppressed on further calls in /vendor/magento/module-eav/Model/Entity/Collection/ on line 803 in

list($tableAlias, $tableName) = each($table);

1 Answer 1


As Answer Refereed by @RohanHapani

You Should use:

list($tableAlias, $tableName) = [key($table), current($table)];

Then Code is Like:

if (is_array($table)){
    list($tableAlias, $tableName) = [key($table), current($table)];
} else {
    $tableName = $table;

Hope this may help You!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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