Skip to content

Commit

Permalink
Replace deprecated create_function() with Closures
Browse files Browse the repository at this point in the history
create_function() has been deprecated as of PHP 7.2

Occurrences of create_function() in /plugin.php were intentionally
excluded from this update as that source code is run when PHP < 5.4 is
detected (Closures require PHP 5.4+).

See wpsharks/comet-cache#921
  • Loading branch information
raamdev committed Feb 25, 2018
1 parent e4afd23 commit 654591c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/includes/traits/Shared/FsUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function nDirSeps($dir_file, $allow_trailing_slash = false)
}
if (mb_strpos($dir_file, ':' !== false)) {
if (preg_match('/^(?P<drive_letter>[a-zA-Z])\:[\/\\\\]/u', $dir_file)) {
$dir_file = preg_replace_callback('/^(?P<drive_letter>[a-zA-Z])\:[\/\\\\]/u', create_function('$m', 'return mb_strtoupper($m[0]);'), $dir_file);
$dir_file = preg_replace_callback('/^(?P<drive_letter>[a-zA-Z])\:[\/\\\\]/u', function ($m) { return mb_strtoupper($m[0]); }, $dir_file);
}
}
$dir_file = preg_replace('/\/+/u', '/', str_replace([DIRECTORY_SEPARATOR, '\\', '/'], '/', $dir_file));
Expand Down

0 comments on commit 654591c

Please sign in to comment.