Being still in Beta, I guess it will have it quirks. One I found was that if the remote filename has brackets in it, it just wont work.
I should file it as a bug report, but find the process all intimidating really - I am always just a stupid user who does not know what he is on about!
But anyway - the work around of renaming the file before downloading it works fine.
use:
$_new_path = str_replace("(", "", $_path );
$_new_path = str_replace(")", "", $_new_path );
ssh2_sftp_rename( $sftp, $_path, $_new_path );
To tell you the truth I haven't determined if it is the open or close bracket, or both. Someone else can investigate that.
Meanwhile, it would be good to know all the bad filename characters which this function has problems with, no doubt there are more.