[PATCH] Fix segfault in filter extension when using callbacks
| From: | Arnar Mar Sig | Date: | Sun, 24 Feb 2008 15:37:28 +0000 |
| Subject: | [PATCH] Fix segfault in filter extension when using callbacks | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-35768@lists.php.net to get a copy of this message | ||
The filter extensinon will segfault if a callback filter returns FALSE, this little patch fixes that.
There is also no way to set default value if the callback fails because of a design flow. When dealing with callbacks the 'options' key in the options parameters just be a valid callback, but to set a default value then this key must be a array that includes the key 'default'.
Test case:
function filter_test($str) { return FALSE; }
var_dump(filter_var('durty/boy', FILTER_CALLBACK, array(
'options' => 'filter_test',
)));
Arnar Mar Sig