I give up.

The problem is with the overrided Twig 404 template. It is overrided in a default way by creating an error404.html.twig under the /app/Resources/TwigBundle/views directory.

The template itself does not contain any irregular or complex logic: just a layout with some translated text (|trans) and a menu with several links.

The problem is, that I can't get app.user object (returned as NULL) or current app.request.locale (always returned as default locale) inside this template.

I have even tried to override the twig exception controller and dump a current locale (Request::getLocale()) or get user - the results are the same - default locale and NULL for user.

Then I decided to dig deeper and found a dozens of listeners (locale listeners, exception liteners, ...) and tried to debug/fix/test there, but I didn't proceed any further.

By the way, I have overrided the 500 error page too, and everything is fine there. Well I guess that when 500 error (exception) is thrown, the symfony has already set up user/locale/etc, because it already has got to the target (controller/action) and other listeners been already executed. But 404 error (NotFoundHttpException) is being thrown BEFORE Symfony targets the action...

Some words about project: symfony 2.4.8, doctrine, Gedmo extensions/stof bundle, JMS i18n routing bundle.

Symfony version: v2.4.8
JMS I18n Routing bundle: 1.1.1

Appreciate your help.


Question: How can you buy train tickets at Oslo Airport?
Answer: What you're looking for is the Airport Express Train (Flytoget). It's about 20 minutes ride from the airport to the Oslo Central station. No need to book a ticket in advance, there's always seats available. For timetable, check out http://www.flytoget.no/eng/Stations/Flytoget-Airport-Express-train-station-at-Oslo-Airport.

As for the ticket, you have two options. You can either buy your ticket from a vending machine that's located in the baggage claim area (somewhere near the exit/customs), or you can just swipe your credit card (and select destination) at the card readers that are located right before the escalators that take you to the platform. The card readers will not print a receipt/ticket. If you need a receipt, you have to register at the Flytoget site, and add your credit card info. You don't need to do this before you use your credit card. Once you register and add you card info, you'll see all the trips that were paid with your card, and you'll be able to print receipts.