xpdo icon indicating copy to clipboard operation
xpdo copied to clipboard

getObject() without criteria crashes collection methods work

Open spectrum48k opened this issue 9 years ago • 1 comments

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)

spectrum48k avatar Dec 26 '16 08:12 spectrum48k

_028

spectrum48k avatar Jun 16 '17 07:06 spectrum48k