Skip to content

Commit 818adcc

Browse files
authored
Merge pull request cachethq#2735 from koendc/fix_glob_brace
Do not rely on GLOB_BRACE as it is not available on non-glibc based systems
2 parents b5f6c23 + e69169e commit 818adcc

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

app/Foundation/Providers/RouteServiceProvider.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,10 @@ public function map(Router $router)
8989
$router->group(['namespace' => $this->namespace, 'as' => 'core::'], function (Router $router) {
9090
$path = app_path('Http/Routes');
9191

92-
// GLOB_BRACE is defined as 0, check the source!
93-
// https://github.com/php/php-src/blob/31e4afe3c3654f9c5ab2eafa3a02c62d41c58b47/ext/standard/dir.c#L154-L158
94-
$globBrace = defined('GLOB_BRACE') ? GLOB_BRACE : 0;
95-
$globFlag = $globBrace;
92+
$AllFileIterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path));
93+
$PhpFileIterator = new \RegexIterator($AllFileIterator, '/^.+\.php$/i', \RecursiveRegexIterator::GET_MATCH);
9694

97-
foreach (glob("{$path}/*{,/*}.php", $globFlag) as $file) {
95+
foreach ($PhpFileIterator as $file => $object) {
9896
$class = substr($file, strlen($path));
9997
$class = str_replace('/', '\\', $class);
10098
$class = substr($class, 0, -4);

0 commit comments

Comments
 (0)