Skip to content

Commit 3b7b6ff

Browse files
Merge pull request #78 from nextcloud/fix/routing/multiple-register-routes
2 parents c69ac97 + f4a3e78 commit 3b7b6ff

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Route.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ public static function parseRoutes(string $path): array {
2929
}
3030
return include($path);
3131
} elseif (str_contains($content, "registerRoutes")) {
32-
preg_match("/registerRoutes\(.*?\\\$this,.*?(\[[^;]*)\);/s", $content, $matches);
33-
return self::includeRoutes("<?php\nreturn " . $matches[1] . ";");
32+
preg_match_all("/registerRoutes\(.*?\\\$this,.*?(\[[^;]*)\);/s", $content, $matches);
33+
return array_merge(...array_map(fn (string $match) => self::includeRoutes("<?php\nreturn " . $match . ";"), $matches[1]));
3434
} else {
3535
Logger::panic("Routes", "Unknown routes.php format");
3636
}

0 commit comments

Comments
 (0)