laravel / framework

The Laravel Framework.
https://laravel.com
MIT License
31.82k stars 10.77k forks source link

`Bus::chain` Skipping jobs with readonly non-scalar properties #51877

Open shaffe-fr opened 2 weeks ago

shaffe-fr commented 2 weeks ago

Laravel Version

10.x and 11.x

PHP Version

8.1, 8.2 and 8.3

Database Driver & Version

No response

Description

Description of the Issue

When a Bus::chain contains a job with a readonly promoted non-scalar property, only the first job or batch in the chain is executed. The subsequent jobs or batches appear to be discarded. Additionally, even if the chain is dispatched on a non-default queue, the jobs still run on the default queue.

No exceptions were found in the logs.

Environment

Laravel versions: 10.x and 11.x PHP versions: 8.1, 8.2, and 8.3

Evidence

Failing test PR : #51878 A repository that reproduces the problem can be found here: https://github.com/shaffe-fr/framework/commit/f1b3cad6d6e3a78d108f25d751d144049e070626

Here is a screenshot illustrating the issue: image

Steps To Reproduce

  1. Create a Bus::chain with at least one job having a readonly promoted non-scalar property.
  2. Dispatch the chain.
  3. Observe that only the first job or batch is executed, and subsequent jobs/batches are not processed.
  4. Note that jobs run on the default queue, regardless of the specified queue.
driesvints commented 1 week ago

Thanks @shaffe-fr. It's not by consequence that this is related to the enum usages in your PR?

shaffe-fr commented 1 week ago

Hi @driesvints, indeed, I had the same issue with classes. I added another failing test case with a simple class in the PR #51878.

github-actions[bot] commented 1 week ago

Thank you for reporting this issue!

As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.

If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.

Thank you!