Skip to content

Symfony 2.8 Support #31

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
wants to merge 2 commits into from
Closed

Symfony 2.8 Support #31

wants to merge 2 commits into from

Conversation

emgiezet
Copy link

I made some fixes and enhancements to provide symfony2.8 support.

@kamil-bednarek
Copy link

+1

if(true === class_exists('\AppKernel')) {
$app = new \AppKernel($this->appenv, $this->debug);
} else {
require_once './app/bootstrap.php.cache';
Copy link
Member

Choose a reason for hiding this comment

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

You should check first if this file exists

Copy link
Author

Choose a reason for hiding this comment

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

done

symfony 2.8 loader

symfony 2.8 app kernel loader fix

bridge fix

symfony2.8 for the win
if(class_exists('\AppKernel')) {
$app = new \AppKernel($this->appenv, $this->debug);
} else {
if(file_exists('./app/bootstrap.php.cache') && file_exists('./app/AppKernel.php')) {
Copy link
Member

Choose a reason for hiding this comment

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

./app/bootstrap.php.cache may not exists beside app/AppKernel, so you should really check both individually.

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if this is even the correct way to check if \AppKernel exists, because when class_exists returns false, it means the autoloader isn't configured correctly, which also means all namespaces and classes inside app/AppKernel.php can't be resolved, so requiring this file will fail. So I think './app/AppKernel.php' should be excluded here completely.

Copy link
Member

Choose a reason for hiding this comment

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

The whole thing at line 55 should be replaced with

if(file_exists('./app/bootstrap.php.cache')) {
    require_once './app/bootstrap.php.cache';
}
$app = new \AppKernel($this->appenv, $this->debug);

because if \AppKernel isn't there at this point requiring app/AppKernel.php would change that much as it will fail without an= correctly configured autoloader anyway

Copy link
Author

Choose a reason for hiding this comment

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

but with symfony 2.8 it cannot start with this. I need to require_once './app/AppKernel.php';

Copy link
Author

Choose a reason for hiding this comment

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

Without it throws an error:

Uncaught Symfony\Component\Debug\Exception\FatalThrowableError: Fatal error: Class 'AppKernel' not found in /foo/bar/vendor/php-pm/httpkernel-adapter/Bootstraps/Symfony.php:58

Copy link
Member

Choose a reason for hiding this comment

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

Mh, interesting. In my Symfony 2.8 everything works correctly. I used http://symfony.com/doc/current/book/installation.html. How have you installed Symfony 2.8?

Copy link
Member

Choose a reason for hiding this comment

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

Ah, maybe you just upgraded from a older version or used a version pre November 2015, where AppKernel is not in the composer.json (like in the README.md of this repo noted). So, then let us require that file if it exists. But please check both files individually, app/AppKernel and app/bootstrap.php.cache. WDYT?

Copy link
Author

Choose a reason for hiding this comment

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

I got the pre 2.5 style of installation. Ex. cache is in app/cache instead of var/cache

Copy link
Member

Choose a reason for hiding this comment

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

Any news?

@jrmyio
Copy link

jrmyio commented Jun 10, 2016

I have the same problem with 2.8, I had to apply the changes of this PR in order to get around the "
Class 'AppKernel' not found" error.

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 this pull request may close these issues.

4 participants