-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Refactor filter_input usage throughout Stream #257
Comments
It was suggested by @powelski that perhaps we add a helper function to Stream that does the Could just be something like: stream_input( $type, $var ) {
if ( ! is_string( $type ) || ! is_string( $var ) ) {
return false;
}
$result = ( 'INPUT_GET' === $type && isset( $_GET[$var] ) ) ? $_GET[$var] : false;
$result = ( 'INPUT_POST' === $type && isset( $_POST[$var] ) ) ? $_POST[$var] : false;
$result = ( 'INPUT_SERVER' === $type && isset( $_SERVER[$var] ) ) ? $_SERVER[$var] : false;
return $result;
} |
@fjarrett How about making it array-friendly by providing any array as the first argument? So we would call it like: stream_input( $_GET, 'key', array( 'default_param' => 'default_value' ) ); Where the third argument is optional. |
@powelski I'd suggest we use the same syntax as |
+1 |
@shadyvb I agree. Should stay with API parity. |
Noticed couple of |
@shadyvb Please create a new issue for the |
@fjarrett I believe |
Recently there was a discussion around the use of PHP
filter_*
functions after a user reported having an issue in the WP.org forum.@westonruter then informed us that for reasons of reliability Nacin doesn't allow these to be used in core. I think we should follow suite in Stream to avoid potential issues and stay in line with core coding standards.
See #254 (comment)
The text was updated successfully, but these errors were encountered: