From bad6fc0d88e69349393c3950ca25e5dd8ce34cd2 Mon Sep 17 00:00:00 2001 From: Andreas Gohr <andi@splitbrain.org> Date: Fri, 31 Mar 2017 10:02:14 +0200 Subject: [PATCH] replace deprecated create_function with anonymous functions --- inc/common.php | 12 ++++++++++-- inc/media.php | 7 ++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/inc/common.php b/inc/common.php index d23c0c53f..9a1da7907 100644 --- a/inc/common.php +++ b/inc/common.php @@ -730,7 +730,9 @@ function checkwordblock($text = '') { $data['userinfo']['name'] = $INFO['userinfo']['name']; $data['userinfo']['mail'] = $INFO['userinfo']['mail']; } - $callback = create_function('', 'return true;'); + $callback = function () { + return true; + }; return trigger_event('COMMON_WORDBLOCK_BLOCKED', $data, $callback, true); } } @@ -1139,7 +1141,13 @@ function parsePageTemplate(&$data) { ); // we need the callback to work around strftime's char limit - $tpl = preg_replace_callback('/%./', create_function('$m', 'return strftime($m[0]);'), $tpl); + $tpl = preg_replace_callback( + '/%./', + function ($m) { + return strftime($m[0]); + }, + $tpl + ); $data['tpl'] = $tpl; return $tpl; } diff --git a/inc/media.php b/inc/media.php index ed0065676..45565db08 100644 --- a/inc/media.php +++ b/inc/media.php @@ -427,7 +427,12 @@ function media_save($file, $id, $ow, $auth, $move) { // get filetype regexp $types = array_keys(getMimeTypes()); - $types = array_map(create_function('$q','return preg_quote($q,"/");'),$types); + $types = array_map( + function ($q) { + return preg_quote($q, "/"); + }, + $types + ); $regex = join('|',$types); // because a temp file was created already -- GitLab