Skip to content

Commit facc75b

Browse files
authored
Apply fix in #2300 to all autoloaders (#2867)
1 parent ebabcf8 commit facc75b

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

lib/Mage/Autoload/Simple.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,14 @@ public static function register()
3737
spl_autoload_register([self::instance(), 'autoload']);
3838
}
3939

40-
/**
41-
* @SuppressWarnings(PHPMD.ErrorControlOperator)
42-
*/
4340
public function autoload($class)
4441
{
4542
$classFile = str_replace(' ', DIRECTORY_SEPARATOR, ucwords(str_replace('_', ' ', $class)));
4643
$classFile .= '.php';
47-
@include $classFile;
44+
/** @see https://stackoverflow.com/a/5504486/716029 */
45+
$found = stream_resolve_include_path($classFile);
46+
if ($found !== false) {
47+
include $found;
48+
}
4849
}
4950
}

lib/Magento/Autoload/Simple.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,14 @@ public static function register()
3939
spl_autoload_register([self::instance(), 'autoload']);
4040
}
4141

42-
/**
43-
* @SuppressWarnings(PHPMD.ErrorControlOperator)
44-
*/
4542
public function autoload($class)
4643
{
4744
$classFile = str_replace(' ', DIRECTORY_SEPARATOR, ucwords(str_replace('_', ' ', $class)));
4845
$classFile .= '.php';
49-
@include $classFile;
46+
/** @see https://stackoverflow.com/a/5504486/716029 */
47+
$found = stream_resolve_include_path($classFile);
48+
if ($found !== false) {
49+
include $found;
50+
}
5051
}
5152
}

lib/Varien/Autoload.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ public static function register()
5454
* Load class source code
5555
*
5656
* @param string $class
57-
*
58-
* @SuppressWarnings(PHPMD.ErrorControlOperator)
5957
*/
6058
public function autoload($class)
6159
{

0 commit comments

Comments
 (0)