Skip to content

Commit 81c5454

Browse files
committed
return false early on non-namespaced load class
1 parent a9d0ad8 commit 81c5454

File tree

2 files changed

+2
-21
lines changed

2 files changed

+2
-21
lines changed

system/Autoloader/Autoloader.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -258,15 +258,6 @@ protected function loadInNamespace(string $class)
258258
{
259259
if (strpos($class, '\\') === false)
260260
{
261-
$class = 'Config\\' . $class;
262-
$filePath = APPPATH . str_replace('\\', DIRECTORY_SEPARATOR, $class) . '.php';
263-
$filename = $this->sanitizeFilename($filePath);
264-
265-
if (is_file($filename))
266-
{
267-
return $filename;
268-
}
269-
270261
return false;
271262
}
272263

tests/system/Autoloader/AutoloaderTest.php

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -172,19 +172,9 @@ public function testRemoveNamespace()
172172
$this->assertFalse((bool) $this->loader->loadClass('My\App\AutoloaderTest'));
173173
}
174174

175-
public function testloadClassConfigFound()
175+
public function testloadClassNonNamespaced()
176176
{
177-
$this->loader->addNamespace('Config', APPPATH . 'Config');
178-
$this->assertSame(
179-
APPPATH . 'Config' . DIRECTORY_SEPARATOR . 'Modules.php',
180-
$this->loader->loadClass('Modules')
181-
);
182-
}
183-
184-
public function testloadClassConfigNotFound()
185-
{
186-
$this->loader->addNamespace('Config', APPPATH . 'Config');
187-
$this->assertFalse($this->loader->loadClass('NotFound'));
177+
$this->assertFalse($this->loader->loadClass('Modules'));
188178
}
189179

190180
//--------------------------------------------------------------------

0 commit comments

Comments
 (0)