Warning: array_splice() expects parameter 1 to be array, null given in ShellDispatcher.php

I hit this error using console of cakephp 2.3.8 but you can encounter this issue on other versions as well.
The solution is to edit (command line arguments are not seen)
app/Console/cake and on on the line:

exec php -q "$CONSOLE"/cake.php -working "$APP" "$@"

after -q add

-d register_argc_argv=1 

so the line will look like:

exec php -q -d register_argc_argv=1 "$CONSOLE"/cake.php -working "$APP" "$@"