Skip to content
This repository has been archived by the owner on Jun 10, 2019. It is now read-only.

The each function in Magento with PHP 7.2 #150

Open
luigifab opened this issue Aug 30, 2018 · 0 comments
Open

The each function in Magento with PHP 7.2 #150

luigifab opened this issue Aug 30, 2018 · 0 comments

Comments

@luigifab
Copy link

luigifab commented Aug 30, 2018

Hello world

I have created a "pseudo fix" for the deprecated each function used in Magento.
I'm working on it since 20 minutes, but now I can browse my Magento 1.4.1.0, 1.5.0.1, 1.6.0.0, 1.7.0.0, 1.8.0.0, 1.9.0.0, 1.9.0.0, 1.9.3.9 (frontend and backend) with PHP 7.2.9 (with the v3 of Inchoo/PHP7 module).

First, in all files where I found = each(, I used some regular expressions:

while \(list\s*\(\$([a-z0-9A-Z_]+), \$([a-z0-9A-Z_]+)\) = each\(\$([a-z0-9A-Z_\[\]']+)\)\)
foreach ($\3 as $\1 => $\2)

while \(list\s*\(,\s*\$([a-z0-9A-Z_]+)\) = each\(\$([a-z0-9A-Z_\[\]']+)\)\)
foreach ($\2 as $\1)

while \(list\s*\(\$([a-z0-9A-Z_]+),\s*\) = each\(\$([a-z0-9A-Z_\[\]']+)\)\)
foreach ($\2 as $\1 => $abcdefg)

 list\s*\(\$([a-z0-9A-Z_]+), \$([a-z0-9A-Z_]+)\) = each\(\$([a-z0-9A-Z_\[\]']+)\);
 foreach ($\3 as $\1 => $\2) { break; }

Secondly, I make some manual change.

See the full diff https://bit.ly/2xF76B1 (with some part of Inchoo/PHP7 and PHP 7.2 official patch).

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

No branches or pull requests

1 participant