diff vendor/symfony/validator/Constraints/UuidValidator.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents 4c8ae668cc8c
children 129ea1e6d783
line wrap: on
line diff
--- a/vendor/symfony/validator/Constraints/UuidValidator.php	Mon Apr 23 09:33:26 2018 +0100
+++ b/vendor/symfony/validator/Constraints/UuidValidator.php	Mon Apr 23 09:46:53 2018 +0100
@@ -16,13 +16,19 @@
 use Symfony\Component\Validator\Exception\UnexpectedTypeException;
 
 /**
- * Validates whether the value is a valid UUID per RFC 4122.
+ * Validates whether the value is a valid UUID (also known as GUID).
+ *
+ * Strict validation will allow a UUID as specified per RFC 4122.
+ * Loose validation will allow any type of UUID.
+ *
+ * For better compatibility, both loose and strict, you should consider using a specialized UUID library like "ramsey/uuid" instead.
  *
  * @author Colin O'Dell <colinodell@gmail.com>
  * @author Bernhard Schussek <bschussek@gmail.com>
  *
  * @see http://tools.ietf.org/html/rfc4122
  * @see https://en.wikipedia.org/wiki/Universally_unique_identifier
+ * @see https://github.com/ramsey/uuid
  */
 class UuidValidator extends ConstraintValidator
 {
@@ -240,7 +246,7 @@
         //   0b10xx
         // & 0b1100 (12)
         // = 0b1000 (8)
-        if ((hexdec($value[self::STRICT_VARIANT_POSITION]) & 12) !== 8) {
+        if (8 !== (hexdec($value[self::STRICT_VARIANT_POSITION]) & 12)) {
             $this->context->buildViolation($constraint->message)
                 ->setParameter('{{ value }}', $this->formatValue($value))
                 ->setCode(Uuid::INVALID_VARIANT_ERROR)