diff --git a/composer.json b/composer.json index 64549e07..a898a8a7 100644 --- a/composer.json +++ b/composer.json @@ -42,12 +42,11 @@ "ext-pcre": "*", "ext-spl": "*", - "simplesamlphp/assert": "~1.8.1", - "simplesamlphp/composer-xmlprovider-installer": "~1.0.2", - "symfony/finder": "~6.4.0" + "simplesamlphp/assert": "~1.8.2", + "simplesamlphp/composer-xmlprovider-installer": "~1.0.2" }, "require-dev": { - "simplesamlphp/simplesamlphp-test-framework": "~1.9.2" + "simplesamlphp/simplesamlphp-test-framework": "~1.9.3" }, "support": { "issues": "https://github.com/simplesamlphp/xml-common/issues", diff --git a/src/XML/Registry/ElementRegistry.php b/src/XML/Registry/ElementRegistry.php index 93d0efb1..27c9a920 100644 --- a/src/XML/Registry/ElementRegistry.php +++ b/src/XML/Registry/ElementRegistry.php @@ -4,15 +4,16 @@ namespace SimpleSAML\XML\Registry; +use DirectoryIterator; use SimpleSAML\XML\AbstractElement; use SimpleSAML\XML\Assert\Assert; use SimpleSAML\XML\Exception\IOException; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; -use Symfony\Component\Finder\Finder; use function array_merge_recursive; use function dirname; use function file_exists; +use function preg_match; final class ElementRegistry { @@ -29,10 +30,12 @@ private function __construct() $classesDir = dirname(__FILE__, 6) . '/vendor/simplesamlphp/composer-xmlprovider-installer/classes'; if (file_exists($classesDir) === true) { - $finder = Finder::create()->files()->name('element.registry.*.php')->in($classesDir); - if ($finder->hasResults()) { - foreach ($finder as $file) { - $this->importFromFile($file->getPathName()); + $directory = new DirectoryIterator($classesDir); + foreach ($directory as $fileInfo) { + if ($fileInfo->isFile()) { + if (preg_match('/^element\.registry\.(.*)\.php$/', $fileInfo->getFilename())) { + $this->importFromFile($fileInfo->getPathname()); + } } } }