Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite autoloader #2734

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/Varien/Autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ static public function register()
*/
public function autoload($class)
{
return @include str_replace(' ', DIRECTORY_SEPARATOR, ucwords(str_replace('_', ' ', $class))) . '.php';
$path = str_replace(['_', '\\', ' '], DIRECTORY_SEPARATOR, $class) . '.php';
/** @see https://stackoverflow.com/a/5504486/716029 */
$found = stream_resolve_include_path($path);
if ($found !== false) {
return include $found;
}
}
}
9 changes: 1 addition & 8 deletions lib/phpseclib/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php
/**
* Bootstrapping File for phpseclib
*
* @license http://www.opensource.org/licenses/mit-license.html MIT License
*/

if (extension_loaded('mbstring')) {
// 2 - MB_OVERLOAD_STRING
if (ini_get('mbstring.func_overload') & 2) {
Expand All @@ -13,10 +13,3 @@
);
}
}

spl_autoload_register(function($className) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this file should get removed by #2411

$parts = explode('\\', $className);
if (array_shift($parts) == 'phpseclib') {
return include str_replace('\\', DIRECTORY_SEPARATOR, $className) . '.php';
}
});