Skip to content

Including autoload assumes working dir = base path #2

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

Closed
andig opened this issue Apr 23, 2015 · 1 comment · Fixed by #3
Closed

Including autoload assumes working dir = base path #2

andig opened this issue Apr 23, 2015 · 1 comment · Fixed by #3

Comments

@andig
Copy link
Contributor

andig commented Apr 23, 2015

HttpKernelBridge does and ugly autoload include relative to the current directory in https://github.com/php-pm/php-pm-httpkernel/blob/master/Bridges/HttpKernel.php#L39:

    require_once './vendor/autoload.php';

This will be wrong if the working directory is different from the base path of the script including the kernel adapter.

I'd rather suggest

require_once dirname(realpath($_SERVER['SCRIPT_NAME'])) . '/vendor/autoload.php';

Sounds good?

Alternatively we good assume that the appBootstrap itself will be able to the path accordingly. Maybe better make the require and optional include?

@marcj
Copy link
Member

marcj commented Apr 23, 2015

If that works correctly within CLI call, then yeah :)

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

Successfully merging a pull request may close this issue.

2 participants