Skip to content

Commit cb567c5

Browse files
committed
Updated Symfony HttpFoundation to 2.1.6.
1 parent f754e1f commit cb567c5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1755
-802
lines changed
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
CHANGELOG
2+
=========
3+
4+
2.1.0
5+
-----
6+
7+
* added Request::getSchemeAndHttpHost() and Request::getUserInfo()
8+
* added a fluent interface to the Response class
9+
* added Request::isProxyTrusted()
10+
* added JsonResponse
11+
* added a getTargetUrl method to RedirectResponse
12+
* added support for streamed responses
13+
* made Response::prepare() method the place to enforce HTTP specification
14+
* [BC BREAK] moved management of the locale from the Session class to the Request class
15+
* added a generic access to the PHP built-in filter mechanism: ParameterBag::filter()
16+
* made FileBinaryMimeTypeGuesser command configurable
17+
* added Request::getUser() and Request::getPassword()
18+
* added support for the PATCH method in Request
19+
* removed the ContentTypeMimeTypeGuesser class as it is deprecated and never used on PHP 5.3
20+
* added ResponseHeaderBag::makeDisposition() (implements RFC 6266)
21+
* made mimetype to extension conversion configurable
22+
* [BC BREAK] Moved all session related classes and interfaces into own namespace, as
23+
`Symfony\Component\HttpFoundation\Session` and renamed classes accordingly.
24+
Session handlers are located in the subnamespace `Symfony\Component\HttpFoundation\Session\Handler`.
25+
* SessionHandlers must implement `\SessionHandlerInterface` or extend from the
26+
`Symfony\Component\HttpFoundation\Storage\Handler\NativeSessionHandler` base class.
27+
* Added internal storage driver proxy mechanism for forward compatibility with
28+
PHP 5.4 `\SessionHandler` class.
29+
* Added session handlers for custom Memcache, Memcached and Null session save handlers.
30+
* [BC BREAK] Removed `NativeSessionStorage` and replaced with `NativeFileSessionHandler`.
31+
* [BC BREAK] `SessionStorageInterface` methods removed: `write()`, `read()` and
32+
`remove()`. Added `getBag()`, `registerBag()`. The `NativeSessionStorage` class
33+
is a mediator for the session storage internals including the session handlers
34+
which do the real work of participating in the internal PHP session workflow.
35+
* [BC BREAK] Introduced mock implementations of `SessionStorage` to enable unit
36+
and functional testing without starting real PHP sessions. Removed
37+
`ArraySessionStorage`, and replaced with `MockArraySessionStorage` for unit
38+
tests; removed `FilesystemSessionStorage`, and replaced with`MockFileSessionStorage`
39+
for functional tests. These do not interact with global session ini
40+
configuration values, session functions or `$_SESSION` superglobal. This means
41+
they can be configured directly allowing multiple instances to work without
42+
conflicting in the same PHP process.
43+
* [BC BREAK] Removed the `close()` method from the `Session` class, as this is
44+
now redundant.
45+
* Deprecated the following methods from the Session class: `setFlash()`, `setFlashes()`
46+
`getFlash()`, `hasFlash()`, and `removeFlash()`. Use `getFlashBag()` instead
47+
which returns a `FlashBagInterface`.
48+
* `Session->clear()` now only clears session attributes as before it cleared
49+
flash messages and attributes. `Session->getFlashBag()->all()` clears flashes now.
50+
* Session data is now managed by `SessionBagInterface` to better encapsulate
51+
session data.
52+
* Refactored session attribute and flash messages system to their own
53+
`SessionBagInterface` implementations.
54+
* Added `FlashBag`. Flashes expire when retrieved by `get()` or `all()`. This
55+
implementation is ESI compatible.
56+
* Added `AutoExpireFlashBag` (default) to replicate Symfony 2.0.x auto expire
57+
behaviour of messages auto expiring after one page page load. Messages must
58+
be retrieved by `get()` or `all()`.
59+
* Added `Symfony\Component\HttpFoundation\Attribute\AttributeBag` to replicate
60+
attributes storage behaviour from 2.0.x (default).
61+
* Added `Symfony\Component\HttpFoundation\Attribute\NamespacedAttributeBag` for
62+
namespace session attributes.
63+
* Flash API can stores messages in an array so there may be multiple messages
64+
per flash type. The old `Session` class API remains without BC break as it
65+
will allow single messages as before.
66+
* Added basic session meta-data to the session to record session create time,
67+
last updated time, and the lifetime of the session cookie that was provided
68+
to the client.
69+
* Request::getClientIp() method doesn't take a parameter anymore but bases
70+
itself on the trustProxy parameter.
71+
* Added isMethod() to Request object.
72+
* [BC BREAK] The methods `getPathInfo()`, `getBaseUrl()` and `getBasePath()` of
73+
a `Request` now all return a raw value (vs a urldecoded value before). Any call
74+
to one of these methods must be checked and wrapped in a `rawurldecode()` if
75+
needed.

