diff options
author | Joachim Bauch <bauch@struktur.de> | 2022-06-09 14:57:30 +0300 |
---|---|---|
committer | Joachim Bauch <bauch@struktur.de> | 2022-06-09 14:57:30 +0300 |
commit | 20efb5d8852d1e790c81d2b730f50f16bff3f82b (patch) | |
tree | 57535b009449ec627ef78ac60549fd3946903cc3 /appinfo | |
parent | 3dc70150bed0fbb09ae7bc64c7283a4f12935c4a (diff) |
Only call "require_once" if classes don't exist yet.
If another app is loaded before and also loads the JWT classes through
"require_once", loading them again here will fail because the name is
already defined.
Signed-off-by: Joachim Bauch <bauch@struktur.de>
Diffstat (limited to 'appinfo')
-rw-r--r-- | appinfo/application.php | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/appinfo/application.php b/appinfo/application.php index c5c1ec8..0de4353 100644 --- a/appinfo/application.php +++ b/appinfo/application.php @@ -87,10 +87,18 @@ class Application extends App implements IBootstrap { } public function register(IRegistrationContext $context): void { - require_once __DIR__ . "/../3rdparty/jwt/BeforeValidException.php"; - require_once __DIR__ . "/../3rdparty/jwt/ExpiredException.php"; - require_once __DIR__ . "/../3rdparty/jwt/SignatureInvalidException.php"; - require_once __DIR__ . "/../3rdparty/jwt/JWT.php"; + if (!class_exists('\\Firebase\\JWT\\BeforeValidException')) { + require_once __DIR__ . "/../3rdparty/jwt/BeforeValidException.php"; + } + if (!class_exists('\\Firebase\\JWT\\ExpiredException')) { + require_once __DIR__ . "/../3rdparty/jwt/ExpiredException.php"; + } + if (!class_exists('\\Firebase\\JWT\\SignatureInvalidException')) { + require_once __DIR__ . "/../3rdparty/jwt/SignatureInvalidException.php"; + } + if (!class_exists('\\Firebase\\JWT\\JWT')) { + require_once __DIR__ . "/../3rdparty/jwt/JWT.php"; + } $context->registerService("L10N", function (ContainerInterface $c) { return $c->get("ServerContainer")->getL10N($c->get("AppName")); @@ -282,4 +290,4 @@ class Application extends App implements IBootstrap { }); } } -}
\ No newline at end of file +} |