Welcome Guest, Not a member yet? Register   Sign In
setting the $field variable in a custom callback
#9

[eluser]Bramme[/eluser]
Yup, and I figured out why ^^

On line 487, there's a preg_match that checks non required fields if they have a callback, it looks like this:
Code:
if (preg_match("/(callback_\w+)/", implode(' ', $rules), $match))

That \w "matches any word character (alphanumeric & underscore)". That cut off the param right away. I changed it into

Code:
if (preg_match("/(callback_.+)/", implode(' ', $rules), $match))

and now it works ^^

It's a quick and easy fix that might leave some security issues, it's possible a better regex should be written.

Maybe something along the lines of
Code:
preg_match("/(callback_[a-zA-Z0-9_\[\])/"...

No idea though if uppercase letters and or numbers are allowed in a callback (or function name, for that matter).


Messages In This Thread
setting the $field variable in a custom callback - by El Forum - 09-30-2009, 03:45 AM
setting the $field variable in a custom callback - by El Forum - 09-30-2009, 06:29 AM
setting the $field variable in a custom callback - by El Forum - 09-30-2009, 07:51 AM
setting the $field variable in a custom callback - by El Forum - 09-30-2009, 08:47 AM
setting the $field variable in a custom callback - by El Forum - 09-30-2009, 09:07 AM
setting the $field variable in a custom callback - by El Forum - 09-30-2009, 09:21 AM
setting the $field variable in a custom callback - by El Forum - 09-30-2009, 09:29 AM
setting the $field variable in a custom callback - by El Forum - 09-30-2009, 09:42 AM
setting the $field variable in a custom callback - by El Forum - 09-30-2009, 09:55 AM



Theme © iAndrew 2016 - Forum software by © MyBB