laravel/vendor/Symfony/Component/HttpFoundation/Cookie.php

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ class Cookie
3131
/**
3232
* Constructor.
3333
*
34-
* @param string $name The name of the cookie
35-
* @param string $value The value of the cookie
36-
* @param integer|string|\DateTime $expire The time the cookie expires
37-
* @param string $path The path on the server in which the cookie will be available on
38-
* @param string $domain The domain that the cookie is available to
39-
* @param Boolean $secure Whether the cookie should only be transmitted over a secure HTTPS connection from the client
40-
* @param Boolean $httpOnly Whether the cookie will be made accessible only through the HTTP protocol
34+
* @param string $name The name of the cookie
35+
* @param string $value The value of the cookie
36+
* @param integer|string|\DateTime $expire The time the cookie expires
37+
* @param string $path The path on the server in which the cookie will be available on
38+
* @param string $domain The domain that the cookie is available to
39+
* @param Boolean $secure Whether the cookie should only be transmitted over a secure HTTPS connection from the client
40+
* @param Boolean $httpOnly Whether the cookie will be made accessible only through the HTTP protocol
4141
*
4242
* @api
4343
*/
@@ -72,6 +72,11 @@ public function __construct($name, $value = null, $expire = 0, $path = '/', $dom
7272
$this->httpOnly = (Boolean) $httpOnly;
7373
}
7474

