Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
simplesamlphp
Manage
Activity
Members
Labels
Plan
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Perun
Perun ProxyIdP
v1
simplesamlphp
Commits
748daa08
Commit
748daa08
authored
9 years ago
by
Jaime Perez Crespo
Browse files
Options
Downloads
Patches
Plain Diff
Add support for the new module namespace in SimpleSAML_Module::resolveClass().
parent
88ea9b8a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/SimpleSAML/Module.php
+22
-8
22 additions, 8 deletions
lib/SimpleSAML/Module.php
with
22 additions
and
8 deletions
lib/SimpleSAML/Module.php
+
22
−
8
View file @
748daa08
...
...
@@ -142,17 +142,31 @@ class SimpleSAML_Module
assert
(
'is_string($subclass) || is_null($subclass)'
);
$tmp
=
explode
(
':'
,
$id
,
2
);
if
(
count
(
$tmp
)
===
1
)
{
if
(
count
(
$tmp
)
===
1
)
{
// no module involved
$className
=
$tmp
[
0
];
}
else
{
$className
=
'sspmod_'
.
$tmp
[
0
]
.
'_'
.
$type
.
'_'
.
$tmp
[
1
];
if
(
!
class_exists
(
$className
))
{
throw
new
Exception
(
"Could not resolve '
$id
': no class named '
$className
'."
);
}
}
else
{
// should be a module
// make sure empty types are handled correctly
$type
=
(
empty
(
$type
))
?
'_'
:
'_'
.
$type
.
'_'
;
// check for the old-style class names
$className
=
'sspmod_'
.
$tmp
[
0
]
.
$type
.
$tmp
[
1
];
if
(
!
class_exists
(
$className
))
{
// check for the new-style class names, using namespaces
$type
=
str_replace
(
'_'
,
'\\'
,
$type
);
$newClassName
=
'SimpleSAML\Module\\'
.
$tmp
[
0
]
.
$type
.
$tmp
[
1
];
if
(
!
class_exists
(
$newClassName
))
{
throw
new
Exception
(
"Could not resolve '
$id
': no class named '
$className
' or '
$newClassName
'."
);
}
$className
=
$newClassName
;
}
}
if
(
!
class_exists
(
$className
))
{
throw
new
Exception
(
'Could not resolve \''
.
$id
.
'\': No class named \''
.
$className
.
'\'.'
);
}
elseif
(
$subclass
!==
null
&&
!
is_subclass_of
(
$className
,
$subclass
))
{
if
(
$subclass
!==
null
&&
!
is_subclass_of
(
$className
,
$subclass
))
{
throw
new
Exception
(
'Could not resolve \''
.
$id
.
'\': The class \''
.
$className
.
'\' isn\'t a subclass of \''
.
$subclass
.
'\'.'
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment