/**
* Iterates all files of the provided zip archive
* path and validates the plugin namespace, directory traversal
* and multiple plugin directories.
*/
private function validatePluginZip(string
$prefix, \ZipArchive
$archive): void
{ for ($i = 2;
$i <
$archive->numFiles; ++
$i) { $stat =
$archive->
statIndex($i);
\
assert($stat !== false
);
$this->
assertNoDirectoryTraversal($stat['name'
]);
$this->
assertPrefix($stat['name'
],
$prefix);
} } private function getPluginName(\ZipArchive
$archive): string
{ $entry =
$archive->
statIndex(0
);
\
assert($entry !== false
);
return explode(\DIRECTORY_SEPARATOR,
(string) $entry['name'
])[0
];
}