revolution icon indicating copy to clipboard operation
revolution copied to clipboard

Missing sanity check in resource/create controller

Open BobRay opened this issue 2 years ago • 1 comments

Bug report

Summary

Modx 2 Line 254 of manager/controllers/default/resource/create.class.php throws an "empty IN condition error if $usergroups is empty.

array(
                'ProfileUserGroup.usergroup:IN' => $userGroups,
                array(
                    'OR:ProfileUserGroup.usergroup:IS' => null,
                    'AND:UGProfile.active:=' => true,
                ),
            ),

Step to reproduce

No sure how to reproduce this, but a user reported it here.

It's Form Customization code, so possibly a user who doesn't belong to a group or a reference to a group that no longer exists.

Other similar examples only make the query if the variable is not empty.

BobRay avatar Feb 01 '23 22:02 BobRay

This issue has been mentioned on MODX Community. There might be relevant details there:

https://community.modx.com/t/error-log-question/6359/3

rthrash avatar Feb 01 '23 22:02 rthrash