mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-08-31 23:33:06 +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(
|
$iterator = new \RegexIterator(
|
||||||
new \FilesystemIterator(
|
new \FilesystemIterator(
|
||||||
$path,
|
$path,
|
||||||
\FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::UNIX_PATHS
|
\FilesystemIterator::KEY_AS_FILENAME | \FilesystemIterator::SKIP_DOTS
|
||||||
),
|
),
|
||||||
'/\/(\d{4}).*\.json$/',
|
'/^(\d{4}).*\.json$/',
|
||||||
\RegexIterator::GET_MATCH
|
\RegexIterator::GET_MATCH,
|
||||||
|
\RegexIterator::USE_KEY
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = [];
|
$result = [];
|
||||||
|
@ -42,10 +42,11 @@ final class ItemIdMetaUpgradeSchemaUtils{
|
|||||||
$iterator = new \RegexIterator(
|
$iterator = new \RegexIterator(
|
||||||
new \FilesystemIterator(
|
new \FilesystemIterator(
|
||||||
$path,
|
$path,
|
||||||
\FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::UNIX_PATHS
|
\FilesystemIterator::KEY_AS_FILENAME | \FilesystemIterator::SKIP_DOTS
|
||||||
),
|
),
|
||||||
'/\/(\d{4}).*\.json$/',
|
'/^(\d{4}).*\.json$/',
|
||||||
\RegexIterator::GET_MATCH
|
\RegexIterator::GET_MATCH,
|
||||||
|
\RegexIterator::USE_KEY
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = [];
|
$result = [];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user