Skip to content

Commit 3ed9565

Browse files
rayliverifiedchriskacerguis
authored andcommitted
QUICKFIX Continue Returns Response
Fixes issue #1023 The added lines returns the response to the client and allows code to continue executing. `ob_end_flush; ` does not actually work correctly according to https://stackoverflow.com/questions/10579116/how-to-flush-data-to-browser-but-continue-executing It is kept for legacy compatibility and to prevent regressions.
1 parent ae62b76 commit 3ed9565

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

application/libraries/REST_Controller.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,19 @@ public function response($data = NULL, $http_code = NULL, $continue = FALSE)
748748
}
749749
else
750750
{
751-
ob_end_flush();
751+
if (is_callable('fastcgi_finish_request'))
752+
{
753+
// Terminates connection and returns response to client on PHP-FPM.
754+
$this->output->_display();
755+
ob_end_flush();
756+
fastcgi_finish_request();
757+
ignore_user_abort(true);
758+
}
759+
else
760+
{
761+
// Legacy compatibility.
762+
ob_end_flush();
763+
}
752764
}
753765

754766
// Otherwise dump the output automatically
@@ -2213,4 +2225,4 @@ protected function _check_cors()
22132225
exit;
22142226
}
22152227
}
2216-
}
2228+
}

0 commit comments

Comments
 (0)