Open
Description
Laravel Version
11.11.1
PHP Version
8.3.8
Database Driver & Version
No response
Description
Closure in job Bus::chain is not called if it is after Bus::batch - exception is thrown but there is nothing in failed jobs.
Call to undefined method Closure::getClosure() {"exception":"[object] (Error(code: 0): Call to undefined method Closure::getClosure() at /home/eldair/code/bus_chain_test/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedClosure.php:107)
Steps To Reproduce
Batch setup
$batch = [];
for ($i=0; $i < 5; $i++) {
$batch[] = new BatchJob($i + 1);
}
This will throw the exception and the closure will not be called
Bus::chain([
new ChainedJob,
Bus::batch($batch),
function () {
logger('after batch');
}
])->dispatch();
This works fine
Bus::chain([
new ChainedJob,
Bus::batch($batch),
new ChainedJob,
function () {
logger('after batch');
}
])->dispatch();
Here is the reproduction repo https://github.com/eldair/bus_chain_test/tree/main, nothing was added except two jobs and console command to call the code above.