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

autoloader issue #10

Open
41319 opened this issue Apr 1, 2016 · 1 comment
Open

autoloader issue #10

41319 opened this issue Apr 1, 2016 · 1 comment

Comments

@41319
Copy link

41319 commented Apr 1, 2016

hi,

the autoloader break due to open_basedir() option enabled in some environment

@41319
Copy link
Author

41319 commented Apr 1, 2016

Ignore the first thread.. I am thinking of rewriting for this to support open_basedir

if (strpos($classname, 'Cpanel_') === 0) {
            $filename = str_replace('_', '/', $classname) . '.php';
            if (file_exists($filename)) {
                include_once realpath($filename);
            }
            $paths = explode(PATH_SEPARATOR, get_include_path());
            $allowPaths = explode(PATH_SEPARATOR, ini_get('open_basedir'));
            foreach ($paths as $path) {
                foreach($allowPaths as $allowed)
                {

                    if(substr($path,0,strlen($allowed)) != $allowed)
                    {
                        continue;
                    }
                    else
                    {
                        $file = $path . DIRECTORY_SEPARATOR . $filename;
                        if (file_exists($file)) {
                            include_once realpath($file);
                            break;
                        }
                    }
                }

            }
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant