Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[10.x] Fix breaking changes in after validation #49956

Closed
wants to merge 19 commits into from
Closed

[10.x] Fix breaking changes in after validation #49956

wants to merge 19 commits into from

Conversation

MrPunyapal
Copy link
Contributor

@MrPunyapal MrPunyapal commented Feb 2, 2024

I had a PR #49871 to fix Issue #49863 but from this #49871 (comment) conversation it looks breaking change. also solving Issue #49955

if it is a breaking change then this PR will solve it. added tests for it too.

$v = new Validator($trans, ['y' => '1970-01-01'], ['x' => 'nullable|date', 'y' => 'nullable|date|after:x']);
$this->assertTrue($v->passes());

$v = new Validator($trans, ['dates' => [['start_at' => '2024-02-02 12:00:00', 'ends_at' => '2024-02-02 12:00:00']]], ['dates.*.start_at' => 'date', 'dates.*.ends_at' => 'date|after:start_at']);
$this->assertTrue($v->passes());

$v = new Validator($trans, ['date_end' => '2021-09-17 13:28:47'], ['date_start' => 'nullable|date', 'date_end' => 'nullable|date|after_or_equal:date_start']);
$this->assertTrue($v->passes());

Note

last 2 tests were not passing with x, y at place of starts_at or date_start and ends_at or date_end
even if I revert my previous PR #49871 changes.
we can look into that later

Copy link

github-actions bot commented Feb 2, 2024

Thanks for submitting a PR!

Note that draft PR's are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface.

Pull requests that are abandoned in draft may be closed due to inactivity.

@MrPunyapal
Copy link
Contributor Author

@calebdw

Copy link
Contributor

@calebdw calebdw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes my issue, just added some comments

@MrPunyapal
Copy link
Contributor Author

it has some weird thing

This fixes my issue, just added some comments

I don't think your issue is fixed?

@calebdw
Copy link
Contributor

calebdw commented Feb 2, 2024

Yes, adding ! is_null(...) to the conditions allows my validation test to pass

@MrPunyapal
Copy link
Contributor Author

Yes, adding ! is_null(...) to the conditions allows my validation test to pass

but that test case is failing?

@iamgergo
Copy link
Contributor

iamgergo commented Feb 3, 2024

Might be related: #49668

@MrPunyapal MrPunyapal marked this pull request as ready for review February 3, 2024 13:51
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.

Before/After validation rules ignore the validation state of the dependent field
4 participants