Skip to content

LengthValidator should use mb_strlen instead of strlenΒ #917

@kesselb

Description

@kesselb

How to use GitHub

  • Please use the πŸ‘ reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Code:

if (strlen($password) < $minLength) {

Sample:

<?php

$a = '12345';
$b = '密码密码';

var_dump(
    strlen($a),
    strlen($b),
    mb_strlen($a), 
    mb_strlen($b),
);

Output:

int(5)
int(12)
int(5)
int(4)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions