Fixes issue #2228 (previous pull request that fixed this was closed due to me stuffing up ;-) )
Replaced foreach with array_walk
Merge branch '2.2/develop' into 2.2/fix_2
Changed to array_map
Merge pull request #2235 from jaminday/2.2/fix_2

Fixes issue #2228