Skip to content

Commit 073d7b0

Browse files
authored
fix(Validation): fix Discover Card prefix typo in CreditCardRules (#10810)
1 parent 6d5c127 commit 073d7b0

3 files changed

Lines changed: 12 additions & 1 deletion

File tree

‎docs/changelogs/v4.7.7.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ Release Date: Unreleased
5252
- **Session:** Fixed a bug where `BaseHandler::destroyCookie()` did not send the `SameSite` attribute in the `Set-Cookie` header, which could prevent browsers from properly clearing the session cookie.
5353
- **Session:** Fixed a bug where `MemcachedHandler` did not reset lock state in `close()` or release an existing lock for a different session ID in `lockSession()`, causing subsequent reads and session ID regeneration on the same handler instance to fail.
5454
- **Session:** Fixed a bug where `Session::start()` did not remove an invalid session cookie from `Request`'s cached cookie global if cookies had already been read from `Request`.
55+
- **Validation:** Fixed a bug where `valid_cc_number` rejected valid Discover cards starting with `646` due to a typo in the prefixes list (`656` instead of `646`).
5556
- **Worker Mode:** Fixed a bug where every request that ended with an uncaught exception, including a `404 Page Not Found` without a 404 override, called `exit()` in the exception handler. This ended the worker script, so FrankenPHP booted a new one, and the worker loop skipped its cleanup after the request. The exception handler now returns to the worker loop.
5657

5758
See the repo's [CHANGELOG.md](https://github.com/codeigniter4/CodeIgniter4/blob/develop/CHANGELOG.md) for a complete list of bugs fixed.

‎system/Validation/CreditCardRules.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class CreditCardRules
6666
'Discover Card' => [
6767
'name' => 'discover',
6868
'length' => '16,19',
69-
'prefixes' => '6011,622,644,645,656,647,648,649,65',
69+
'prefixes' => '6011,622,644,645,646,647,648,649,65',
7070
'checkdigit' => true,
7171
],
7272
'InterPayment' => [

‎tests/system/Validation/StrictRules/CreditCardRulesTest.php‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,16 @@ public static function provideValidCCNumber(): iterable
460460
self::generateCardNumber(65, 19),
461461
true,
462462
],
463+
'discover21' => [
464+
'discover',
465+
self::generateCardNumber(646, 16),
466+
true,
467+
],
468+
'discover22' => [
469+
'discover',
470+
self::generateCardNumber(646, 19),
471+
true,
472+
],
463473
'interpayment1' => [
464474
'interpayment',
465475
self::generateCardNumber(4, 16),

0 commit comments

Comments
 (0)