Respect / Validation

The most awesome validation engine ever created for PHP
https://respect-validation.readthedocs.io
MIT License
5.75k stars 774 forks source link

Unexpected behavior with the country code rule in 2.3 #1446

Closed oschwald closed 5 months ago

oschwald commented 5 months ago

As of e2b6138b, the following code no longer throws an exception on a lower-cased country code:

<?php

require 'vendor/autoload.php';

use Respect\Validation\Validator as v;

$a = v::keySet(v::key('country', v::countryCode(), false));

$a->check(['country' => 'ca']);

In 2.2.4, a lower-cased country code would throw an exception with the error Uncaught country must be a valid country.

henriquemoody commented 5 months ago

Wouldn't accepting ca as a country code be considered a bug? I haven't read any document about it, but I've always seen those codes in uppercase.

oschwald commented 5 months ago

Yes, correct. It now accepts lowercase. Before 2.3, it did not accept it.

On Fri, Feb 2, 2024, 3:32 AM Henrique Moody @.***> wrote:

Wouldn't accepting ca as a country code be considered a bug? I haven't read any document about it, but I've always seen those codes in uppercase.

— Reply to this email directly, view it on GitHub https://github.com/Respect/Validation/issues/1446#issuecomment-1923622699, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACECM3QWFTV24H675KYKHTYRTFGTAVCNFSM6AAAAABCVNEJCSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRTGYZDENRZHE . You are receiving this because you authored the thread.Message ID: @.***>

henriquemoody commented 5 months ago

Thank you for reporting 🐼

I will fix this one as soon as possible!

henriquemoody commented 5 months ago

The fix is available on version 2.3.2

Thank you for reporting 🐼