Skip to content

Length validation does not adhere multibyte chars #97

Description

@jaytaph

It seems that detecting lengths on strings will use the strlen() function. This causes issues when detecting multibyte strings, as strlen() count bytes, not characters.

Example:

$v->required('user.first_name')->lengthBetween(2, 5)->alpha();
$result = $v->validate([
    'user' => [
        'first_name' => 'Björk',
    ],
]);

will thrown an error on validation, indicating that the length is too long (although bytewise correct, it's doubtful that this would be the expected behaviour)

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions