Skip to content

Commit

Permalink
Allow y/n strings for gpc_string_to_bool
Browse files Browse the repository at this point in the history
Add options for reading "y" and "n" as boolean parameters in
function gpc_string_to_bool
  • Loading branch information
cproensa authored and dregad committed Jan 9, 2019
1 parent 2af57de commit 93d6ea6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion core/gpc_api.php
Expand Up @@ -464,7 +464,13 @@ function gpc_make_array( $p_var_name ) {
* @return boolean
*/
function gpc_string_to_bool( $p_string ) {
if( 0 == strcasecmp( 'off', $p_string ) || 0 == strcasecmp( 'no', $p_string ) || 0 == strcasecmp( 'false', $p_string ) || 0 == strcasecmp( '', $p_string ) || 0 == strcasecmp( '0', $p_string ) ) {
if( 0 == strcasecmp( 'off', $p_string )
|| 0 == strcasecmp( 'no', $p_string )
|| 0 == strcasecmp( 'n', $p_string )
|| 0 == strcasecmp( 'false', $p_string )
|| 0 == strcasecmp( '', $p_string )
|| 0 == strcasecmp( '0', $p_string )
) {
return false;
} else {
return true;
Expand Down

0 comments on commit 93d6ea6

Please sign in to comment.