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

Blank page #3

Open
roukmoute opened this issue Dec 19, 2013 · 9 comments
Open

Blank page #3

roukmoute opened this issue Dec 19, 2013 · 9 comments

Comments

@roukmoute
Copy link

Hi,

I've juste buy the lesson 2.

I check my php.ini and if I go to the page app_dev.php, i've got "No route found for "GET /" ".
It does not work just on the pages that are supposed to work.

I don't know why but I've a blank page with this messages :
[2013-12-19 13:43:07] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ProfilerListener::onKernelRequest". [] []
[2013-12-19 13:43:07] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Bundle\FrameworkBundle\EventListener\SessionListener::onKernelRequest". [] []
[2013-12-19 13:43:07] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\FragmentListener::onKernelRequest". [] []
[2013-12-19 13:43:07] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\RouterListener::onKernelRequest". [] []
[2013-12-19 13:43:07] request.INFO: Matched route "event" (parameters: "_controller": "Yoda\EventBundle\Controller\EventController::indexAction", "_route": "event") [] []
[2013-12-19 13:43:07] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\LocaleListener::onKernelRequest". [] []
[2013-12-19 13:43:07] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Component\Security\Http\Firewall::onKernelRequest". [] []
[2013-12-19 13:43:07] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Bundle\AsseticBundle\EventListener\RequestListener::onKernelRequest". [] []
[2013-12-19 13:43:07] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\Fragment\FragmentHandler::onKernelRequest". [] []
[2013-12-19 13:43:07] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\DeprecationLoggerListener::injectLogger". [] []
[2013-12-19 13:43:07] event.DEBUG: Notified event "kernel.controller" to listener "Symfony\Bundle\FrameworkBundle\DataCollector\RouterDataCollector::onKernelController". [] []
[2013-12-19 13:43:07] event.DEBUG: Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ControllerListener::onKernelController". [] []
[2013-12-19 13:43:07] event.DEBUG: Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ParamConverterListener::onKernelController". [] []
[2013-12-19 13:43:07] event.DEBUG: Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\TemplateListener::onKernelController". [] []
[2013-12-19 13:43:07] event.DEBUG: Notified event "kernel.controller" to listener "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector::onKernelController". [] []
[2013-12-19 13:43:07] doctrine.DEBUG: SELECT t0.id AS id1, t0.name AS name2, t0.imageName AS imageName3, t0.date AS date4, t0.location AS location5, t0.details AS details6 FROM yoda_event t0 [] []
[2013-12-19 13:43:07] event.DEBUG: Notified event "kernel.response" to listener "Symfony\Bridge\Monolog\Handler\FirePHPHandler::onKernelResponse". [] []
[2013-12-19 13:43:07] event.DEBUG: Notified event "kernel.response" to listener "Symfony\Bridge\Monolog\Handler\ChromePhpHandler::onKernelResponse". [] []
[2013-12-19 13:43:07] event.DEBUG: Notified event "kernel.response" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\CacheListener::onKernelResponse". [] []
[2013-12-19 13:43:07] event.DEBUG: Notified event "kernel.response" to listener "Symfony\Component\HttpKernel\EventListener\ResponseListener::onKernelResponse". [] []
[2013-12-19 13:43:07] event.DEBUG: Notified event "kernel.response" to listener "Symfony\Component\HttpKernel\EventListener\LocaleListener::onKernelResponse". [] []
[2013-12-19 13:43:07] event.DEBUG: Notified event "kernel.response" to listener "Symfony\Component\HttpKernel\Fragment\FragmentHandler::onKernelResponse". [] []
[2013-12-19 13:43:07] event.DEBUG: Notified event "kernel.response" to listener "Symfony\Component\Security\Http\RememberMe\ResponseListener::onKernelResponse". [] []
[2013-12-19 13:43:07] event.DEBUG: Notified event "kernel.response" to listener "Symfony\Component\HttpKernel\EventListener\ProfilerListener::onKernelResponse". [] []
[2013-12-19 13:43:07] event.DEBUG: Notified event "kernel.response" to listener "Symfony\Bundle\WebProfilerBundle\EventListener\WebDebugToolbarListener::onKernelResponse". [] []
[2013-12-19 13:43:07] event.DEBUG: Notified event "kernel.response" to listener "Symfony\Component\HttpKernel\EventListener\StreamedResponseListener::onKernelResponse". [] []
[2013-12-19 13:43:07] event.DEBUG: Notified event "kernel.terminate" to listener "Symfony\Bundle\SwiftmailerBundle\EventListener\EmailSenderListener::onKernelTerminate". [] []

