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

fix test setup with symfony backend #201

Merged
merged 1 commit into from
Jun 1, 2015
Merged

fix test setup with symfony backend #201

merged 1 commit into from
Jun 1, 2015

Conversation

dbu
Copy link
Contributor

@dbu dbu commented May 31, 2015

follow up of #193

@dbu dbu mentioned this pull request May 31, 2015
@ddeboer
Copy link
Member

ddeboer commented May 31, 2015

Nice, you’re going to solve this one? 👍

env: VARNISH_VERSION=3.0
- php: 5.3
env: SYMFONY_VERSION=2.3.* VARNISH_VERSION=4.0 COMPOSER_FLAGS="--prefer-lowest"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changes in this file need to be reverted, just to have faster cycles with travis.

@dbu
Copy link
Contributor Author

dbu commented May 31, 2015

not sure. i just wanted to get started on it. if the next run does not provide helpful information i will leave it be for now.

i now have a hhvm setup with apache 2.2 and it ends up in

Fatal error: Uncaught exception 'BadMethodCallException' with message 'Call to a member function dispatch() on a non-object (NULL)' in /vagrant_data/FOSHttpCache/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php:86
Stack trace:
#0 /vagrant_data/FOSHttpCache/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/HttpCache.php(245): Symfony\\Component\\HttpKernel\\HttpKernel->terminate()
#1 /vagrant_data/FOSHttpCache/tests/Functional/Fixtures/web/symfony.php(24): Symfony\\Component\\HttpKernel\\HttpCache\\HttpCache->terminate()
#2 {main}

@@ -21,4 +21,4 @@
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
//$kernel->terminate($request, $response);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

hm, so indeed at the time we try to terminate the kernel, the dispatcher inside the kernel is set to null. i have no idea why or even how this can happen.

it would sound like a general symfony + hhvm problem, but google does not bring up the problem.

Fatal error: Uncaught exception 'BadMethodCallException' with message 'Call to a member function dispatch() on a non-object (NULL)' in /vagrant_data/FOSHttpCache/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php:86
Stack trace:
#0 /vagrant_data/FOSHttpCache/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/HttpCache.php(245): Symfony\\Component\\HttpKernel\\HttpKernel->terminate()
#1 /vagrant_data/FOSHttpCache/tests/Functional/Fixtures/web/symfony.php(24): Symfony\\Component\\HttpKernel\\HttpCache\\HttpCache->terminate()
#2 {main}

Copy link
Member

Choose a reason for hiding this comment

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

Very weird. But this is the last problem, right? Otherwise it's green.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i think this is the only problem. i commented this line as i did not manage to get hhvm to log anything on travis. locally, it logged what i pasted in my comment. and i really can't explain why that could ever happen. i checked the codebase, nothing is assigning to $this->dispatcher, also not the extending classes...

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 curious if changing the code as suggested in symfony/symfony-standard#658 does the trick.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it makes the tests green, but only because the response is sent before hhvm crashes... maybe we do not need to bother for FOSHttpCache, if we do not rely on any kernel terminate events.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh hell, i dug some more. the dispatcher is always null. in symfony, you create a Kernel which gets HttpKernel from the container. the event dispatcher is created and injected by the container... i need to fix the setup of the kernel then.

/**
* A simplistic kernel that is actually the whole application.
*/
class AppKernel implements HttpKernelInterface
Copy link
Contributor Author

Choose a reason for hiding this comment

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

so actually extending the HttpKernel was only creating problems. the simplistic kernel just needs a handle method!

@dbu
Copy link
Contributor Author

dbu commented Jun 1, 2015

this hopefully will get green now.

i think the problem exists on all php versions, but php still sends the response while hhvm immediately aborts on such a fatal error and does not flush the response body, which made us see the mistake. having terminate made no sense, and was not supposed to work (i had an empty constructor to not call the parent constructor which would expect the event dispatcher... so it was all my fault and i got confused)

@dbu dbu changed the title [WIP] fix tests for hhvm with symfony backend fix test setup with symfony backend Jun 1, 2015
ddeboer added a commit that referenced this pull request Jun 1, 2015
@ddeboer ddeboer merged commit 8332e2e into master Jun 1, 2015
@ddeboer ddeboer deleted the hhvm-symfony-travis branch June 1, 2015 19:29
@ddeboer
Copy link
Member

ddeboer commented Jun 1, 2015

Nice one! Glad this is solved. 😄

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.

3 participants