klein / klein.php

A fast & flexible router
MIT License
2.66k stars 290 forks source link

Getting blank page if I don't comment out fastcgi_finish_request() in AbstractResponse #362

Open gazu1986 opened 7 years ago

gazu1986 commented 7 years ago

Hi we have a strange problem with Klein. I must mention that we are running on nginx. If we don't comment out line 412 in AbstractResponse (fastcgi_finish_request()) we get blank page. We initialise Klein in our routes file like this:

<?php
$klein = new \Klein\Klein();

$serverPath = '';
if(SERVERNAME != ''){
    $serverPath = '/'.SERVERNAME;
}

$klein->respond('GET', $serverPath . '/import/something', function($request) {
    $controller = new Controller\ImportController();
    return $controller->start($request);
});

$klein->respond( $serverPath . '/import/somethingElse', function ($request, $response) {
  $controller = new Controller\ImportController();
  $controller->uploadFiles($request, $response);
});

and so on. We include route file in index and trigger $klein->dispatch(); We have some code executing after dispatch. Could that be the problem? Or is it something else? Thanks in advance for your help.