Skip to content

Commit

Permalink
Merge branch '3.0' into 3.1
Browse files Browse the repository at this point in the history
* 3.0:
  [HttpKernel] fixed internal subrequests having an if-modified-since-header
  [Security] Fix deprecated usage of DigestAuthenticationEntryPoint::getKey() in DigestAuthenticationListener
  [Validator] Added additional MasterCard range to the CardSchemeValidator
  Make the exception message more clear.
  [Form] fixed bug - name in ButtonBuilder
  [DoctrineBridge] added missing error code for constraint.
  [ClassLoader] Fix declared classes being computed when not needed
  [varDumper] Fix missing usage of ExceptionCaster::$traceArgs
  • Loading branch information
nicolas-grekas committed Jul 10, 2016
2 parents d2f136e + 6d5cc01 commit a810e2c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Constraints/CardSchemeValidator.php
Expand Up @@ -73,8 +73,10 @@ class CardSchemeValidator extends ConstraintValidator
'/^6[0-9]{11,18}$/',
),
// All MasterCard numbers start with the numbers 51 through 55. All have 16 digits.
// October 2016 MasterCard numbers can also start with 222100 through 272099.
'MASTERCARD' => array(
'/^5[1-5][0-9]{14}$/',
'/^2(22[1-9][0-9]{12}|2[3-9][0-9]{13}|[3-6][0-9]{14}|7[0-1][0-9]{13}|720[0-9]{12})$/',
),
// All Visa card numbers start with a 4. New cards have 16 digits. Old cards have 13.
'VISA' => array(
Expand Down
2 changes: 1 addition & 1 deletion Mapping/PropertyMetadata.php
Expand Up @@ -39,7 +39,7 @@ class PropertyMetadata extends MemberMetadata
public function __construct($class, $name)
{
if (!property_exists($class, $name)) {
throw new ValidatorException(sprintf('Property %s does not exist in class %s', $name, $class));
throw new ValidatorException(sprintf('Property "%s" does not exist in class "%s"', $name, $class));
}

parent::__construct($class, $name, $name);
Expand Down
8 changes: 8 additions & 0 deletions Tests/Constraints/CardSchemeValidatorTest.php
Expand Up @@ -96,6 +96,12 @@ public function getValidNumbers()
array('MAESTRO', '6594371785970435599'),
array('MASTERCARD', '5555555555554444'),
array('MASTERCARD', '5105105105105100'),
array('MASTERCARD', '2221005555554444'),
array('MASTERCARD', '2230000000000000'),
array('MASTERCARD', '2300000000000000'),
array('MASTERCARD', '2699999999999999'),
array('MASTERCARD', '2709999999999999'),
array('MASTERCARD', '2720995105105100'),
array('VISA', '4111111111111111'),
array('VISA', '4012888888881881'),
array('VISA', '4222222222222'),
Expand Down Expand Up @@ -123,6 +129,8 @@ public function getInvalidNumbers()
array('AMEX', '000000000000', CardScheme::INVALID_FORMAT_ERROR), // a lone number
array('DINERS', '3056930', CardScheme::INVALID_FORMAT_ERROR), // only first part of the number
array('DISCOVER', '1117', CardScheme::INVALID_FORMAT_ERROR), // only last 4 digits
array('MASTERCARD', '2721001234567890', CardScheme::INVALID_FORMAT_ERROR), // Not assigned yet
array('MASTERCARD', '2220991234567890', CardScheme::INVALID_FORMAT_ERROR), // Not assigned yet
);
}
}

0 comments on commit a810e2c

Please sign in to comment.