Updated Useful Functions for Plugin and Theme Security (markdown)
@@ -50,12 +50,11 @@ function zip_only_contains_allowed_extensions($zip_path, array $allowed_extensio
|
||||
|
||||
for ($i = 0; $i < $zip->numFiles; $i++) {
|
||||
$stat = $zip->statIndex( $i );
|
||||
$ext = pathinfo($stat['name'], PATHINFO_EXTENSION);
|
||||
|
||||
// Skip folders name (but their content will be checked)
|
||||
if (substr($stat['name'], -1) === '/')
|
||||
if ($ext === '' && substr($stat['name'], -1) === '/')
|
||||
continue;
|
||||
|
||||
$ext = pathinfo($stat['name'], PATHINFO_EXTENSION);
|
||||
|
||||
//print_r( "{$stat['name']} => {$ext}" . PHP_EOL . "<br/>");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user