Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Validator] Fixed constraint violation to string not handling array #10007

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
wants to merge 1 commit into from
Closed

[Validator] Fixed constraint violation to string not handling array #10007

wants to merge 1 commit into from

Conversation

eduardosoliv
Copy link
Contributor

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets
License MIT
Doc PR

This bug was introduced on PR-790 [2.3] [Validator] added comparison constraints and validators

Due to the change on root (to become the value):

-        $context = new ExecutionContext($this->createVisitor(null), $this->translator, $this->translationDomain);
+        $context = new ExecutionContext($this->createVisitor($value), $this->translator, $this->translationDomain);

https://github.com/symfony/symfony/pull/790/files#diff-f4a93c3d8fcb85a24ea41c2a993e6d83R163

My change on:

-        $class = (string) (is_object($this->root) ? get_class($this->root) : $this->root);
+        $class = is_object($this->root)
+            ? get_class($this->root)
+            : (is_array($this->root) ? 'Array' : (string) $this->root);
+

Is inspired on TypeValidator

@webmozart
Copy link
Contributor

Fixed by #10123.

@webmozart webmozart closed this Apr 8, 2014
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.

2 participants