Skip to content

Commit 1f8cb14

Browse files
committed
[Intl] Fixed directory traversal in emoji compression tool
When using the compression tool, the emoji data is not compressed properly due to directory traversal issues. It only goes one level deep in the `data' directory.
1 parent 8fa1634 commit 1f8cb14

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Resources/bin/compress

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,15 @@ if (!extension_loaded('zlib')) {
1717
throw new Exception('This script requires the zlib extension.');
1818
}
1919

20-
foreach (glob(dirname(__DIR__).'/data/*/*.php') as $file) {
21-
if ('meta.php' === basename($file)) {
20+
$iterator = new RecursiveIteratorIterator(
21+
new RecursiveDirectoryIterator(
22+
dirname(__DIR__).'/data',
23+
FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::SKIP_DOTS
24+
)
25+
);
26+
27+
foreach ($iterator as $file) {
28+
if ('php' !== $file->getExtension() || 'meta.php' === $file->getFilename()) {
2229
continue;
2330
}
2431

0 commit comments

Comments
 (0)