Details
-
Bug
-
Resolution: Fixed
-
High
-
3.0.5, 2.5.11
-
None
-
Controller returning StreamedResponse will result in FatalThrowableError
Description
When Controller returns StreamedResponse, InjectCrossOriginHelperSubscriber will throw FatalThrowableError.
Type error: stripos() expects parameter 1 to be string, bool given
Steps to reproduce
1. Clean installation of eZ Platform 2.5
2. Create a new src/AppBundle/Controller/TestController:
<?php namespace AppBundle\Controller; use Symfony\Component\HttpFoundation\StreamedResponse; class TestController { public function downloadAction() { $response = new StreamedResponse(); $response->setCallback(function () { var_dump('Hello World'); flush(); var_dump('Hello World'); flush(); }); $response->send(); return $response; } }
3. Add route for it - in app/config/routing.yml add at the begnining:
test: path: /test defaults: { _controller: AppBundle:Test:download }
4. In your browser go to http://<your_project>/test.
5. Check logs/profiler for the request
Result
FatalThrowableError Type error: stripos() expects parameter 1 to be string, bool given