From cd07850337bc6830ec7e9ac86fbb4b5d2c407f17 Mon Sep 17 00:00:00 2001 From: Philippe Saint-Just Date: Sat, 30 Apr 2016 13:11:34 -0400 Subject: [PATCH] Merge branch 'backport-8741-8690' into 2.x --- lib/Cake/Cache/Engine/FileEngine.php | 2 +- lib/Cake/Test/Case/Utility/ValidationTest.php | 6 ++++++ lib/Cake/Utility/Validation.php | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Cache/Engine/FileEngine.php b/lib/Cake/Cache/Engine/FileEngine.php index d650e60ee..155d1950c 100644 --- a/lib/Cake/Cache/Engine/FileEngine.php +++ b/lib/Cake/Cache/Engine/FileEngine.php @@ -132,7 +132,7 @@ class FileEngine extends CacheEngine { } $expires = time() + $duration; - $contents = $expires . $lineBreak . $data . $lineBreak; + $contents = implode([$expires, $lineBreak, $data, $lineBreak]); if ($this->settings['lock']) { $this->_File->flock(LOCK_EX); diff --git a/lib/Cake/Test/Case/Utility/ValidationTest.php b/lib/Cake/Test/Case/Utility/ValidationTest.php index e3f7f25cd..aa4d7c302 100644 --- a/lib/Cake/Test/Case/Utility/ValidationTest.php +++ b/lib/Cake/Test/Case/Utility/ValidationTest.php @@ -403,6 +403,12 @@ class ValidationTest extends CakeTestCase { $this->assertTrue(Validation::cc('5467639122779531', array('mc'))); $this->assertTrue(Validation::cc('5297350261550024', array('mc'))); $this->assertTrue(Validation::cc('5162739131368058', array('mc'))); + //Mastercard (additional 2016 BIN) + $this->assertTrue(Validation::cc('2221000000000009', array('mc'))); + $this->assertTrue(Validation::cc('2720999999999996', array('mc'))); + $this->assertTrue(Validation::cc('2223000010005798', array('mc'))); + $this->assertTrue(Validation::cc('2623430710235708', array('mc'))); + $this->assertTrue(Validation::cc('2420452519835723', array('mc'))); //Solo 16 $this->assertTrue(Validation::cc('6767432107064987', array('solo'))); $this->assertTrue(Validation::cc('6334667758225411', array('solo'))); diff --git a/lib/Cake/Utility/Validation.php b/lib/Cake/Utility/Validation.php index 48bf87147..123388463 100644 --- a/lib/Cake/Utility/Validation.php +++ b/lib/Cake/Utility/Validation.php @@ -182,7 +182,7 @@ class Validation { 'enroute' => '/^2(?:014|149)\\d{11}$/', 'jcb' => '/^(3\\d{4}|2100|1800)\\d{11}$/', 'maestro' => '/^(?:5020|6\\d{3})\\d{12}$/', - 'mc' => '/^5[1-5]\\d{14}$/', + 'mc' => '/^(5[1-5]\\d{14})|(2(?:22[1-9]|2[3-9][0-9]|[3-6][0-9]{2}|7[0-1][0-9]|720)\\d{12})$/', 'solo' => '/^(6334[5-9][0-9]|6767[0-9]{2})\\d{10}(\\d{2,3})?$/', 'switch' => '/^(?:49(03(0[2-9]|3[5-9])|11(0[1-2]|7[4-9]|8[1-2])|36[0-9]{2})\\d{10}(\\d{2,3})?)|(?:564182\\d{10}(\\d{2,3})?)|(6(3(33[0-4][0-9])|759[0-9]{2})\\d{10}(\\d{2,3})?)$/',