Upgrade 7.5.0.1 to 7.6.1.0 fails during "Registering ACL role sets for user 1"

We are upgrading from 7.2.2.0 to 7.6.1.0 using silent upgraders on LAMP. Existing app runs just fine in the same environment. The upgrade to 7.5 went well, and the healthcheck for 7.6.1.0 upgrade passed, but when the upgrader is running through DB updates scripts, it stops at "Registering ACL role sets for user 1" and throws the following error:

PHP Fatal error:  Call to a member function getBeans() on a non-object in /home/ubuntu/sugar/modules/ACLRoles/AclRoleSetRegistrar.php on line 49

 

We are running through the upgrades in series, so nothing has changed in the DB between the 7.5 upgrade and 7.6.

  • The code in question:

    protected function getUserRoleSet(User $user)
     {
         $roleSets = $user->acl_role_sets->getBeans();
         return array_shift($roleSets);
     }
    
  • And here is the bit in the upgrade script:

    public function run()
        {
            if (version_compare($this->from_version, '7.6.0', '>=')) {
                $this->log('ACL role sets should be already registered, skipping');
                return;
            }
    
            require_once 'modules/ACLRoles/AclRoleSetRegistrar.php';
            $registrar = new AclRoleSetRegistrar();
    
            $result = $this->db->query("SELECT id FROM users where deleted = 0");
            while ($row = $this->db->fetchByAssoc($result)) {
                $user = BeanFactory::retrieveBean('Users', $row['id']);
                if ($user) {
                    $this->log('Registering ACL role sets for user ' . $user->id);
                    $registrar->registerAclRoleSet($user);
                }
            }
        }
    
  • Rerunning the upgrade with the flag to continue seems to complete the upgrade. Not sure why it is dong this, but it is resolved for us.