Use mb_strlen instead of strlen when mbstring extension is available.

strlen() returns the number of bytes, not the number of characters.
This causes a problem when a multibyte string is supplied to string length validation.

mb_strlen() counts the number of characters, so is suitable for minLength/maxLength check.
I modified to use mb_strlen() when mbstring extension is loaded.