-
-
Notifications
You must be signed in to change notification settings - Fork 250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom callback validation against array #20
Comments
To get around it I have imploded the array when sending it to the callback and explode it in the callback to avoid the 'isset' error on line 611. It might be worth documenting the callback method a bit more to mention this issue ? |
Looks like I will have to add some more tests around adding custom callbacks to debug this issue a bit more. Thanks for bringing this to my attention. |
That would be good - I noticed there was no test for "addRule". It must be the only function without one :-) I love the Validator btw |
I added a bunch of tests with this commit: 0f96c88, and I cannot reproduce this error. I also checked line |
Ok thank you. I will update the package today and try it out. |
@vlucas Yes I still get the error but it is line 615 now. Illegal offset type in isset or empty ...\vendor\vlucas\valitron\src\Valitron\Validator.php:615 It happens when I pass an array as the third parameter of the rule. It looks like it is generating the error message and trying to use the third parameter to build the message? |
This test should cover your exact use case given the code you provided: 0f96c88 (line I cannot reproduce the error with it, and neither can Travis CI: https://travis-ci.org/vlucas/valitron/builds/9965676 - both PHP 5.3 and 5.4 pass all tests. |
I need you to clone Valitron, cd into the directory, and run |
@vlucas Ok I can reproduce it now - it is when a specific label is added
|
Ah! So we were missing a |
excellent - thank you |
Just released v1.1.2 with a fix for your issue in it. Thanks again for taking the time to report this issue and help me investigate it. |
Excellent, that worked for me perfectly now. Thanks for getting it in. |
I have been trying to add a custom rule using "addRule" which uses an array as an extra parameter.
This is what I am validating with
Unfortunately this currently breaks on line 611 of the Validator class
It complains that the isset value is not a string
Could this line be changed to this - which does work in this use case?
The text was updated successfully, but these errors were encountered: