Skip to content

Bug: Decimal validation fails without leading digit #2740

Description

@MGatner

Describe the bug
Numbers like .25 fail validation because the regex is requiring a leading digit:

'/^[\-+]?[0-9]+(|\.[0-9]+)$/'

There should also be another case in the decimal provider at tests/system/Validation/FormatRulesTest.php.

This should be a quick fix but I'm so bad at regex and Stack Overflow doesn't agree on how to handle this. :O

CodeIgniter 4 version
Develop latest

Affected module(s)
Validation

Expected behavior, and steps to reproduce if appropriate
setRules with decimal on .11 should be true

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugVerified issues on the current code behavior or pull requests that will fix them

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions