View Issue Details

IDProjectCategoryView StatusLast Update
0019178phpList 3 applicationGeneralpublic02-05-18 10:34
Reporterduncanc Assigned To 
Status resolvedResolutionfixed 
Product Version3.3.2-RC3 
Target Version3.3.2Fixed in Version3.3.2 
Summary0019178: In php 7.2 the each() function is deprecated

I suggest changing all uses of each() to the equivalent foreach construct.
TagsNo tags attached.



11-04-18 09:29

administrator   ~0060375

Yes, good idea. Are we still using each() anywhere? I can't remember using it, so it must be rather old code if we still do.


11-04-18 09:30

administrator   ~0060376

Maybe one for xheni?. This will need thorough testing though.


11-04-18 09:30

administrator   ~0060377

Ah, Duncan already did it :-)


11-04-18 09:34

updater   ~0060379

I did some spot testing of arbitrary pages that have changed, but not every single page or function.

But the code changes were automated using sed, so there's not really any possibility of "finger problems".

# replace "while (list(" by "foreach ("
grep -rl '= each(' | xargs sed -i -E 's/while \(list\((.+?), (.+?)\) = each\((.+?)\)\) \{/foreach (\3 as \1 => \2) {/'