Fix ObjectRegistry duplicate detection when comparing nested arrays

- Resolves non-descript "Array to string conversion" error message on PHP 5.4+
- See https://bugs.php.net/bug.php?id=60198 and https://bugs.php.net/bug.php?id=62115
- Opted for `json_encode` vs. adding extra code or dependency on Hash (`serialize` doesn't handle closures)
- Stricter equality check involves unsetting 'enabled' key from both sides (otherwise tests fail elsewhere)
Merge pull request #5280 from deizel/duplicate-object

Fix ObjectRegistry duplicate detection when comparing nested arrays