fix: reject non-digit characters in valid_cc_number() - #10580
Merged
michalsn merged 3 commits intoSep 27, 2026
Merged
Conversation
Use ctype_digit() instead of is_numeric() so values such as decimal points, which is_numeric() accepts, can no longer reach the Luhn check. Previously a string like '5351367.37861108' passed validation and the Luhn indexer triggered an 'Undefined array key' warning on non-digit characters.
datamweb
reviewed
Sep 22, 2026
datamweb
approved these changes
Sep 22, 2026
paulbalandan
approved these changes
Sep 25, 2026
valid_cc_number()
|
Hi there, @gr8man! 👋 It looks like this pull request does not follow our template:
Please update the description to follow the template. The |
michalsn
approved these changes
Sep 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Explain what you have changed, and why.
valid_cc_number()usedis_numeric()to reject non-numeric values before the Luhn check.is_numeric()accepts strings thatctype_digit()rejects — e.g. decimal points (5351367.37861108), scientific notation, and sign characters — so such input:$sumTable[...][$number[$i]]with a non-digit index, triggering anUndefined array keywarning/ErrorException.This PR switches to
ctype_digit()(already used elsewhere insystem/, e.g.FormatRules::valid_numeric).Checklist: