Skip to content

Commit

Permalink
Fix system warning in gpc_get_string_array()
Browse files Browse the repository at this point in the history
The fix for issue #17640 did not consider that the value returned by
gpc_get() is not necessarily an array - it can be the default value
(e.g. null) causing PHP to throw an 'Invalid argument supplied for
foreach()' warning.

Fixes #17967, regression from 215968f
  • Loading branch information
dregad committed Dec 21, 2014
1 parent 559ba4e commit 99ada4d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/gpc_api.php
Expand Up @@ -255,6 +255,9 @@ function gpc_get_string_array( $p_var_name, $p_default = null ) {
trigger_error( ERROR_GPC_ARRAY_EXPECTED, ERROR );
}

if( !is_array( $t_result ) ) {
return $t_result;
}
$t_array = array();
foreach( $t_result as $key => $val ) {
$t_array[$key] = str_replace( "\0", "", $val );
Expand Down

0 comments on commit 99ada4d

Please sign in to comment.