Stupid mistake on the first one, thanks for catching.
Second one I'm confused. locateExecutableInDefaultPaths() is designed to take an array as well.
Problem was line 1101 were the $bash array was converted to string:
$line = wfShellExec( "$bash -c $encCommand", $retval );