Skip to content

Commit 8d26c64

Browse files
committed
Replace create_function() calls by closures
The function has been deprecated in PHP 7.2. Fixes #284
1 parent db6c7df commit 8d26c64

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Source/Source.FilterAPI.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ function Source_Process_FilterOption( $key, $option ) {
202202
}
203203

204204
$wc = array_map( 'db_param', $value );
205-
$wc = array_map( create_function( '$item','return "' . $key . ' LIKE $item";' ), $wc );
206-
$value = array_map( create_function( '$item', 'return "%$item%";' ), $value );
205+
$wc = array_map( function ( $item ) use ( $key ) { return "$key LIKE $item"; }, $wc);
206+
$value = array_map( function( $item ) { return "%$item%"; }, $value );
207207

208208
$sql = '(' . implode( ' OR ', $wc ) . ')';
209209

@@ -586,7 +586,7 @@ function Source_Date_StampArray( $t_input ) {
586586
return null;
587587
}
588588

589-
return array_map( create_function( '$in', 'return (int) $in;' ), array_slice( $t_matches, 1, 3 ) );
589+
return array_map( function ( $in ) { return (int) $in; }, array_slice( $t_matches, 1, 3 ) );
590590
}
591591

592592
function Source_Date_Select( $p_name, $p_selected=null ) {

0 commit comments

Comments
 (0)