0

I'm currently facing an issue with php and flush(). It was working fine last week, but not now.

I tried several methods, disable all buffering system I found (zlib, output_buffering) and still no solution.

I'm using Symfony 3.2.7 with PHP 5.6.26 (with Xampp on windows 7).

I followed the documentation on Symfony, no luck. I also tried several solutions on StackOverflow but no luck either. The answer here doesn't solve the problem as output_buffering is set to off, so there is no buffer to flush with ob_flush()

I joined you the part of the code where the StreamedResponse is, in case the issue is just under my eyes.

$response = new StreamedResponse();
    $response->setCallback(function (){
        $directory = $this->container->getParameter("awstats.directory");

        echo $this->render("StatBundle:Default:update.html.twig")->getContent();
        flush();

        foreach (scandir($directory) as $key => $file) {
            if ( is_file( $directory . '\\' . $file ) ) 
            {
                $awf = new Awfile( $directory . '\\' . $file , $this->getDoctrine(), $this->container);
                $awf->parseInit();
                $awf->setStreamEnable(true);
                $stats = $awf->saveLinks( $this->container->getParameter("awstats.regex") );

                echo $this->render("StatBundle:Default:streamUpdateScript.html.twig")->getContent();
                flush();

            }
        }
    });
    $response->sendHeaders();

    $response->send();

So if you have any idea, I will be pleased to try it !

Community
  • 1
  • 1
MinDBreaK
  • 153
  • 2
  • 16
  • Possible duplicate of [Streaming a Response in Symfony2](http://stackoverflow.com/questions/12380783/streaming-a-response-in-symfony2) – Veas May 02 '17 at 13:26
  • This answer does not match with the problem, as it was working 3 days ago. The answer you linked is only if `output_buffering` is set to `On` – MinDBreaK May 02 '17 at 13:41
  • Ok so find out that was not a PHP issue, but a Firefox one as it was working fine on chrome. – MinDBreaK May 10 '17 at 11:32

0 Answers0