75+
/**
76+
* Returns the cookie as a string.
77+
*
78+
* @return string The cookie
79+
*/
7580
public function __toString()
7681
{
7782
$str = urlencode($this->getName()).'=';

laravel/vendor/Symfony/Component/HttpFoundation/File/Exception/AccessDeniedException.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
/**
1515
* Thrown when the access on a file was denied.
1616
*
17-
* @author Bernhard Schussek <bernhard.schussek@symfony.com>
17+
* @author Bernhard Schussek <bschussek@gmail.com>
1818
*/
1919
class AccessDeniedException extends FileException
2020
{
2121
/**
2222
* Constructor.
2323
*
24-
* @param string $path The path to the accessed file
24+
* @param string $path The path to the accessed file
2525
*/
2626
public function __construct($path)
2727
{

laravel/vendor/Symfony/Component/HttpFoundation/File/Exception/FileException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
/**
1515
* Thrown when an error occurred in the component File
1616
*
17-
* @author Bernhard Schussek <bernhard.schussek@symfony.com>
17+
* @author Bernhard Schussek <bschussek@gmail.com>
1818
*/
1919
class FileException extends \RuntimeException
2020
{

laravel/vendor/Symfony/Component/HttpFoundation/File/Exception/FileNotFoundException.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
/**
1515
* Thrown when a file was not found
1616
*
17-
* @author Bernhard Schussek <bernhard.schussek@symfony.com>
17+
* @author Bernhard Schussek <bschussek@gmail.com>
1818
*/
1919
class FileNotFoundException extends FileException
2020
{
2121
/**
2222
* Constructor.
2323
*
24-
* @param string $path The path to the file that was not found
24+
* @param string $path The path to the file that was not found
2525
*/
2626
public function __construct($path)
2727
{

laravel/vendor/Symfony/Component/HttpFoundation/File/Exception/UploadException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
/**
1515
* Thrown when an error occurred during file upload
1616
*
17-
* @author Bernhard Schussek <bernhard.schussek@symfony.com>
17+
* @author Bernhard Schussek <bschussek@gmail.com>
1818
*/
1919
class UploadException extends FileException
2020
{

laravel/vendor/Symfony/Component/HttpFoundation/File/File.php

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
/**
2020
* A file in the file system.
2121
*
22-
* @author Bernhard Schussek <bernhard.schussek@symfony.com>
22+
* @author Bernhard Schussek <bschussek@gmail.com>
2323
*
2424
* @api
2525
*/
@@ -106,6 +106,20 @@ public function getExtension()
106106
* @api
107107
*/
108108
public function move($directory, $name = null)
109+
{
110+
$target = $this->getTargetFile($directory, $name);
111+
112+
if (!@rename($this->getPathname(), $target)) {
113+
$error = error_get_last();
114+
throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s)', $this->getPathname(), $target, strip_tags($error['message'])));
115+
}
116+
117+
@chmod($target, 0666 & ~umask());
118+
119+
return $target;
120+
}
121+
122+
protected function getTargetFile($directory, $name = null)
109123
{
110124
if (!is_dir($directory)) {
111125
if (false === @mkdir($directory, 0777, true)) {
@@ -115,15 +129,24 @@ public function move($directory, $name = null)
115129
throw new FileException(sprintf('Unable to write in the "%s" directory', $directory));
116130
}
117131

118-
$target = $directory.DIRECTORY_SEPARATOR.(null === $name ? $this->getBasename() : basename($name));
132+
$target = $directory.DIRECTORY_SEPARATOR.(null === $name ? $this->getBasename() : $this->getName($name));
119133

120-
if (!@rename($this->getPathname(), $target)) {
121-
$error = error_get_last();
122-
throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s)', $this->getPathname(), $target, strip_tags($error['message'])));
123-
}
134+
return new File($target, false);
135+
}
124136

125-
chmod($target, 0666);
137+
/**
138+
* Returns locale independent base name of the given path.
139+
*
140+
* @param string $name The new file name
141+
*
142+
* @return string containing
143+
*/
144+
protected function getName($name)
145+
{
146+
$originalName = str_replace('\\', '/', $name);
147+
$pos = strrpos($originalName, '/');
148+
$originalName = false === $pos ? $originalName : substr($originalName, $pos + 1);
126149

127-
return new File($target);
150+
return $originalName;
128151
}
129152
}

laravel/vendor/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesser.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,14 @@ class ExtensionGuesser implements ExtensionGuesserInterface
3030
{
3131
/**
3232
* The singleton instance
33+
*
3334
* @var ExtensionGuesser
3435
*/
35-
static private $instance = null;
36+
private static $instance = null;
3637

3738
/**
3839
* All registered ExtensionGuesserInterface instances
40+
*
3941
* @var array
4042
*/
4143
protected $guessers = array();
@@ -45,7 +47,7 @@ class ExtensionGuesser implements ExtensionGuesserInterface
4547
*
4648
* @return ExtensionGuesser
4749
*/
48-
static public function getInstance()
50+
public static function getInstance()
4951
{
5052
if (null === self::$instance) {
5153
self::$instance = new self();
@@ -82,8 +84,8 @@ public function register(ExtensionGuesserInterface $guesser)
8284
* returns a value that is not NULL, this method terminates and returns the
8385
* value.
8486
*
85-
* @param string $mimeType The mime type
86-
* @return string The guessed extension or NULL, if none could be guessed
87+
* @param string $mimeType The mime type
88+
* @return string The guessed extension or NULL, if none could be guessed
8789
*/
8890
public function guess($mimeType)
8991
{

laravel/vendor/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesserInterface.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ interface ExtensionGuesserInterface
1919
/**
2020
* Makes a best guess for a file extension, given a mime type
2121
*
22-
* @param string $mimeType The mime type
23-
* @return string The guessed extension or NULL, if none could be guessed
22+
* @param string $mimeType The mime type
23+
* @return string The guessed extension or NULL, if none could be guessed
2424
*/
25-
function guess($mimeType);
25+
public function guess($mimeType);
2626
}

laravel/vendor/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
/**
1818
* Guesses the mime type with the binary "file" (only available on *nix)
1919
*
20-
* @author Bernhard Schussek <bernhard.schussek@symfony.com>
20+
* @author Bernhard Schussek <bschussek@gmail.com>
2121
*/
2222
class FileBinaryMimeTypeGuesser implements MimeTypeGuesserInterface
2323
{
@@ -43,15 +43,13 @@ public function __construct($cmd = 'file -b --mime %s 2>/dev/null')
4343
*
4444
* @return Boolean
4545
*/
46-
static public function isSupported()
46+
public static function isSupported()
4747
{
4848
return !defined('PHP_WINDOWS_VERSION_BUILD');
4949
}
5050

5151
/**
52-
* Guesses the mime type of the file with the given path
53-
*
54-
* @see MimeTypeGuesserInterface::guess()
52+
* {@inheritdoc}
5553
*/
5654
public function guess($path)
5755
{

laravel/vendor/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
/**
1818
* Guesses the mime type using the PECL extension FileInfo
1919
*
20-
* @author Bernhard Schussek <bernhard.schussek@symfony.com>
20+
* @author Bernhard Schussek <bschussek@gmail.com>
2121
*/
2222
class FileinfoMimeTypeGuesser implements MimeTypeGuesserInterface
2323
{
@@ -26,15 +26,13 @@ class FileinfoMimeTypeGuesser implements MimeTypeGuesserInterface
2626
*
2727
* @return Boolean
2828
*/
29-
static public function isSupported()
29+
public static function isSupported()
3030
{
3131
return function_exists('finfo_open');
3232
}
3333

3434
/**
35-
* Guesses the mime type of the file with the given path
36-
*
37-
* @see MimeTypeGuesserInterface::guess()
35+
* {@inheritdoc}
3836
*/
3937
public function guess($path)
4038
{

laravel/vendor/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Symfony\Component\HttpFoundation\File\Mimetype;
12+
namespace Symfony\Component\HttpFoundation\File\MimeType;
1313

1414
/**
1515
* Provides a best-guess mapping of mime type to file extension.
@@ -542,6 +542,7 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface
542542
'application/x-pkcs7-certificates' => 'p7b',
543543
'application/x-pkcs7-certreqresp' => 'p7r',
544544
'application/x-rar-compressed' => 'rar',
545+
'application/x-rar' => 'rar',
545546
'application/x-sh' => 'sh',
546547
'application/x-shar' => 'shar',
547548
'application/x-shockwave-flash' => 'swf',
@@ -730,11 +731,7 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface
730731
);
731732

732733
/**
733-
* Returns the extension based on the mime type.
734-
*
735-
* If the mime type is unknown, returns null.
736-
*
737-
* @return string|null The guessed extension or null if it cannot be guessed
734+
* {@inheritdoc}
738735
*/
739736
public function guess($mimeType)
740737
{

0 commit comments

Comments
 (0)