Closed BHare1985 closed 6 months ago
I use a common buffer flushing function:
function buffer_flush(){ while (ob_get_level() > 0) { ob_end_flush(); } flush(); }
and in my view if I use buffer_flush() I don't specify an exit; at the end of the code, the following exception is thrown:
buffer_flush()
exit;
500 Internal Server Error Argument 1 passed to flight\net\Response::write() must be of the type string, bool given, called in /var/www/vendor/mikecao/flight/flight/Engine.php on line 430 (0) #0 /var/www/vendor/mikecao/flight/flight/Engine.php(430): flight\net\Response->write() #1 /var/www/vendor/mikecao/flight/flight/core/Dispatcher.php(219): flight\Engine->_stop() #2 /var/www/vendor/mikecao/flight/flight/core/Dispatcher.php(162): flight\core\Dispatcher::invokeMethod() #3 /var/www/vendor/mikecao/flight/flight/core/Dispatcher.php(54): flight\core\Dispatcher::execute() #4 /var/www/vendor/mikecao/flight/flight/Engine.php(98): flight\core\Dispatcher->run() #5 /var/www/vendor/mikecao/flight/flight/Engine.php(346): flight\Engine->__call() #6 /var/www/vendor/mikecao/flight/flight/core/Dispatcher.php(190): flight\Engine->flight\{closure}() #7 /var/www/vendor/mikecao/flight/flight/core/Dispatcher.php(163): flight\core\Dispatcher::callFunction() #8 /var/www/vendor/mikecao/flight/flight/core/Dispatcher.php(141): flight\core\Dispatcher::execute() #9 /var/www/vendor/mikecao/flight/flight/core/Dispatcher.php(58): flight\core\Dispatcher->filter() #10 /var/www/vendor/mikecao/flight/flight/Engine.php(98): flight\core\Dispatcher->run() #11 /var/www/vendor/mikecao/flight/flight/core/Dispatcher.php(219): flight\Engine->__call() #12 /var/www/vendor/mikecao/flight/flight/Flight.php(97): flight\core\Dispatcher::invokeMethod() #13 /var/www/index.php(38): Flight::__callStatic() #14 {main}
Perhaps my buffer flushing is not ideal but it seems like write should be aware that ob_get_clean may return false
ob_get_clean
false
I fixed this and merged the fix into n0nag0n/flight https://github.com/n0nag0n/flight/pull/3
I use a common buffer flushing function:
and in my view if I use
buffer_flush()
I don't specify anexit;
at the end of the code, the following exception is thrown:Perhaps my buffer flushing is not ideal but it seems like write should be aware that
ob_get_clean
may returnfalse