Skip to content
Snippets Groups Projects
Commit 163e8e95 authored by Bruce Weirdan's avatar Bruce Weirdan Committed by Tim van Dijen
Browse files

Autoloader infinite recursion fix (#1031)

* Autoloader infinite recursion fix

Fixes simplesamlphp/simplesamlphp#1030

* Added test to ensure old autoloader behaviour is preserved

Also fixed undefined variable notice
parent cb2ea902
No related branches found
No related tags found
No related merge requests found
......@@ -22,9 +22,9 @@ function temporaryLoader($class)
// handle the upgrade to the latest version of XMLSecLibs using namespaces
if (strstr($class, 'XMLSec') && !strstr($class, '\\RobRichards\\XMLSecLibs\\')) {
$new = '\\RobRichards\\XMLSecLibs\\'.$class;
if (class_exists($new, false)) {
if (class_exists($new, true)) {
class_alias($new, $class);
SimpleSAML\Logger::warning("The class or interface '$original' is now using namespaces, please use '$new'.");
SimpleSAML\Logger::warning("The class or interface '$class' is now using namespaces, please use '$new'.");
return;
}
}
......
<?php
namespace SimpleSAML\Test;
use PHPUnit\Framework\TestCase;
class AutoloadModulesTest extends TestCase
{
/**
* @test
* @runInSeparateProcess
*/
public function autoloaderDoesNotRecurseInfinitely()
{
$this->assertFalse(class_exists('NonExisting\\ClassThatHasNothing\\ToDoWithXMLSec\\Library', true));
}
/**
* @test
* @runInSeparateProcess
*/
public function autoloaderSubstitutesNamespacedXmlSecClassesWhereNonNamespacedClassWasUsed()
{
$this->assertTrue(class_exists('XMLSecEnc', true));
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment