mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +00:00
Fixed schema loading when the file path contains at least 4 numbers in a row
this spectactularly stupid bug could also have been addressed using a [^\/] in place of the . in the pattern, but I thought it made sense to make it impossible for this to happen again by making sure the regex only sees the file name. fixes #5129
This commit is contained in:
parent
56cf59355f
commit
4909c0f257
@ -259,10 +259,11 @@ final class BlockStateUpgradeSchemaUtils{
|
||||
$iterator = new \RegexIterator(
|
||||
new \FilesystemIterator(
|
||||
$path,
|
||||
\FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::UNIX_PATHS
|
||||
\FilesystemIterator::KEY_AS_FILENAME | \FilesystemIterator::SKIP_DOTS
|
||||
),
|
||||
'/\/(\d{4}).*\.json$/',
|
||||
\RegexIterator::GET_MATCH
|
||||
'/^(\d{4}).*\.json$/',
|
||||
\RegexIterator::GET_MATCH,
|
||||
\RegexIterator::USE_KEY
|
||||
);
|
||||
|
||||
$result = [];
|
||||
|
@ -42,10 +42,11 @@ final class ItemIdMetaUpgradeSchemaUtils{
|
||||
$iterator = new \RegexIterator(
|
||||
new \FilesystemIterator(
|
||||
$path,
|
||||
\FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::UNIX_PATHS
|
||||
\FilesystemIterator::KEY_AS_FILENAME | \FilesystemIterator::SKIP_DOTS
|
||||
),
|
||||
'/\/(\d{4}).*\.json$/',
|
||||
\RegexIterator::GET_MATCH
|
||||
'/^(\d{4}).*\.json$/',
|
||||
\RegexIterator::GET_MATCH,
|
||||
\RegexIterator::USE_KEY
|
||||
);
|
||||
|
||||
$result = [];
|
||||
|
Loading…
x
Reference in New Issue
Block a user