codeigniter4 / CodeIgniter4

Open Source PHP Framework (originally from EllisLab)
https://codeigniter.com/
MIT License
5.38k stars 1.9k forks source link

Bug: Should international characters be considered Alpha numeric? #7983

Closed Ukuser36 closed 1 year ago

Ukuser36 commented 1 year ago

PHP Version

8.2

CodeIgniter4 Version

4.3.6

CodeIgniter4 Installation Method

Manual (zip or tar.gz)

Which operating systems have you tested for this bug?

Linux

Which server did you use?

apache

Database

No response

What happened?

The validation library currently returns FALSE if accented characters are provided such as in the word Café. Should this not be considered a valid alpha numeric string? Whilst this was tested in 4.3.6 I don't believe the code in 4.4.1 is any different.

Steps to Reproduce

$validation = \Config\Services::validation();
echo $validation->check('Café','alpha') ? 1 : 0;

Expected Output

1

Anything else?

No response

neznaika0 commented 1 year ago

https://github.com/codeigniter4/CodeIgniter4/blob/da0bddf7cad675872a21a61823faf1a421fb3936/system/Validation/FormatRules.php#L28 Only ascii symbols a-Z allowed

kenjis commented 1 year ago

I also think the rule should pass only [a-zA-Z]+.