Merge pull request #251 from kadimi/patch-8

Prevent array_filter on non-array `$result`
This commit is contained in:
Brian Miyaji
2018-02-26 14:29:21 +11:00
committed by GitHub

View File

@@ -17,7 +17,7 @@ class SP_Event extends SP_Custom_Post{
$results = get_post_meta( $this->ID, 'sp_results', true ); $results = get_post_meta( $this->ID, 'sp_results', true );
if ( is_array( $results ) ) { if ( is_array( $results ) ) {
foreach( $results as $result ) { foreach( $results as $result ) {
$result = array_filter( $result ); $result = is_array( $result ) ? array_filter( $result ) : array();
if ( count( $result ) > 0 ) { if ( count( $result ) > 0 ) {
return 'results'; return 'results';
} }