Skip to content

Commit c673c27

Browse files
committed
Remove deprecated create_function call, fixes #9
1 parent af416db commit c673c27

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

includes/src/Traits/Shared/FsUtils.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function nDirSeps($dir_file, $allow_trailing_slash = false)
3737
}
3838
if (mb_strpos($dir_file, ':' !== false)) {
3939
if (preg_match('/^(?P<drive_letter>[a-zA-Z])\:[\/\\\\]/u', $dir_file)) {
40-
$dir_file = preg_replace_callback('/^(?P<drive_letter>[a-zA-Z])\:[\/\\\\]/u', create_function('$m', 'return mb_strtoupper($m[0]);'), $dir_file);
40+
$dir_file = preg_replace_callback('/^(?P<drive_letter>[a-zA-Z])\:[\/\\\\]/u', array($this, 'sanitizePathForDriveLetter'), $dir_file);
4141
}
4242
}
4343
$dir_file = preg_replace('/\/+/u', '/', str_replace([DIRECTORY_SEPARATOR, '\\', '/'], '/', $dir_file));
@@ -49,6 +49,16 @@ public function nDirSeps($dir_file, $allow_trailing_slash = false)
4949
return $dir_file; // Normalized now.
5050
}
5151

52+
/**
53+
* Sanitizes path for drive letter
54+
* @param $m
55+
*
56+
* @return array|false|string|string[]|null
57+
*/
58+
public function sanitizePathForDriveLetter($m) {
59+
return function_exists('mb_strtoupper') ? mb_strtoupper($m[0]) : strtoupper($m[0]);
60+
}
61+
5262
/**
5363
* Acquires system tmp directory path.
5464
*

0 commit comments

Comments
 (0)