framework
framework copied to clipboard
Application booted callbacks called twice
Laravel Version
11.33.2
PHP Version
8.2.23
Database Driver & Version
SQLite
Description
Booted callbacks are being called twice when they are registered within another booted callback.
Steps To Reproduce
Create a fresh laravel/laravel
project and add the following to the register
method of App\Providers\AppServiceProvider
:
$this->app->booted(function () {
dump("This only outputs once.");
$this->app->booted(function () {
dump("This outputs twice.");
});
});
Execute php artisan about
and it will show the following:
$ php artisan about
"This only outputs once." // app/Providers/AppServiceProvider.php:15
"This outputs twice." // app/Providers/AppServiceProvider.php:17
"This outputs twice." // app/Providers/AppServiceProvider.php:17
...