Skip to content

[Validator] Fix Choice constraint with associative choices array #44860

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

Merged
merged 1 commit into from
Jan 26, 2022

Conversation

derrabus
Copy link
Member

@derrabus derrabus commented Dec 29, 2021

Q A
Branch? 5.3
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #41508
License MIT
Doc PR N/A

This PR moves the $options parameter to the beginning of the constructor signature in order to fix the scenario described in #41508.

I assume that the supported ways to construct this class are either an ordered arguments call with exactly one argument or a named argument call with zero or one ordered arguments. Those scenarios should continue to work and are covered with additional tests now.

However, an ordered arguments call to the constructor with at least two parameters would break after this change.

@carsonbot carsonbot added this to the 5.3 milestone Dec 29, 2021
@carsonbot carsonbot changed the title Fix Choice constraint with associative choices array [Validator] Fix Choice constraint with associative choices array Dec 29, 2021
@derrabus derrabus force-pushed the bugfix/choice-with-string-key branch from 4cfb9a8 to cd1d812 Compare December 29, 2021 23:43
@carsonbot
Copy link

Hey!

I think @Andrej-in-ua has recently worked with this code. Maybe they can help review this?

Cheers!

Carsonbot

@nicolas-grekas nicolas-grekas force-pushed the bugfix/choice-with-string-key branch from cd1d812 to ccd85fe Compare January 26, 2022 16:24
@nicolas-grekas
Copy link
Member

Thank you @derrabus.

@nicolas-grekas nicolas-grekas merged commit 5044a0a into symfony:5.3 Jan 26, 2022
This was referenced Jan 28, 2022
@derrabus derrabus deleted the bugfix/choice-with-string-key branch January 28, 2022 14:23
nicolas-grekas referenced this pull request in symfony/validator Jan 28, 2022
* 5.3:
  Fix Choice constraint with associative choices array
  [Form] UrlType should not add protocol to emails
  Silence isatty warnings during tty detection
  [Serializer] Fix AbstractObjectNormalizer not considering pseudo type false
  [Notifier] Fix encoding of messages with FreeMobileTransport
  [Cache] workaround PHP crash
  [Console] Fix PHP 8.1 deprecation in ChoiceQuestion
  [Notifier] smsapi-notifier - correct encoding
  Replaced full CoC text with link to documentation
  Making the parser stateless
  [Console] fix restoring stty mode on CTRL+C
  fix merge (bis)
  fix merge
  [Process] Avoid calling fclose on an already closed resource
  [GHA] test tty group
  [DI] Fix tests on PHP 7.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants