mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-16 11:58:00 +00:00
Merge commit '786f416f2ef31726b9e6fa0a5edde36aecddf085'
# Conflicts: # resources/vanilla # src/plugin/PluginBase.php # src/utils/Utils.php
This commit is contained in:
@@ -42,6 +42,7 @@ use function str_replace;
|
||||
use function stream_get_contents;
|
||||
use function strpos;
|
||||
use function unlink;
|
||||
use const DIRECTORY_SEPARATOR;
|
||||
use const LOCK_EX;
|
||||
use const LOCK_NB;
|
||||
use const LOCK_SH;
|
||||
@@ -80,7 +81,7 @@ final class Filesystem{
|
||||
* @return string
|
||||
*/
|
||||
public static function cleanPath($path){
|
||||
$result = str_replace(["\\", ".php", "phar://"], ["/", "", ""], $path);
|
||||
$result = str_replace([DIRECTORY_SEPARATOR, ".php", "phar://"], ["/", "", ""], $path);
|
||||
|
||||
//remove relative paths
|
||||
//TODO: make these paths dynamic so they can be unit-tested against
|
||||
@@ -89,7 +90,7 @@ final class Filesystem{
|
||||
\pocketmine\PATH => ""
|
||||
];
|
||||
foreach($cleanPaths as $cleanPath => $replacement){
|
||||
$cleanPath = rtrim(str_replace(["\\", "phar://"], ["/", ""], $cleanPath), "/");
|
||||
$cleanPath = rtrim(str_replace([DIRECTORY_SEPARATOR, "phar://"], ["/", ""], $cleanPath), "/");
|
||||
if(strpos($result, $cleanPath) === 0){
|
||||
$result = ltrim(str_replace($cleanPath, $replacement, $result), "/");
|
||||
}
|
||||
|
Reference in New Issue
Block a user