getObject() without criteria crashes collection methods work #105

Open
spectrum48k opened this Issue Dec 26, 2016 · 0 comments

Projects

None yet

1 participant

@spectrum48k

Summary

getObject() without criteria causes nesting level error for collection methods.

Step to reproduce

  1. clear cache for 'someClass' db objects
  2. $modx->getObject('someClass') and $modx->getCollection('someClass') after that.

Observed behavior

execution of php script stops with "nesting_level_error"..
trace_screen

debugging results:
in case of no cache files created for db objects of 'someClassKey':
->getObject('someClassKey'); and ->getCollection('someClassKey') (or ->getMany('someAliasOfClassKey')) after that
shoots to cache file with same md5 prefix, but collection methods need different nesting of arrays inside cache files. This causes wrong recursion and nesting level error when collection loads from cache. So, ->getObject() without unique criteria is bad practice for current xPDO caching principle of version that I use (MODX Revolution 2.3.3-pl (traditional)).

Expected behavior

expected single instance of 'someClass' object and collection array of 'someClass' objects in results.

Environment

MODX version MODX Revolution 2.3.3-pl (traditional)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment