- Affected version
- 2.0.10
Code:
$iterator = new \RegexIterator(
new \RecursiveIteratorIterator(
new \RecursiveDirectoryIterator($path)
), '/\.php$/'
);
foreach ($iterator AS $name => $file)
{
$name = str_replace('.php', '', $file->getFilename());
$entities[] = str_replace('/', '\\', $addOnId) . ':' . $name;
}
This is using a RecursiveDirectoryIterator but the namespace for the entity is blindly assumed to not be in a sub-folder.
A fix something like this works;
Code:
foreach ($iterator AS $name => $file)
{
$name = str_replace('.php', '', $file->getFilename());
$subFolder = substr($file->getPath(), strlen($path));
$subFolder = ltrim(str_replace('/', '\\', $subFolder) . '\\', '\\');
$entities[] = str_replace('/', '\\', $addOnId) . ':' . $subFolder . $name;
}