Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@symfonyaml
Copy link
Contributor

QA
Branch?5.4
Bug fix?yes
New feature?no
Deprecations?no
IssuesFix#58610
LicenseMIT

Issue

When using the Choice validatorcallback 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

@carsonbotcarsonbot added this to the5.4 milestoneOct 21, 2024
@symfonyamlsymfonyaml changed the title[Validator] Fix choice callback option if not array or iterable returned[Validator][Choice] Fix callback option if not array or iterable returnedOct 21, 2024
@stof
Copy link
Member

should we mention the name of the callable in the error message, to make it easier to debug ?

symfonyaml reacted with thumbs up emoji

@symfonyaml
Copy link
ContributorAuthor

@stof Thank you for your review. That's a good idea, I will add that the callable in the error message.

HypeMCand others added23 commitsOctober 21, 2024 16:39
Sincesymfony#54471, dumpFile will trigger a `fileperms(): stat failed`error when writing to a filename that does not yet exist. Thiswas silenced from PHP's default handler with the `@` operator.However, the error is still passed to any custom handler that theapplication has registered, and can therefore cause exceptions orspurious logging depending on the implementation of the handler.The better solution, which is consistent with all other calls tonative functions in this class, would be to use `self::box` tocatch and ignore the potential error so that it never leaksoutside this class.
xabbuhand others added16 commitsOctober 21, 2024 16:39
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       | MITCommits-------d0f63b8 CS: clean some whitespaces/indentation
The changes done insymfony#58453 were not enough. Since the session name is usedas 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 areexecuted assuming that tests explicitly creating the schema were executedfirst. This assumption leads to test failures on PHPUnit 10+ were testsdefined in parent classes are run first where they were run later withPHPUnit 9.6.
Oracle converts all not quoted names to uppercase
@symfonyaml
Copy link
ContributorAuthor

I appliedthis from the doc
but still wrong rebase ....... I create another PR.

@symfonyamlsymfonyaml deleted the fix-choice-validator-callback-iterable branchOctober 21, 2024 14:45
@symfonyaml
Copy link
ContributorAuthor

@stof new PR#58615 , sorry .....

@stof
Copy link
Member

@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)

symfonyaml reacted with thumbs up emoji

nicolas-grekas added a commit that referenced this pull requestOct 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### IssueWhen 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### SolutionIn 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 freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@xabbuhxabbuhAwaiting requested review from xabbuhxabbuh is a code owner

@lyrixxlyrixxAwaiting requested review from lyrixxlyrixx is a code owner

@dunglasdunglasAwaiting requested review from dunglasdunglas is a code owner

@ycerutoycerutoAwaiting requested review from ycerutoyceruto is a code owner

@chalasrchalasrAwaiting requested review from chalasrchalasr is a code owner

@OskarStarkOskarStarkAwaiting requested review from OskarStarkOskarStark is a code owner

@jderussejderusseAwaiting requested review from jderussejderusse is a code owner

Assignees

No one assigned

Projects

None yet

Milestone

5.4

Development

Successfully merging this pull request may close these issues.

78 participants

@symfonyaml@stof@carsonbot@HypeMC@alexandre-daubois@SherinBloemendaal@xabbuh@smnandre@fmata@nicolas-grekas@karstennilsen@acoulton@ElisDN@llupa@stephanvierkant@k-sahara@thunderer@HMRDevil@asispts@camilleislasse@fabpot@rhertogh@bobvandevijver@Seldaek@podhy@94noni@mvhirsch@sfmok@VincentLanglet@seho-nl@mtarld@tscni@jwage@romain-jacquart@MatTheCat@fancyweb@umigam3@bocharsky-bw@arczinosek@seriquynh@V1nicius00@nei@danielTiringer@mpdude@daffoxdev@wmouwen@OskarStark@Wirone@constantable@norkunas@lyrixx@benjilebon@IndraGunawan@aleho@pkruithof@k0d3r1s@jbtronics@akeylimepie@RobertMe@homersimpsons@afunctional@yceruto@danilovict2@pan93412@oriolvinals@derrabus@BlackbitDevs@jderusse@GromNaN@isarastov@rinimisini@fritzmg@wallach-game@aschempp@bram123@simoheinonen@jjjb03@hosni

[8]ページ先頭

©2009-2025 Movatter.jp