laravel / octane

Supercharge your Laravel application's performance.
https://laravel.com/docs/octane
MIT License
3.76k stars 293 forks source link

ob_end_clean(): Failed to delete buffer in Worker.php #922

Closed atom1285 closed 3 months ago

atom1285 commented 3 months ago

Octane Version

2.5.1

Laravel Version

10.48.15

PHP Version

8.3.8

What server type are you using?

Swoole

Server Version

5.3.1

Database Driver & Version

No response

Description

Upon sending a request to my laravel application I receive the following.

curl http://0.0.0.0:8000
ErrorException: ob_end_clean(): Failed to delete buffer. No buffer to delete in /var/www/html/vendor/laravel/octane/src/Worker.php:90
Stack trace:
#0 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(255): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError()
#1 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->Illuminate\Foundation\Bootstrap\{closure}()
#2 /var/www/html/vendor/laravel/octane/src/Worker.php(90): ob_end_clean()
#3 /var/www/html/vendor/laravel/octane/bin/swoole-server(120): Laravel\Octane\Worker->handle()
#4 [internal function]: {closure}()
#5 /var/www/html/vendor/laravel/octane/bin/swoole-server(170): Swoole\Server->start()
#6 {main}

I investigated and it happens, because an another package that i use cleans the output buffer (ob_end_clean()) when an exception is thrown in my application (in this case a 404 Not Found exception), this means that when octane executes ob_end_clean() the output buffer is already empty, so the function produces an E_NOTICE.

Steps To Reproduce

Run the ob_end_clean() function just before returning a response to octane.

driesvints commented 3 months ago

Seems you sent in a PR so let's see how it goes. Thanks 👍