Looks like this has been fixed in the new-as-of-today 0.3.6 release. It was fixed in git three months ago whereas the 0.3.5 release was released 9 months ago.
https://github.com/phpseclib/phpseclib/pull/167
Also, for bug reports / code improvements you'd probably be better off posting in the github.com project than on stackoverflow.