Applied rector suggestions

This commit is contained in:
Jan Böhmer 2024-06-22 00:31:43 +02:00
parent 4106bcef5f
commit 20f32c7f12
170 changed files with 808 additions and 761 deletions

View file

@ -139,12 +139,12 @@ class AttachmentPathResolver
}
//If we have now have a placeholder left, the string is invalid:
if (preg_match('#%\w+%#', $placeholder_path)) {
if (preg_match('#%\w+%#', (string) $placeholder_path)) {
return null;
}
//Path is invalid if path is directory traversal
if (str_contains($placeholder_path, '..')) {
if (str_contains((string) $placeholder_path, '..')) {
return null;
}
@ -183,7 +183,7 @@ class AttachmentPathResolver
}
//If the new string does not begin with a placeholder, it is invalid
if (!preg_match('#^%\w+%#', $real_path)) {
if (!preg_match('#^%\w+%#', (string) $real_path)) {
return null;
}

View file

@ -300,7 +300,7 @@ class AttachmentSubmitHandler
return $attachment;
}
$filename = basename($old_path);
$filename = basename((string) $old_path);
//If the basename is not one of the new unique on, we have to save the old filename
if (!preg_match('#\w+-\w{13}\.#', $filename)) {
//Save filename to attachment field
@ -378,7 +378,7 @@ class AttachmentSubmitHandler
//If we don't know filename yet, try to determine it out of url
if ('' === $filename) {
$filename = basename(parse_url($url, PHP_URL_PATH));
$filename = basename(parse_url((string) $url, PHP_URL_PATH));
}
//Set original file