check if scope class exists

This commit is contained in:
Roland Gruber 2018-08-10 20:02:41 +02:00
parent 96b29d8919
commit 0d70919200
1 changed files with 9 additions and 3 deletions

View File

@ -1,10 +1,9 @@
<?php <?php
namespace LAM\TYPES; namespace LAM\TYPES;
/* /*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2005 - 2017 Roland Gruber Copyright (C) 2005 - 2018 Roland Gruber
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -423,7 +422,11 @@ class TypeManager {
$configuredTypes = array(); $configuredTypes = array();
$activeTypes = $this->config->get_ActiveTypes(); $activeTypes = $this->config->get_ActiveTypes();
foreach ($activeTypes as $typeId) { foreach ($activeTypes as $typeId) {
$configuredTypes[] = $this->buildConfiguredType($typeId); $type = $this->buildConfiguredType($typeId);
if ($type === null) {
continue;
}
$configuredTypes[] = $type;
} }
return $configuredTypes; return $configuredTypes;
} }
@ -469,6 +472,9 @@ class TypeManager {
*/ */
private function buildConfiguredType($typeId) { private function buildConfiguredType($typeId) {
$scope = getScopeFromTypeId($typeId); $scope = getScopeFromTypeId($typeId);
if (!class_exists($scope)) {
return null;
}
return new ConfiguredType($this, $scope, $typeId); return new ConfiguredType($this, $scope, $typeId);
} }