<table role="table">
<thead>
<tr>
<th>Q</th>
<th>A</th>
</tr>
</thead>
<tbody>
<tr>
<td>Bug report?</td>
<td>no</td>
</tr>
<tr>
<td>Feature request?</td>
<td>yes</td>
</tr>
<tr>
<td>BC Break report?</td>
<td>no</td>
</tr>
<tr>
<td>RFC?</td>
<td>no</td>
</tr>
</tbody>
</table>

<h2 dir="auto">Steps to reproduce:</h2>
<p dir="auto">Create a project:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="composer create-project symfony/skeleton symfony-skeleton"><pre class="notranslate"><code class="notranslate">composer create-project symfony/skeleton symfony-skeleton
</code></pre></div>
<p dir="auto">Set the app environment to prod:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="sed -i -e 's/APP_ENV=dev/APP_ENV=prod/g' .env"><pre class="notranslate"><code class="notranslate">sed -i -e 's/APP_ENV=dev/APP_ENV=prod/g' .env
</code></pre></div>
<p dir="auto">This can be shown also with setting the APP_ENV environment variable.</p>
<p dir="auto">Add a <a href="https://symfony.com/doc/current/page_creation.html" rel="nofollow">simple controller and a route</a>.</p>
<p dir="auto">Add an <code class="notranslate">.htaccess</code> file in /public as follows (we use Apache):</p>
<div class="highlight highlight-source-apache-config notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&lt;IfModule mod_rewrite.c&gt;
    Options -MultiViews
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php [QSA,L]
&lt;/IfModule&gt;"><pre class="notranslate">&lt;<span class="pl-ent">IfModule</span> mod_rewrite.c&gt;
    <span class="pl-c1">Options</span> -MultiViews
    <span class="pl-c1">RewriteEngine</span> On
    <span class="pl-c1">RewriteCond</span> <span class="pl-c1">%{REQUEST_FILENAME}</span> <span class="pl-s">!-f</span>
    <span class="pl-c1">RewriteRule</span> <span class="pl-sr">^(.*)$</span> <span class="pl-s">index.php</span> <span class="pl-sr">[QSA,L]</span>
&lt;/<span class="pl-ent">IfModule</span>&gt;</pre></div>
<p dir="auto">Try to get "/foo". In the prod environment, ResourceNotFoundException is not caught or converted to a 404:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="2018-01-18T15:53:46-05:00 [critical] Uncaught Exception: No route found for &quot;GET
/foo&quot; [Thu Jan 18 15:53:46.592760 2018] [php7:notice] [pid 66514] [client
::1:58156] PHP Fatal error:  Uncaught
Symfony\\Component\\Routing\\Exception\\ResourceNotFoundException in
var/cache/prod/srcProdProjectContainerUrlMatcher.php:38\nStack trace:\n#0
vendor/symfony/routing/Matcher/UrlMatcher.php(95):
srcProdProjectContainerUrlMatcher-&gt;match('/foo')\n#1
vendor/symfony/routing/Router.php(262): Symfony\\Component\\Routing\\Matcher\\Ur
lMatcher-&gt;matchRequest(Object(Symfony\\Component\\HttpFoundation\\Request))\n#2
vendor/symfony/http-kernel/EventListener/RouterListener.php(109): Symfony\\Compo
nent\\Routing\\Router-&gt;matchRequest(Object(Symfony\\Component\\HttpFoundation\\R
equest))\n#3 vendor/symfony/event-dispatcher/EventDispatcher.php(212): Symfony\\
Component\\HttpKernel\\EventListener\\RouterListener-&gt;onKernelRequest(Object(Sym
fony\\Component\\HttpKernel\\Event\\GetResponseEvent), 'kernel.request',
Object(Symfony\\Component\\EventDispatcher\\EventDispatcher))\n#4 /Users/cjm/Si
in vendor/symfony/http-kernel/EventListener/RouterListener.php on line 139"><pre class="notranslate"><code class="notranslate">2018-01-18T15:53:46-05:00 [critical] Uncaught Exception: No route found for "GET
/foo" [Thu Jan 18 15:53:46.592760 2018] [php7:notice] [pid 66514] [client
::1:58156] PHP Fatal error:  Uncaught
Symfony\\Component\\Routing\\Exception\\ResourceNotFoundException in
var/cache/prod/srcProdProjectContainerUrlMatcher.php:38\nStack trace:\n#0
vendor/symfony/routing/Matcher/UrlMatcher.php(95):
srcProdProjectContainerUrlMatcher-&gt;match('/foo')\n#1
vendor/symfony/routing/Router.php(262): Symfony\\Component\\Routing\\Matcher\\Ur
lMatcher-&gt;matchRequest(Object(Symfony\\Component\\HttpFoundation\\Request))\n#2
vendor/symfony/http-kernel/EventListener/RouterListener.php(109): Symfony\\Compo
nent\\Routing\\Router-&gt;matchRequest(Object(Symfony\\Component\\HttpFoundation\\R
equest))\n#3 vendor/symfony/event-dispatcher/EventDispatcher.php(212): Symfony\\
Component\\HttpKernel\\EventListener\\RouterListener-&gt;onKernelRequest(Object(Sym
fony\\Component\\HttpKernel\\Event\\GetResponseEvent), 'kernel.request',
Object(Symfony\\Component\\EventDispatcher\\EventDispatcher))\n#4 /Users/cjm/Si
in vendor/symfony/http-kernel/EventListener/RouterListener.php on line 139
</code></pre></div>
<p dir="auto">Hi,</p>
<p dir="auto">i've this issue when upgrading from sf2.3.22 to 2.3.23. I've created a processor for monolog with session based on this <a href="http://symfony.com/en/doc/current/cookbook/logging/monolog.html" rel="nofollow">http://symfony.com/en/doc/current/cookbook/logging/monolog.html</a>.</p>
<p dir="auto">But this failed and i've this error:<br>
<strong>_Failed to start the session: already started by PHP ($_SESSION is set).</strong>_</p>
<p dir="auto">I debugged the code and i found that the SaveSessionListener is ending the session on kernel.response event but processor is still called after that to get data from session.</p>