mirror of
https://github.com/phpbb/phpbb.git
synced 2025-01-18 22:58:10 +01:00
[feature/auto-loading] Only check subdir if there is another name part.
PHPBB3-9682
This commit is contained in:
parent
dea1d660fb
commit
f870434222
@ -115,7 +115,7 @@ class phpbb_class_loader
|
||||
|
||||
$dirs = '';
|
||||
|
||||
for ($i = 0; is_dir($path_prefix . $dirs . $parts[$i]) && $i < sizeof($parts); $i++)
|
||||
for ($i = 0, $n = sizeof($parts); $i < $n && is_dir($path_prefix . $dirs . $parts[$i]); $i++)
|
||||
{
|
||||
$dirs .= $parts[$i] . '/';
|
||||
}
|
||||
|
@ -23,6 +23,12 @@ class phpbb_class_loader_test extends PHPUnit_Framework_TestCase
|
||||
|
||||
$prefix .= 'includes/';
|
||||
|
||||
$this->assertEquals(
|
||||
'',
|
||||
$class_loader->resolve_path('phpbb_dir'),
|
||||
'Class with same name as a directory is unloadable'
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
$prefix . 'class_name.php',
|
||||
$class_loader->resolve_path('phpbb_class_name'),
|
||||
|
6
tests/class_loader/includes/dir.php
Normal file
6
tests/class_loader/includes/dir.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
class phpbb_dir
|
||||
{
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user