composer update
This commit is contained in:
@@ -13,7 +13,7 @@ namespace Symfony\Component\HttpFoundation\File\MimeType;
|
||||
|
||||
use Symfony\Component\Mime\MimeTypes;
|
||||
|
||||
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" instead.', ExtensionGuesser::class, MimeTypes::class), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" instead.', ExtensionGuesser::class, MimeTypes::class), \E_USER_DEPRECATED);
|
||||
|
||||
/**
|
||||
* A singleton mime type to file extension guesser.
|
||||
|
||||
@@ -15,7 +15,7 @@ use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException;
|
||||
use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException;
|
||||
use Symfony\Component\Mime\FileBinaryMimeTypeGuesser as NewFileBinaryMimeTypeGuesser;
|
||||
|
||||
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" instead.', FileBinaryMimeTypeGuesser::class, NewFileBinaryMimeTypeGuesser::class), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" instead.', FileBinaryMimeTypeGuesser::class, NewFileBinaryMimeTypeGuesser::class), \E_USER_DEPRECATED);
|
||||
|
||||
/**
|
||||
* Guesses the mime type with the binary "file" (only available on *nix).
|
||||
|
||||
@@ -15,7 +15,7 @@ use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException;
|
||||
use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException;
|
||||
use Symfony\Component\Mime\FileinfoMimeTypeGuesser as NewFileinfoMimeTypeGuesser;
|
||||
|
||||
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" instead.', FileinfoMimeTypeGuesser::class, NewFileinfoMimeTypeGuesser::class), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" instead.', FileinfoMimeTypeGuesser::class, NewFileinfoMimeTypeGuesser::class), \E_USER_DEPRECATED);
|
||||
|
||||
/**
|
||||
* Guesses the mime type using the PECL extension FileInfo.
|
||||
@@ -65,10 +65,16 @@ class FileinfoMimeTypeGuesser implements MimeTypeGuesserInterface
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!$finfo = new \finfo(FILEINFO_MIME_TYPE, $this->magicFile)) {
|
||||
if (!$finfo = new \finfo(\FILEINFO_MIME_TYPE, $this->magicFile)) {
|
||||
return null;
|
||||
}
|
||||
$mimeType = $finfo->file($path);
|
||||
|
||||
return $finfo->file($path);
|
||||
if ($mimeType && 0 === (\strlen($mimeType) % 2)) {
|
||||
$mimeStart = substr($mimeType, 0, \strlen($mimeType) >> 1);
|
||||
$mimeType = $mimeStart.$mimeStart === $mimeType ? $mimeStart : $mimeType;
|
||||
}
|
||||
|
||||
return $mimeType;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Symfony\Component\HttpFoundation\File\MimeType;
|
||||
|
||||
use Symfony\Component\Mime\MimeTypes;
|
||||
|
||||
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" instead.', MimeTypeExtensionGuesser::class, MimeTypes::class), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" instead.', MimeTypeExtensionGuesser::class, MimeTypes::class), \E_USER_DEPRECATED);
|
||||
|
||||
/**
|
||||
* Provides a best-guess mapping of mime type to file extension.
|
||||
@@ -625,7 +625,7 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface
|
||||
'audio/basic' => 'au',
|
||||
'audio/midi' => 'mid',
|
||||
'audio/mp4' => 'm4a',
|
||||
'audio/mpeg' => 'mpga',
|
||||
'audio/mpeg' => 'mp3',
|
||||
'audio/ogg' => 'oga',
|
||||
'audio/s3m' => 's3m',
|
||||
'audio/silk' => 'sil',
|
||||
|
||||
@@ -15,7 +15,7 @@ use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException;
|
||||
use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException;
|
||||
use Symfony\Component\Mime\MimeTypes;
|
||||
|
||||
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" instead.', MimeTypeGuesser::class, MimeTypes::class), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" instead.', MimeTypeGuesser::class, MimeTypes::class), \E_USER_DEPRECATED);
|
||||
|
||||
/**
|
||||
* A singleton mime type guesser.
|
||||
|
||||
@@ -31,7 +31,7 @@ use Symfony\Component\Mime\MimeTypes;
|
||||
*/
|
||||
class UploadedFile extends File
|
||||
{
|
||||
private $test = false;
|
||||
private $test;
|
||||
private $originalName;
|
||||
private $mimeType;
|
||||
private $error;
|
||||
@@ -66,15 +66,15 @@ class UploadedFile extends File
|
||||
$this->mimeType = $mimeType ?: 'application/octet-stream';
|
||||
|
||||
if (4 < \func_num_args() ? !\is_bool($test) : null !== $error && @filesize($path) === $error) {
|
||||
@trigger_error(sprintf('Passing a size as 4th argument to the constructor of "%s" is deprecated since Symfony 4.1.', __CLASS__), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('Passing a size as 4th argument to the constructor of "%s" is deprecated since Symfony 4.1.', __CLASS__), \E_USER_DEPRECATED);
|
||||
$error = $test;
|
||||
$test = 5 < \func_num_args() ? func_get_arg(5) : false;
|
||||
}
|
||||
|
||||
$this->error = $error ?: UPLOAD_ERR_OK;
|
||||
$this->error = $error ?: \UPLOAD_ERR_OK;
|
||||
$this->test = $test;
|
||||
|
||||
parent::__construct($path, UPLOAD_ERR_OK === $this->error);
|
||||
parent::__construct($path, \UPLOAD_ERR_OK === $this->error);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -83,7 +83,7 @@ class UploadedFile extends File
|
||||
* It is extracted from the request from which the file has been uploaded.
|
||||
* Then it should not be considered as a safe value.
|
||||
*
|
||||
* @return string|null The original name
|
||||
* @return string The original name
|
||||
*/
|
||||
public function getClientOriginalName()
|
||||
{
|
||||
@@ -100,7 +100,7 @@ class UploadedFile extends File
|
||||
*/
|
||||
public function getClientOriginalExtension()
|
||||
{
|
||||
return pathinfo($this->originalName, PATHINFO_EXTENSION);
|
||||
return pathinfo($this->originalName, \PATHINFO_EXTENSION);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -112,7 +112,7 @@ class UploadedFile extends File
|
||||
* For a trusted mime type, use getMimeType() instead (which guesses the mime
|
||||
* type based on the file content).
|
||||
*
|
||||
* @return string|null The mime type
|
||||
* @return string The mime type
|
||||
*
|
||||
* @see getMimeType()
|
||||
*/
|
||||
@@ -155,7 +155,7 @@ class UploadedFile extends File
|
||||
*/
|
||||
public function getClientSize()
|
||||
{
|
||||
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1. Use getSize() instead.', __METHOD__), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1. Use getSize() instead.', __METHOD__), \E_USER_DEPRECATED);
|
||||
|
||||
return $this->getSize();
|
||||
}
|
||||
@@ -180,7 +180,7 @@ class UploadedFile extends File
|
||||
*/
|
||||
public function isValid()
|
||||
{
|
||||
$isOk = UPLOAD_ERR_OK === $this->error;
|
||||
$isOk = \UPLOAD_ERR_OK === $this->error;
|
||||
|
||||
return $this->test ? $isOk : $isOk && is_uploaded_file($this->getPathname());
|
||||
}
|
||||
@@ -217,19 +217,19 @@ class UploadedFile extends File
|
||||
}
|
||||
|
||||
switch ($this->error) {
|
||||
case UPLOAD_ERR_INI_SIZE:
|
||||
case \UPLOAD_ERR_INI_SIZE:
|
||||
throw new IniSizeFileException($this->getErrorMessage());
|
||||
case UPLOAD_ERR_FORM_SIZE:
|
||||
case \UPLOAD_ERR_FORM_SIZE:
|
||||
throw new FormSizeFileException($this->getErrorMessage());
|
||||
case UPLOAD_ERR_PARTIAL:
|
||||
case \UPLOAD_ERR_PARTIAL:
|
||||
throw new PartialFileException($this->getErrorMessage());
|
||||
case UPLOAD_ERR_NO_FILE:
|
||||
case \UPLOAD_ERR_NO_FILE:
|
||||
throw new NoFileException($this->getErrorMessage());
|
||||
case UPLOAD_ERR_CANT_WRITE:
|
||||
case \UPLOAD_ERR_CANT_WRITE:
|
||||
throw new CannotWriteFileException($this->getErrorMessage());
|
||||
case UPLOAD_ERR_NO_TMP_DIR:
|
||||
case \UPLOAD_ERR_NO_TMP_DIR:
|
||||
throw new NoTmpDirFileException($this->getErrorMessage());
|
||||
case UPLOAD_ERR_EXTENSION:
|
||||
case \UPLOAD_ERR_EXTENSION:
|
||||
throw new ExtensionFileException($this->getErrorMessage());
|
||||
}
|
||||
|
||||
@@ -246,7 +246,7 @@ class UploadedFile extends File
|
||||
$sizePostMax = self::parseFilesize(ini_get('post_max_size'));
|
||||
$sizeUploadMax = self::parseFilesize(ini_get('upload_max_filesize'));
|
||||
|
||||
return min($sizePostMax ?: PHP_INT_MAX, $sizeUploadMax ?: PHP_INT_MAX);
|
||||
return min($sizePostMax ?: \PHP_INT_MAX, $sizeUploadMax ?: \PHP_INT_MAX);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -290,17 +290,17 @@ class UploadedFile extends File
|
||||
public function getErrorMessage()
|
||||
{
|
||||
static $errors = [
|
||||
UPLOAD_ERR_INI_SIZE => 'The file "%s" exceeds your upload_max_filesize ini directive (limit is %d KiB).',
|
||||
UPLOAD_ERR_FORM_SIZE => 'The file "%s" exceeds the upload limit defined in your form.',
|
||||
UPLOAD_ERR_PARTIAL => 'The file "%s" was only partially uploaded.',
|
||||
UPLOAD_ERR_NO_FILE => 'No file was uploaded.',
|
||||
UPLOAD_ERR_CANT_WRITE => 'The file "%s" could not be written on disk.',
|
||||
UPLOAD_ERR_NO_TMP_DIR => 'File could not be uploaded: missing temporary directory.',
|
||||
UPLOAD_ERR_EXTENSION => 'File upload was stopped by a PHP extension.',
|
||||
\UPLOAD_ERR_INI_SIZE => 'The file "%s" exceeds your upload_max_filesize ini directive (limit is %d KiB).',
|
||||
\UPLOAD_ERR_FORM_SIZE => 'The file "%s" exceeds the upload limit defined in your form.',
|
||||
\UPLOAD_ERR_PARTIAL => 'The file "%s" was only partially uploaded.',
|
||||
\UPLOAD_ERR_NO_FILE => 'No file was uploaded.',
|
||||
\UPLOAD_ERR_CANT_WRITE => 'The file "%s" could not be written on disk.',
|
||||
\UPLOAD_ERR_NO_TMP_DIR => 'File could not be uploaded: missing temporary directory.',
|
||||
\UPLOAD_ERR_EXTENSION => 'File upload was stopped by a PHP extension.',
|
||||
];
|
||||
|
||||
$errorCode = $this->error;
|
||||
$maxFilesize = UPLOAD_ERR_INI_SIZE === $errorCode ? self::getMaxFilesize() / 1024 : 0;
|
||||
$maxFilesize = \UPLOAD_ERR_INI_SIZE === $errorCode ? self::getMaxFilesize() / 1024 : 0;
|
||||
$message = isset($errors[$errorCode]) ? $errors[$errorCode] : 'The file "%s" was not uploaded due to an unknown error.';
|
||||
|
||||
return sprintf($message, $this->getClientOriginalName(), $maxFilesize);
|
||||
|
||||
Reference in New Issue
Block a user