Skip to content

[11.x] Fix: Handles non nested explode of multiple Date and Numeric rules in ValidationRuleParser#54718

Merged
taylorotwell merged 2 commits into
laravel:11.xfrom
AlexandreMeledandri:fix/validation-rule-parser-date-numeric
Feb 19, 2025
Merged

[11.x] Fix: Handles non nested explode of multiple Date and Numeric rules in ValidationRuleParser#54718
taylorotwell merged 2 commits into
laravel:11.xfrom
AlexandreMeledandri:fix/validation-rule-parser-date-numeric

Conversation

@AlexandreMeledandri

Copy link
Copy Markdown
Contributor

This PR fixes #54717

Problem
The current code in ValidationRuleParser explodeExplicitRule function does not handles the explode for multiple chained non-nested Date or Numeric Rule objects. It falls into the condtion that checks if the rule is an object and wraps the rule in an array as a string cast without exploding it at the pipe symbol.

Fix Implementation

My fix simply add an early exit condition for Date or Numeric rules in the logic if block for objects.
I added some test coverage for the problematic conditions.

I thought of checking against the Stringable interface but it may not be safe enough.

Please let me know if you need any changes to the fix.

Thanks !

@AlexandreMeledandri

AlexandreMeledandri commented Feb 19, 2025

Copy link
Copy Markdown
Contributor Author

Test for php 8.3 is failing due to a file permission error in an unrelated test. Any idea why ?

1) Illuminate\Tests\Integration\Console\CommandSchedulingTest::testExecutionOrder with data set "Background" (true, ['foreground:before', 'handled', 'background:after'])
ErrorException: file_put_contents(D:\a\framework\framework\vendor\orchestra\testbench-core\laravel\artisan): Failed to open stream: Permission denied

@taylorotwell taylorotwell merged commit 1f5e383 into laravel:11.x Feb 19, 2025
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.

ValidationRuleParser does not handles the explode for multiple chained non-nested Date or Numeric Rule objects

2 participants