Original Submission When a user group is removed LDAP directory bindings are not removed as well. After you have removed a user group and try to synchronize user groups with LDAP, you get the following stack trace from the codendi daily job due to database inconsistencies:
PHP Catchable fatal error: Argument 2 passed to Git_Driver_Gerrit_MembershipManager::addUserToGroup() must be an instance of ProjectUGroup, null given, called in /usr/share/tuleap/plugins/git/include/gitPlugin.class.php on line 1047 and defined in /usr/share/tuleap/plugins/git/include/Git/Driver/Gerrit/MembershipManager.class.php on line 69
PHP Stack trace:
PHP 1. {main}() /usr/share/tuleap/src/utils/codendi_daily.php:0
PHP 2. EventManager->processEvent() /usr/share/tuleap/src/utils/codendi_daily.php:35
PHP 3. EventManager->processEventOnListener() /usr/share/tuleap/src/common/event/EventManager.class.php:77
PHP 4. PluginProxy->processEvent() /usr/share/tuleap/src/common/event/EventManager.class.php:91
PHP 5. LdapPlugin->codendi_daily_start() /usr/share/tuleap/src/common/plugin/PluginProxy.php:57
PHP 6. LDAP_UserGroupManager->synchronizeUgroups() /usr/share/tuleap/plugins/ldap/include/ldapPlugin.class.php:872
PHP 7. LDAP_GroupManager->bindWithLdap() /usr/share/tuleap/plugins/ldap/include/LDAP_UserGroupManager.class.php:152
PHP 8. LDAP_GroupManager->syncMembersWithLdap() /usr/share/tuleap/plugins/ldap/include/LDAP_GroupManager.class.php:144
PHP 9. LDAP_UserGroupManager->addUserToGroup() /usr/share/tuleap/plugins/ldap/include/LDAP_GroupManager.class.php:165
PHP 10. LDAP_UserGroupDao->addUserToGroup() /usr/share/tuleap/plugins/ldap/include/LDAP_UserGroupManager.class.php:59
PHP 11. ugroup_add_user_to_ugroup() /usr/share/tuleap/plugins/ldap/include/LDAP_UserGroupDao.class.php:107
PHP 12. EventManager->processEvent() /usr/share/tuleap/src/www/project/admin/ugroup_utils.php:610
PHP 13. EventManager->processEventOnListener() /usr/share/tuleap/src/common/event/EventManager.class.php:77
PHP 14. PluginProxy->processEvent() /usr/share/tuleap/src/common/event/EventManager.class.php:91
PHP 15. GitPlugin->project_admin_ugroup_add_user() /usr/share/tuleap/src/common/plugin/PluginProxy.php:57
PHP 16. Git_Driver_Gerrit_MembershipManager->addUserToGroup() /usr/share/tuleap/plugins/git/include/gitPlugin.class.php:1047
Catchable fatal error: Argument 2 passed to Git_Driver_Gerrit_MembershipManager::addUserToGroup() must be an instance of ProjectUGroup, null given, called in /usr/share/tuleap/plugins/git/include/gitPlugin.class.php on line 1047 and defined in /usr/share/tuleap/plugins/git/include/Git/Driver/Gerrit/MembershipManager.class.php on line 69
Call Stack:
0.0001 640360 1. {main}() /usr/share/tuleap/src/utils/codendi_daily.php:0
0.0720 15798936 2. EventManager->processEvent() /usr/share/tuleap/src/utils/codendi_daily.php:35
0.1611 33046640 3. EventManager->processEventOnListener() /usr/share/tuleap/src/common/event/EventManager.class.php:77
0.1611 33046640 4. PluginProxy->processEvent() /usr/share/tuleap/src/common/event/EventManager.class.php:91
0.1611 33049104 5. LdapPlugin->codendi_daily_start() /usr/share/tuleap/src/common/plugin/PluginProxy.php:57
0.1736 35578352 6. LDAP_UserGroupManager->synchronizeUgroups() /usr/share/tuleap/plugins/ldap/include/ldapPlugin.class.php:872
0.2306 35596864 7. LDAP_GroupManager->bindWithLdap() /usr/share/tuleap/plugins/ldap/include/LDAP_UserGroupManager.class.php:152
0.2477 35596864 8. LDAP_GroupManager->syncMembersWithLdap() /usr/share/tuleap/plugins/ldap/include/LDAP_GroupManager.class.php:144
0.2491 35597928 9. LDAP_UserGroupManager->addUserToGroup() /usr/share/tuleap/plugins/ldap/include/LDAP_GroupManager.class.php:165
0.2491 35598672 10. LDAP_UserGroupDao->addUserToGroup() /usr/share/tuleap/plugins/ldap/include/LDAP_UserGroupManager.class.php:59
0.2493 35598768 11. ugroup_add_user_to_ugroup() /usr/share/tuleap/plugins/ldap/include/LDAP_UserGroupDao.class.php:107
0.2664 35600384 12. EventManager->processEvent() /usr/share/tuleap/src/www/project/admin/ugroup_utils.php:610
0.2765 35675768 13. EventManager->processEventOnListener() /usr/share/tuleap/src/common/event/EventManager.class.php:77
0.2765 35675768 14. PluginProxy->processEvent() /usr/share/tuleap/src/common/event/EventManager.class.php:91
0.2770 35740480 15. GitPlugin->project_admin_ugroup_add_user() /usr/share/tuleap/src/common/plugin/PluginProxy.php:57
0.2823 37272424 16. Git_Driver_Gerrit_MembershipManager->addUserToGroup() /usr/share/tuleap/plugins/git/include/gitPlugin.class.php:1047
Steps to reproduce:
1. Create a user group
2. Link this user group to a LDAP directory
3. Remove the user group
4. You can check in the database that in the table plugin_ldap_ugroup the user group is still present.