I've just beginning the first modification (firewalls) in security.yml, this to work, so I went to the second part (access_control) and then I got a blank page.
I returned with the original file and I still do not display, I do not understand.

Can you help me on what exactly happens?

@weaverryan
Copy link
Member

Hey Mathias!

Ok, so we basically just need to figure out why we're getting the blank page - that should never happen :). I need you to check a few things for me:

  1. Make sure you're accessing app_dev.php still - e.g. http://events.local/app_dev.php.

  2. Double-check that the php.ini setting for display_errors is set to true. The best way to figure this out for sure is to create a simple PHP file that has <?php phpinfo(); ?> and execute it. On that page, you'll see the display_errors value. We need to make sure that's set to true.

When you get a white screen, it's typically not because there's an exception in Symfony, but that there's a deeper, more fatal error (it could be within our Symfony code, of course, but probably isn't an exception). Because of this, Symfony's logs are probably not going to help us - we need to look at Apache's error log to see what the actual error is. If display_errors is true, then we should see this error. But even if we don't, we should be able to find it in Apache's error log.

Let me know what you find out :).

@roukmoute
Copy link
Author

Here's a quick video that should hopefully answer all your questions
http://youtu.be/HX8zAb-Wh_A

@weaverryan
Copy link
Member

Yes, the video was very helpful, but there's still nothing that's obvious.

Typically, the white screen means you (a) have a PHP fatal error that's not showing (and your errors appear that they should be showing up), (b) you have a die statement in your code or (c) you're actually returning and empty page in your controller (this seems unlikely, since the events page was working).

What's interesting with the logs that you posted earlier, is that you can see the correct route being matched, the controller being executed, a query being made, and the request finishing. It all looks perfect. Open up your web/app_dev.php file, go to the bottom, and print out some content. Does this show up? I want to know if the execution has failed before the bottom of this file, or if it hasn't. If your content prints out, then it really seems like we're in a situation similar to (c) where our page almost seems to be acting as if nothing is being returned. What is the status code on the page? Is there any hidden HTML content?

Thanks!

@roukmoute
Copy link
Author

Hi !
Sorry for my delay

www.youtube.com/watch?v=ll1ezomRuKg

@weaverryan
Copy link
Member

Hi Mathias!

Yes, so it looks like there is never an error at all. Can you go into your controller (EventBundle:Event:index) and try adding a die statement there? Can you also try just returning a simple value from your controller? Right now, it literally seems as if you controller is just returning no content. So try this:

public function indexAction()
{
    return new Symfony\Component\HttpFoundation\Response('Hello world!');
}

And also verify that the template you're rendering has content in it. That may sound basic, but it really does look like your application is working just fine :).

Cheers!

@roukmoute
Copy link
Author

Everything all right apparently !
www.youtube.com/watch?v=PVrwqTD8hjw

@weaverryan
Copy link
Member

Yes, I agree!

Does your template have content in it? If so, try removing all of the content and replacing it with a simple "Hello world". Also, make sure there is content in your base layout (base.html.twig). Finally, if none of this shows anything, try using the render function instead of the @Template shortcut:

return $this->render('EventBundle:Event:index.html.twig', array('entities' => $entities));

Cheers!

@roukmoute
Copy link
Author

And voilà !
This is, of course, my fault !
I've completely forgotten to delete this lines in EventBundle:Event:index.html.twig :
{{ app.session.get('some_session_key') }}
{{ app.request.host }}
I don't know why, but this lines causes a bug.
Now everything all right :)

Thank you very much for your help and for your time!

@weaverryan
Copy link
Member

Hey @mathias-strasser!

I'm so glad you figured it out! Yes, the code in question was just "play" code from the last episode, but we never say explicitly to remove it (other people have left it there too). What's interesting is that it shouldn't have broken your code - both of those statements should have printed something, but not broken anything. So, I'll leave this issue open so that we can investigate :).

Cheers!

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

No branches or pull requests

2 participants