-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Validator][Choice] Fix callback option if not array or iterable returned #58611
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
Closed
symfonyaml
wants to merge
313
commits into
symfony:5.4
from
symfonyaml:fix-choice-validator-callback-iterable
Closed
[Validator][Choice] Fix callback option if not array or iterable returned #58611
symfonyaml
wants to merge
313
commits into
symfony:5.4
from
symfonyaml:fix-choice-validator-callback-iterable
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
should we mention the name of the callable in the error message, to make it easier to debug ? |
@stof Thank you for your review. That's a good idea, I will add that the callable in the error message. |
…th optional args
…of `MockBuilder`
… 3.0 when not in develop mode
Since symfony#54471, dumpFile will trigger a `fileperms(): stat failed` error when writing to a filename that does not yet exist. This was silenced from PHP's default handler with the `@` operator. However, the error is still passed to any custom handler that the application has registered, and can therefore cause exceptions or spurious logging depending on the implementation of the handler. The better solution, which is consistent with all other calls to native functions in this class, would be to use `self::box` to catch and ignore the potential error so that it never leaks outside this class.
This PR was squashed before being merged into the 7.2 branch. Discussion ---------- CS: clean some whitespaces/indentation | Q | A | ------------- | --- | Branch? | 7.2 | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Issues | Fix CS | License | MIT Commits ------- d0f63b8 CS: clean some whitespaces/indentation
The changes done in symfony#58453 were not enough. Since the session name is used as the cookie name it must not be the empty string.
The test name argument is mandatory since PHPUnit 10.
The former test implementation relied on the order in which tests are executed assuming that tests explicitly creating the schema were executed first. This assumption leads to test failures on PHPUnit 10+ were tests defined in parent classes are run first where they were run later with PHPUnit 9.6.
Oracle converts all not quoted names to uppercase
I applied this from the doc |
@symfonyaml looks like you rebase on top of the latest 7.2 branch instead of the latest 5.4 branch (as your PR targets 5.4) |
nicolas-grekas
added a commit
that referenced
this pull request
Oct 22, 2024
…rned (symfonyaml) This PR was squashed before being merged into the 5.4 branch. Discussion ---------- [Validator] [Choice] Fix callback option if not array returned | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #58610 | License | MIT ### Issue When using the Choice validator `callback` option, and the callback method provided does not return an array or iterable, it causes a PHP error. See all details and how to reproduce it in the issue #58610 ### Solution In this PR - Add some checks if the callback method provided returns an array or iterable - Add tests for exception and iterable ________________ **NOTE** : This PR replaces [the old one](#58611) _(I messed up with the branch rebase)_ Commits ------- 02d2769 [Validator] [Choice] Fix callback option if not array returned
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
When using the Choice validator
callback
option, and the callback method provided does not return an array or iterable, it causes a PHP error.See all details and how to reproduce it in the issue #58610
Solution
In this PR