Skip to content

[11.x] Fix: Custom Exceptions with Multiple Arguments does not properly rein…#54705

Merged
taylorotwell merged 11 commits into
laravel:11.xfrom
pandiselvamm:fix/custom-exceptions-with-multiple-args-in-concurrency-run
Feb 20, 2025
Merged

[11.x] Fix: Custom Exceptions with Multiple Arguments does not properly rein…#54705
taylorotwell merged 11 commits into
laravel:11.xfrom
pandiselvamm:fix/custom-exceptions-with-multiple-args-in-concurrency-run

Conversation

@pandiselvamm

@pandiselvamm pandiselvamm commented Feb 19, 2025

Copy link
Copy Markdown
Contributor

This PR resolves this issue #54500

Problem:

In Concurrency Run When the custom exception is serialized and rethrown, Laravel only passes the message argument, missing other required parameters (custom parameters), causing an ArgumentCountError.


Fix Implementation:

  • Uses reflection to inspect the exception's constructor and extract required parameters.
  • Ensures correct reconstruction of the exception with all expected arguments.
  • Handles optional parameters and defaults gracefully.

Impact:

This fix ensures that exceptions with multiple arguments are correctly rethrown in the main process, preventing runtime errors and improving the reliability of concurrent tasks in Laravel.

@pandiselvamm pandiselvamm changed the title Fix: Custom Exceptions with Multiple Arguments does not properly rein… [11.x] Fix: Custom Exceptions with Multiple Arguments does not properly rein… Feb 19, 2025
@taylorotwell

Copy link
Copy Markdown
Member

Is it possible to write an integration test for this?

@taylorotwell taylorotwell marked this pull request as draft February 19, 2025 20:55
@pandiselvamm pandiselvamm marked this pull request as ready for review February 19, 2025 21:43
@pandiselvamm

Copy link
Copy Markdown
Contributor Author

Hi @taylorotwell , Integration tests were added kindly review it

thanks!

Comment thread src/Illuminate/Concurrency/ProcessDriver.php Outdated
@pandiselvamm pandiselvamm marked this pull request as draft February 20, 2025 03:13
@pandiselvamm pandiselvamm marked this pull request as ready for review February 20, 2025 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants