Use foreach loop rather than array_map() to invoke do_hook() callbacks

Third-level subcommands (`wp bp group get_members`) are causing segmentation faults on my setup (wp-cli 0.15.0 or bdd601cb; PHP 5.5.12). I traced the problem to `WP_CLI::do_hook()`, and the following line:

    array_map( 'call_user_func', self::$hooks[ $when ] );

Changing to a foreach loop removes the problem.

I tried a bit of research, but couldn't find a root cause (eg on the PHP bug tracker).

See also #1175, #969