Fix invalid foreach statement (Bug #12992)

The commit 59d11b153a16de754edbcffb426c52324e4c17f3 introduces a badly declared foreach loop to process BODYPARTSIZE for binary parts. This cause a undefined index 'key' PHP error.