You can clone with
While trying to test issue #1850 i saw that the reporter uses
a valid_url rule in the form validation set_rules
There is no method or function named valid_url() anywhere, so the rule will actually never validate to TRUE.
However, there is a language line for valid_url here:https://github.com/EllisLab/CodeIgniter/blob/develop/system/language/english/form_validation_lang.php#L33
shouldn't either that line be removed to prevent confusion, or a method be added to actually test for valid_url() ?
Additionally, if a rule can't be found, the form validation class logs a message,
but at the debug level. Shouldn't that be raised to the error level?https://github.com/EllisLab/CodeIgniter/blob/develop/system/libraries/Form_validation.php#L731
Well, that's strange ... there was never a valid_url rule, but that language line has existed during all the time since CI 1.0.
Did some diggin. It looks like some apps use the lang line independently from form_validation.
for instance when a non-existant id is requested /app/products/show/233 it just shows lang('invalid_url')
maybe add a method to form_validation then?
filter_var($str, FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED)
edit: FILTER_VALIDATE_URL is maybe not appropriate.
invalid_url has nothing to do with this.
Otherwise, I guess we can add a valid_url() method and I do understand your concerns over FILTER_VALIDATE_URL, but I still think it should be used, even if in combination with some additional check.
As mentioned above, i'ld like to suggest raising the error level when using rules with non-existing functions.
You no longer want to implement and submit a PR with the rule method? You could include the error-level change in there.
yes, will do. Need some time. seems there are some issues with filter_var in php 5.2.13
Add 'valid_url' rule to Form Validation (issue #1966)
Implemented, see the above commit.