How to Encrypt Large Messages with Asymmetric Keys and phpseclib

I found the same problem. The code in github is buggy, and different to what’s in the article. The functions in the text of the article above have the bugs fixed. So, use those instead.