Upgrade to latest Symfony HttpFoundation tag. Closes #1865.

This commit is contained in:
Taylor Otwell
2013-05-01 14:19:10 -05:00
parent 92f602edbf
commit b9cf8dfb71
28 changed files with 1154 additions and 219 deletions

View File

@@ -45,7 +45,7 @@ class FileBinaryMimeTypeGuesser implements MimeTypeGuesserInterface
*/
public static function isSupported()
{
return !defined('PHP_WINDOWS_VERSION_BUILD');
return !defined('PHP_WINDOWS_VERSION_BUILD') && function_exists('passthru') && function_exists('escapeshellarg');
}
/**
@@ -77,7 +77,7 @@ class FileBinaryMimeTypeGuesser implements MimeTypeGuesserInterface
$type = trim(ob_get_clean());
if (!preg_match('#^([a-z0-9\-]+/[a-z0-9\-]+)#i', $type, $match)) {
if (!preg_match('#^([a-z0-9\-]+/[a-z0-9\-\.]+)#i', $type, $match)) {
// it's not a type, but an error message
return null;
}

View File

@@ -11,7 +11,6 @@
namespace Symfony\Component\HttpFoundation\File\MimeType;
use Symfony\Component\HttpFoundation\File\Exception\FileException;
use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException;
use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException;
@@ -99,7 +98,9 @@ class MimeTypeGuesser implements MimeTypeGuesserInterface
*
* @return string The mime type or NULL, if none could be guessed
*
* @throws FileException If the file does not exist
* @throws \LogicException
* @throws FileNotFoundException
* @throws AccessDeniedException
*/
public function guess($path)
{

View File

@@ -118,6 +118,19 @@ class UploadedFile extends File
return $this->originalName;
}
/**
* Returns the original file extension
*
* It is extracted from the original file name that was uploaded.
* Then is should not be considered as a safe value.
*
* @return string The extension
*/
public function getClientOriginalExtension()
{
return pathinfo($this->originalName, PATHINFO_EXTENSION);
}
/**
* Returns the file mime type.
*