Comments (6)
@schonhoff I've merged the changes and tagged it as v3.1.1
from laravel-postal-code-validation.
Thank you for the bug report @schonhoff. The correct behaviour for receiving null
should be validation failing, bail
should not be necessary (except if you want to suppress multiple validation errors on the same input) so this sounds like a bug.
Could you tell me you Laravel and Postal code validation versions?
from laravel-postal-code-validation.
Hello,
no problem. I hope I can help you with this information:
"name": "axlon/laravel-postal-code-validation", "version": "v3.1.0",
"name": "laravel/framework", "version": "v8.6.0",
My current validation rule for my postal code field:
['bail', 'required', 'postal_code:DE']
As you noticed correctly bail shouldn't be necessary, but currently it is for me.
If I return nothing (null) to the validation
$validator = Validator::make($data, $rules, $messages);
if($validator->fails())
throws the error message. With the fixed code on my first post I don't get an error and the validation works like you described.
from laravel-postal-code-validation.
Just a hint:
on your src\Extensions\PostalCode Class you are using
public function validate(string $attribute, ?string $value, array $parameters)
on the validate function but in the function passes you are calling there needs to be a string.
public function passes(string $countryCode, string ...$postalCodes): bool
I guess that this is the error. Maybe it is because of php 7.4 that I'm currently using.
from laravel-postal-code-validation.
@schonhoff Could you review the changes I made in PR linked above? I think they should fix your issue. Note that validation will still pass if the given country has no pattern and null is passed
from laravel-postal-code-validation.
@axlon copied the changes to my local system and it seems like it fixes the issue. Thanks for the fast fix!
from laravel-postal-code-validation.
Related Issues (16)
- InvalidArgumentException: Unsupported country code {countryCode} HOT 17
- UK postal codes not working properly HOT 2
- No error for incorrect postal codes HOT 1
- Inward code max length HOT 2
- Allow spaces in postcode HOT 2
- Wrong Validation of Irish Eircodes HOT 2
- British Overseas Territories improvement
- If I want state verification HOT 1
- Dutch Postal Code matches invalid postcode HOT 2
- [PROPOSAL] Add required format to the error message HOT 3
- Optional postcode not possible HOT 3
- Validation fails for postal code starting with 0
- Laravel 10 support HOT 3
- Issue with array validation HOT 16
- Question: Correct way to accept empty postal codes in countries with none HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-postal-code-validation.