Parcourir la source

Method exists does not work if you append the () to the method name, thus this never words for objects that actually have the __toString method. Removed the erroneous () so that this works as it appears to have been intended.

Drew Butler il y a 14 ans
Parent
commit
dea5b26c3f

+ 1 - 1
src/Symfony/Component/Validator/Constraints/MaxLengthValidator.php

@@ -23,7 +23,7 @@ class MaxLengthValidator extends ConstraintValidator
             return true;
         }
 
-        if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString()'))) {
+        if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) {
             throw new UnexpectedTypeException($value, 'string');
         }