Circular reference handling improvement
Circular reference handling improvement

Refs https://github.com/phpseclib/phpseclib/pull/934/files#r52838650

This does the following:

* Addresses the comments to https://github.com/terrafrost/phpseclib/commit/102d53bd275f5c08e7042eaac5fb74f73eded62a

* Fixes an "Allowed memory size of ... bytes exhausted" issue and simplifies the implementation, bringing it closer to the example in https://stackoverflow.com/questions/9042142/detecting-infinite-array-recursion-in-php/9293146#9293146

metaclassing/phpseclib,paragonie-scott/phpseclib,phpseclib/phpseclib,metaclassing/phpseclib,paragonie-scott/phpseclib,danog/phpseclib,terrafrost/phpseclib,danog/phpseclib