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
cbe01a34
Commit
cbe01a34
authored
9 years ago
by
Jaime Perez Crespo
Browse files
Options
Downloads
Patches
Plain Diff
Add support for interfaces in our temporary autoloaders, not only for classes.
parent
b5648358
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/SimpleSAML/Module.php
+5
-4
5 additions, 4 deletions
lib/SimpleSAML/Module.php
lib/_autoload_modules.php
+4
-5
4 additions, 5 deletions
lib/_autoload_modules.php
with
9 additions
and
9 deletions
lib/SimpleSAML/Module.php
+
5
−
4
View file @
cbe01a34
...
@@ -42,14 +42,15 @@ class Module
...
@@ -42,14 +42,15 @@ class Module
}
}
require_once
(
$file
);
require_once
(
$file
);
if
(
!
class_exists
(
$className
,
false
))
{
if
(
!
class_exists
(
$className
,
false
)
&&
!
interface_exists
(
$className
,
false
))
{
// the file exists, but the class is not defined. Is it using namespaces?
// the file exists, but the class is not defined. Is it using namespaces?
$nspath
=
join
(
'\\'
,
$path
);
$nspath
=
join
(
'\\'
,
$path
);
if
(
class_exists
(
'SimpleSAML\Module\\'
.
$module
.
'\\'
.
$nspath
))
{
if
(
class_exists
(
'SimpleSAML\Module\\'
.
$module
.
'\\'
.
$nspath
)
||
interface_exists
(
'SimpleSAML\Module\\'
.
$module
.
'\\'
.
$nspath
))
{
// the class has been migrated, create an alias and warn about it
// the class has been migrated, create an alias and warn about it
\SimpleSAML\Logger
::
warning
(
\SimpleSAML\Logger
::
warning
(
"The class '
$className
' is now using namespaces, please use 'SimpleSAML
\\
Module
\\
$module
\\
"
.
"The class
or interface
'
$className
' is now using namespaces, please use 'SimpleSAML
\\
Module
\\
"
.
"
$nspath
' instead."
$module
.
"
\\
"
.
$nspath
.
"
' instead."
);
);
class_alias
(
"SimpleSAML
\\
Module
\\
$module
\\
$nspath
"
,
$className
);
class_alias
(
"SimpleSAML
\\
Module
\\
$module
\\
$nspath
"
,
$className
);
}
}
...
...
This diff is collapsed.
Click to expand it.
lib/_autoload_modules.php
+
4
−
5
View file @
cbe01a34
...
@@ -31,18 +31,17 @@ function temporaryLoader($class)
...
@@ -31,18 +31,17 @@ function temporaryLoader($class)
}
}
// it exists, so it's not yet migrated to namespaces
// it exists, so it's not yet migrated to namespaces
if
(
class_exists
(
$class
,
false
))
{
if
(
class_exists
(
$class
,
false
)
||
interface_exists
(
$class
,
false
))
{
return
;
return
;
}
}
// it didn't exist, try to see if it was migrated to namespaces
// it didn't exist, try to see if it was migrated to namespaces
$new
=
join
(
'\\'
,
$path
);
$new
=
join
(
'\\'
,
$path
);
if
(
class_exists
(
$new
,
false
))
{
// do not try to autoload it if it doesn't exist! It should!
if
(
class_exists
(
$new
,
false
)
||
interface_exists
(
$class
,
false
))
{
// do not try to autoload it if it doesn't exist! It should!
class_alias
(
$new
,
$class
);
class_alias
(
$new
,
$class
);
SimpleSAML\Logger
::
warning
(
"The class '
$class
' is now using namespaces, please use '
$new
'."
);
SimpleSAML\Logger
::
warning
(
"The class
or interface
'
$class
' is now using namespaces, please use '
$new
'."
);
}
}
}
}
spl_autoload_register
(
"temporaryLoader"
);
spl_autoload_register
(
"temporaryLoader"
);
...
...
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