Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yeray Santana Hualde
syncEnrollments
Commits
cb567c5e
Commit
cb567c5e
authored
Jan 06, 2013
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated Symfony HttpFoundation to 2.1.6.
parent
f754e1fa
Changes
55
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
55 changed files
with
1755 additions
and
802 deletions
+1755
-802
CHANGELOG.md
laravel/vendor/Symfony/Component/HttpFoundation/CHANGELOG.md
+75
-0
Cookie.php
laravel/vendor/Symfony/Component/HttpFoundation/Cookie.php
+12
-7
AccessDeniedException.php
...t/HttpFoundation/File/Exception/AccessDeniedException.php
+2
-2
FileException.php
...Component/HttpFoundation/File/Exception/FileException.php
+1
-1
FileNotFoundException.php
...t/HttpFoundation/File/Exception/FileNotFoundException.php
+2
-2
UploadException.php
...mponent/HttpFoundation/File/Exception/UploadException.php
+1
-1
File.php
...vel/vendor/Symfony/Component/HttpFoundation/File/File.php
+31
-8
ExtensionGuesser.php
...mponent/HttpFoundation/File/MimeType/ExtensionGuesser.php
+6
-4
ExtensionGuesserInterface.php
...ttpFoundation/File/MimeType/ExtensionGuesserInterface.php
+3
-3
FileBinaryMimeTypeGuesser.php
...ttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php
+3
-5
FileinfoMimeTypeGuesser.php
.../HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php
+3
-5
MimeTypeExtensionGuesser.php
...HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php
+3
-6
MimeTypeGuesser.php
...omponent/HttpFoundation/File/MimeType/MimeTypeGuesser.php
+7
-4
MimeTypeGuesserInterface.php
...HttpFoundation/File/MimeType/MimeTypeGuesserInterface.php
+6
-3
UploadedFile.php
...or/Symfony/Component/HttpFoundation/File/UploadedFile.php
+20
-7
FileBag.php
laravel/vendor/Symfony/Component/HttpFoundation/FileBag.php
+9
-12
HeaderBag.php
...vel/vendor/Symfony/Component/HttpFoundation/HeaderBag.php
+30
-11
JsonResponse.php
.../vendor/Symfony/Component/HttpFoundation/JsonResponse.php
+72
-8
ParameterBag.php
.../vendor/Symfony/Component/HttpFoundation/ParameterBag.php
+30
-8
README.md
laravel/vendor/Symfony/Component/HttpFoundation/README.md
+2
-3
RedirectResponse.php
...dor/Symfony/Component/HttpFoundation/RedirectResponse.php
+37
-18
Request.php
laravel/vendor/Symfony/Component/HttpFoundation/Request.php
+359
-138
RequestMatcher.php
...endor/Symfony/Component/HttpFoundation/RequestMatcher.php
+33
-17
RequestMatcherInterface.php
...fony/Component/HttpFoundation/RequestMatcherInterface.php
+2
-2
SessionHandlerInterface.php
...ttpFoundation/Resources/stubs/SessionHandlerInterface.php
+9
-7
Response.php
laravel/vendor/Symfony/Component/HttpFoundation/Response.php
+72
-25
ResponseHeaderBag.php
...or/Symfony/Component/HttpFoundation/ResponseHeaderBag.php
+5
-5
ServerBag.php
...vel/vendor/Symfony/Component/HttpFoundation/ServerBag.php
+39
-5
AttributeBag.php
...mponent/HttpFoundation/Session/Attribute/AttributeBag.php
+21
-1
AttributeBagInterface.php
...ttpFoundation/Session/Attribute/AttributeBagInterface.php
+6
-6
AutoExpireFlashBag.php
...onent/HttpFoundation/Session/Flash/AutoExpireFlashBag.php
+15
-10
FlashBag.php
...mfony/Component/HttpFoundation/Session/Flash/FlashBag.php
+34
-6
FlashBagInterface.php
...ponent/HttpFoundation/Session/Flash/FlashBagInterface.php
+22
-14
Session.php
...ndor/Symfony/Component/HttpFoundation/Session/Session.php
+73
-26
SessionBagInterface.php
.../Component/HttpFoundation/Session/SessionBagInterface.php
+4
-4
SessionInterface.php
...ony/Component/HttpFoundation/Session/SessionInterface.php
+57
-16
MemcacheSessionHandler.php
...dation/Session/Storage/Handler/MemcacheSessionHandler.php
+26
-56
MemcachedSessionHandler.php
...ation/Session/Storage/Handler/MemcachedSessionHandler.php
+33
-48
MongoDbSessionHandler.php
...ndation/Session/Storage/Handler/MongoDbSessionHandler.php
+150
-0
NativeFileSessionHandler.php
...tion/Session/Storage/Handler/NativeFileSessionHandler.php
+21
-4
NativeMemcacheSessionHandler.php
.../Session/Storage/Handler/NativeMemcacheSessionHandler.php
+0
-65
NativeMemcachedSessionHandler.php
...Session/Storage/Handler/NativeMemcachedSessionHandler.php
+0
-64
NativeSqliteSessionHandler.php
...on/Session/Storage/Handler/NativeSqliteSessionHandler.php
+0
-58
NullSessionHandler.php
...Foundation/Session/Storage/Handler/NullSessionHandler.php
+1
-1
PdoSessionHandler.php
...pFoundation/Session/Storage/Handler/PdoSessionHandler.php
+58
-38
MetadataBag.php
.../Component/HttpFoundation/Session/Storage/MetadataBag.php
+160
-0
MockArraySessionStorage.php
...ttpFoundation/Session/Storage/MockArraySessionStorage.php
+55
-5
MockFileSessionStorage.php
...HttpFoundation/Session/Storage/MockFileSessionStorage.php
+25
-8
NativeSessionStorage.php
...t/HttpFoundation/Session/Storage/NativeSessionStorage.php
+77
-24
AbstractProxy.php
...nt/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php
+3
-3
NativeProxy.php
...nent/HttpFoundation/Session/Storage/Proxy/NativeProxy.php
+1
-1
SessionHandlerProxy.php
...pFoundation/Session/Storage/Proxy/SessionHandlerProxy.php
+1
-1
SessionStorageInterface.php
...ttpFoundation/Session/Storage/SessionStorageInterface.php
+31
-11
StreamedResponse.php
...dor/Symfony/Component/HttpFoundation/StreamedResponse.php
+5
-9
composer.json
...vel/vendor/Symfony/Component/HttpFoundation/composer.json
+2
-6
No files found.
laravel/vendor/Symfony/Component/HttpFoundation/CHANGELOG.md
0 → 100755
View file @
cb567c5e
CHANGELOG
=========
2.
1.0
-----
*
added Request::getSchemeAndHttpHost() and Request::getUserInfo()
*
added a fluent interface to the Response class
*
added Request::isProxyTrusted()
*
added JsonResponse
*
added a getTargetUrl method to RedirectResponse
*
added support for streamed responses
*
made Response::prepare() method the place to enforce HTTP specification
*
[
BC BREAK
]
moved management of the locale from the Session class to the Request class
*
added a generic access to the PHP built-in filter mechanism: ParameterBag::filter()
*
made FileBinaryMimeTypeGuesser command configurable
*
added Request::getUser() and Request::getPassword()
*
added support for the PATCH method in Request
*
removed the ContentTypeMimeTypeGuesser class as it is deprecated and never used on PHP 5.3
*
added ResponseHeaderBag::makeDisposition() (implements RFC 6266)
*
made mimetype to extension conversion configurable
*
[
BC BREAK
]
Moved all session related classes and interfaces into own namespace, as
`Symfony\Component\HttpFoundation\Session`
and renamed classes accordingly.
Session handlers are located in the subnamespace
`Symfony\Component\HttpFoundation\Session\Handler`
.
*
SessionHandlers must implement
`\SessionHandlerInterface`
or extend from the
`Symfony\Component\HttpFoundation\Storage\Handler\NativeSessionHandler`
base class.
*
Added internal storage driver proxy mechanism for forward compatibility with
PHP 5.4
`\SessionHandler`
class.
*
Added session handlers for custom Memcache, Memcached and Null session save handlers.
*
[
BC BREAK
]
Removed
`NativeSessionStorage`
and replaced with
`NativeFileSessionHandler`
.
*
[
BC BREAK
]
`SessionStorageInterface`
methods removed:
`write()`
,
`read()`
and
`remove()`
. Added
`getBag()`
,
`registerBag()`
. The
`NativeSessionStorage`
class
is a mediator for the session storage internals including the session handlers
which do the real work of participating in the internal PHP session workflow.
*
[
BC BREAK
]
Introduced mock implementations of
`SessionStorage`
to enable unit
and functional testing without starting real PHP sessions. Removed
`ArraySessionStorage`
, and replaced with
`MockArraySessionStorage`
for unit
tests; removed
`FilesystemSessionStorage`
, and replaced with
`MockFileSessionStorage`
for functional tests. These do not interact with global session ini
configuration values, session functions or
`$_SESSION`
superglobal. This means
they can be configured directly allowing multiple instances to work without
conflicting in the same PHP process.
*
[
BC BREAK
]
Removed the
`close()`
method from the
`Session`
class, as this is
now redundant.
*
Deprecated the following methods from the Session class:
`setFlash()`
,
`setFlashes()`
`getFlash()`
,
`hasFlash()`
, and
`removeFlash()`
. Use
`getFlashBag()`
instead
which returns a
`FlashBagInterface`
.
*
`Session->clear()`
now only clears session attributes as before it cleared
flash messages and attributes.
`Session->getFlashBag()->all()`
clears flashes now.
*
Session data is now managed by
`SessionBagInterface`
to better encapsulate
session data.
*
Refactored session attribute and flash messages system to their own
`SessionBagInterface`
implementations.
*
Added
`FlashBag`
. Flashes expire when retrieved by
`get()`
or
`all()`
. This
implementation is ESI compatible.
*
Added
`AutoExpireFlashBag`
(default) to replicate Symfony 2.0.x auto expire
behaviour of messages auto expiring after one page page load. Messages must
be retrieved by
`get()`
or
`all()`
.
*
Added
`Symfony\Component\HttpFoundation\Attribute\AttributeBag`
to replicate
attributes storage behaviour from 2.0.x (default).
*
Added
`Symfony\Component\HttpFoundation\Attribute\NamespacedAttributeBag`
for
namespace session attributes.
*
Flash API can stores messages in an array so there may be multiple messages
per flash type. The old
`Session`
class API remains without BC break as it
will allow single messages as before.
*
Added basic session meta-data to the session to record session create time,
last updated time, and the lifetime of the session cookie that was provided
to the client.
*
Request::getClientIp() method doesn't take a parameter anymore but bases
itself on the trustProxy parameter.
*
Added isMethod() to Request object.
*
[
BC BREAK
]
The methods
`getPathInfo()`
,
`getBaseUrl()`
and
`getBasePath()`
of
a
`Request`
now all return a raw value (vs a urldecoded value before). Any call
to one of these methods must be checked and wrapped in a
`rawurldecode()`
if
needed.
laravel/vendor/Symfony/Component/HttpFoundation/Cookie.php
View file @
cb567c5e
...
...
@@ -72,6 +72,11 @@ class Cookie
$this
->
httpOnly
=
(
Boolean
)
$httpOnly
;
}
/**
* Returns the cookie as a string.
*
* @return string The cookie
*/
public
function
__toString
()
{
$str
=
urlencode
(
$this
->
getName
())
.
'='
;
...
...
laravel/vendor/Symfony/Component/HttpFoundation/File/Exception/AccessDeniedException.php
View file @
cb567c5e
...
...
@@ -14,7 +14,7 @@ namespace Symfony\Component\HttpFoundation\File\Exception;
/**
* Thrown when the access on a file was denied.
*
* @author Bernhard Schussek <b
ernhard.schussek@symfony
.com>
* @author Bernhard Schussek <b
schussek@gmail
.com>
*/
class
AccessDeniedException
extends
FileException
{
...
...
laravel/vendor/Symfony/Component/HttpFoundation/File/Exception/FileException.php
View file @
cb567c5e
...
...
@@ -14,7 +14,7 @@ namespace Symfony\Component\HttpFoundation\File\Exception;
/**
* Thrown when an error occurred in the component File
*
* @author Bernhard Schussek <b
ernhard.schussek@symfony
.com>
* @author Bernhard Schussek <b
schussek@gmail
.com>
*/
class
FileException
extends
\RuntimeException
{
...
...
laravel/vendor/Symfony/Component/HttpFoundation/File/Exception/FileNotFoundException.php
View file @
cb567c5e
...
...
@@ -14,7 +14,7 @@ namespace Symfony\Component\HttpFoundation\File\Exception;
/**
* Thrown when a file was not found
*
* @author Bernhard Schussek <b
ernhard.schussek@symfony
.com>
* @author Bernhard Schussek <b
schussek@gmail
.com>
*/
class
FileNotFoundException
extends
FileException
{
...
...
laravel/vendor/Symfony/Component/HttpFoundation/File/Exception/UploadException.php
View file @
cb567c5e
...
...
@@ -14,7 +14,7 @@ namespace Symfony\Component\HttpFoundation\File\Exception;
/**
* Thrown when an error occurred during file upload
*
* @author Bernhard Schussek <b
ernhard.schussek@symfony
.com>
* @author Bernhard Schussek <b
schussek@gmail
.com>
*/
class
UploadException
extends
FileException
{
...
...
laravel/vendor/Symfony/Component/HttpFoundation/File/File.php
View file @
cb567c5e
...
...
@@ -19,7 +19,7 @@ use Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesser;
/**
* A file in the file system.
*
* @author Bernhard Schussek <b
ernhard.schussek@symfony
.com>
* @author Bernhard Schussek <b
schussek@gmail
.com>
*
* @api
*/
...
...
@@ -106,6 +106,20 @@ class File extends \SplFileInfo
* @api
*/
public
function
move
(
$directory
,
$name
=
null
)
{
$target
=
$this
->
getTargetFile
(
$directory
,
$name
);
if
(
!@
rename
(
$this
->
getPathname
(),
$target
))
{
$error
=
error_get_last
();
throw
new
FileException
(
sprintf
(
'Could not move the file "%s" to "%s" (%s)'
,
$this
->
getPathname
(),
$target
,
strip_tags
(
$error
[
'message'
])));
}
@
chmod
(
$target
,
0666
&
~
umask
());
return
$target
;
}
protected
function
getTargetFile
(
$directory
,
$name
=
null
)
{
if
(
!
is_dir
(
$directory
))
{
if
(
false
===
@
mkdir
(
$directory
,
0777
,
true
))
{
...
...
@@ -115,15 +129,24 @@ class File extends \SplFileInfo
throw
new
FileException
(
sprintf
(
'Unable to write in the "%s" directory'
,
$directory
));
}
$target
=
$directory
.
DIRECTORY_SEPARATOR
.
(
null
===
$name
?
$this
->
getBasename
()
:
basen
ame
(
$name
));
$target
=
$directory
.
DIRECTORY_SEPARATOR
.
(
null
===
$name
?
$this
->
getBasename
()
:
$this
->
getN
ame
(
$name
));
if
(
!@
rename
(
$this
->
getPathname
(),
$target
))
{
$error
=
error_get_last
();
throw
new
FileException
(
sprintf
(
'Could not move the file "%s" to "%s" (%s)'
,
$this
->
getPathname
(),
$target
,
strip_tags
(
$error
[
'message'
])));
return
new
File
(
$target
,
false
);
}
chmod
(
$target
,
0666
);
/**
* Returns locale independent base name of the given path.
*
* @param string $name The new file name
*
* @return string containing
*/
protected
function
getName
(
$name
)
{
$originalName
=
str_replace
(
'\\'
,
'/'
,
$name
);
$pos
=
strrpos
(
$originalName
,
'/'
);
$originalName
=
false
===
$pos
?
$originalName
:
substr
(
$originalName
,
$pos
+
1
);
return
new
File
(
$target
)
;
return
$originalName
;
}
}
laravel/vendor/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesser.php
View file @
cb567c5e
...
...
@@ -30,12 +30,14 @@ class ExtensionGuesser implements ExtensionGuesserInterface
{
/**
* The singleton instance
*
* @var ExtensionGuesser
*/
static
private
$instance
=
null
;
private
static
$instance
=
null
;
/**
* All registered ExtensionGuesserInterface instances
*
* @var array
*/
protected
$guessers
=
array
();
...
...
@@ -45,7 +47,7 @@ class ExtensionGuesser implements ExtensionGuesserInterface
*
* @return ExtensionGuesser
*/
static
publ
ic
function
getInstance
()
public
stat
ic
function
getInstance
()
{
if
(
null
===
self
::
$instance
)
{
self
::
$instance
=
new
self
();
...
...
laravel/vendor/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesserInterface.php
View file @
cb567c5e
...
...
@@ -22,5 +22,5 @@ interface ExtensionGuesserInterface
* @param string $mimeType The mime type
* @return string The guessed extension or NULL, if none could be guessed
*/
function
guess
(
$mimeType
);
public
function
guess
(
$mimeType
);
}
laravel/vendor/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php
View file @
cb567c5e
...
...
@@ -17,7 +17,7 @@ use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException;
/**
* Guesses the mime type with the binary "file" (only available on *nix)
*
* @author Bernhard Schussek <b
ernhard.schussek@symfony
.com>
* @author Bernhard Schussek <b
schussek@gmail
.com>
*/
class
FileBinaryMimeTypeGuesser
implements
MimeTypeGuesserInterface
{
...
...
@@ -43,15 +43,13 @@ class FileBinaryMimeTypeGuesser implements MimeTypeGuesserInterface
*
* @return Boolean
*/
static
publ
ic
function
isSupported
()
public
stat
ic
function
isSupported
()
{
return
!
defined
(
'PHP_WINDOWS_VERSION_BUILD'
);
}
/**
* Guesses the mime type of the file with the given path
*
* @see MimeTypeGuesserInterface::guess()
* {@inheritdoc}
*/
public
function
guess
(
$path
)
{
...
...
laravel/vendor/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php
View file @
cb567c5e
...
...
@@ -17,7 +17,7 @@ use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException;
/**
* Guesses the mime type using the PECL extension FileInfo
*
* @author Bernhard Schussek <b
ernhard.schussek@symfony
.com>
* @author Bernhard Schussek <b
schussek@gmail
.com>
*/
class
FileinfoMimeTypeGuesser
implements
MimeTypeGuesserInterface
{
...
...
@@ -26,15 +26,13 @@ class FileinfoMimeTypeGuesser implements MimeTypeGuesserInterface
*
* @return Boolean
*/
static
publ
ic
function
isSupported
()
public
stat
ic
function
isSupported
()
{
return
function_exists
(
'finfo_open'
);
}
/**
* Guesses the mime type of the file with the given path
*
* @see MimeTypeGuesserInterface::guess()
* {@inheritdoc}
*/
public
function
guess
(
$path
)
{
...
...
laravel/vendor/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php
View file @
cb567c5e
...
...
@@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace
Symfony\Component\HttpFoundation\File\Mime
t
ype
;
namespace
Symfony\Component\HttpFoundation\File\Mime
T
ype
;
/**
* Provides a best-guess mapping of mime type to file extension.
...
...
@@ -542,6 +542,7 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface
'application/x-pkcs7-certificates'
=>
'p7b'
,
'application/x-pkcs7-certreqresp'
=>
'p7r'
,
'application/x-rar-compressed'
=>
'rar'
,
'application/x-rar'
=>
'rar'
,
'application/x-sh'
=>
'sh'
,
'application/x-shar'
=>
'shar'
,
'application/x-shockwave-flash'
=>
'swf'
,
...
...
@@ -730,11 +731,7 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface
);
/**
* Returns the extension based on the mime type.
*
* If the mime type is unknown, returns null.
*
* @return string|null The guessed extension or null if it cannot be guessed
* {@inheritdoc}
*/
public
function
guess
(
$mimeType
)
{
...
...
laravel/vendor/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php
View file @
cb567c5e
...
...
@@ -11,6 +11,7 @@
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
;
...
...
@@ -28,18 +29,20 @@ use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException;
*
* The last registered guesser is preferred over previously registered ones.
*
* @author Bernhard Schussek <b
ernhard.schussek@symfony
.com>
* @author Bernhard Schussek <b
schussek@gmail
.com>
*/
class
MimeTypeGuesser
implements
MimeTypeGuesserInterface
{
/**
* The singleton instance
*
* @var MimeTypeGuesser
*/
static
private
$instance
=
null
;
private
static
$instance
=
null
;
/**
* All registered MimeTypeGuesserInterface instances
*
* @var array
*/
protected
$guessers
=
array
();
...
...
@@ -49,7 +52,7 @@ class MimeTypeGuesser implements MimeTypeGuesserInterface
*
* @return MimeTypeGuesser
*/
static
publ
ic
function
getInstance
()
public
stat
ic
function
getInstance
()
{
if
(
null
===
self
::
$instance
)
{
self
::
$instance
=
new
self
();
...
...
laravel/vendor/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesserInterface.php
View file @
cb567c5e
...
...
@@ -11,10 +11,13 @@
namespace
Symfony\Component\HttpFoundation\File\MimeType
;
use
Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException
;
use
Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException
;
/**
* Guesses the mime type of a file
*
* @author Bernhard Schussek <b
ernhard.schussek@symfony
.com>
* @author Bernhard Schussek <b
schussek@gmail
.com>
*/
interface
MimeTypeGuesserInterface
{
...
...
@@ -28,5 +31,5 @@ interface MimeTypeGuesserInterface
* @throws FileNotFoundException If the file does not exist
* @throws AccessDeniedException If the file could not be read
*/
function
guess
(
$path
);
public
function
guess
(
$path
);
}
laravel/vendor/Symfony/Component/HttpFoundation/File/UploadedFile.php
View file @
cb567c5e
...
...
@@ -17,7 +17,7 @@ use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException;
/**
* A file uploaded through a form.
*
* @author Bernhard Schussek <b
ernhard.schussek@symfony
.com>
* @author Bernhard Schussek <b
schussek@gmail
.com>
* @author Florian Eckerstorfer <florian@eckerstorfer.org>
* @author Fabien Potencier <fabien@symfony.com>
*
...
...
@@ -94,7 +94,7 @@ class UploadedFile extends File
throw
new
FileException
(
sprintf
(
'Unable to create UploadedFile because "file_uploads" is disabled in your php.ini file (%s)'
,
get_cfg_var
(
'cfg_file_path'
)));
}
$this
->
originalName
=
basen
ame
(
$originalName
);
$this
->
originalName
=
$this
->
getN
ame
(
$originalName
);
$this
->
mimeType
=
$mimeType
?:
'application/octet-stream'
;
$this
->
size
=
$size
;
$this
->
error
=
$error
?:
UPLOAD_ERR_OK
;
...
...
@@ -189,8 +189,21 @@ class UploadedFile extends File
*/
public
function
move
(
$directory
,
$name
=
null
)
{
if
(
$this
->
isValid
()
&&
(
$this
->
test
||
is_uploaded_file
(
$this
->
getPathname
())))
{
if
(
$this
->
isValid
())
{
if
(
$this
->
test
)
{
return
parent
::
move
(
$directory
,
$name
);
}
elseif
(
is_uploaded_file
(
$this
->
getPathname
()))
{
$target
=
$this
->
getTargetFile
(
$directory
,
$name
);
if
(
!@
move_uploaded_file
(
$this
->
getPathname
(),
$target
))
{
$error
=
error_get_last
();
throw
new
FileException
(
sprintf
(
'Could not move the file "%s" to "%s" (%s)'
,
$this
->
getPathname
(),
$target
,
strip_tags
(
$error
[
'message'
])));
}
@
chmod
(
$target
,
0666
&
~
umask
());
return
$target
;
}
}
throw
new
FileException
(
sprintf
(
'The file "%s" has not been uploaded via Http'
,
$this
->
getPathname
()));
...
...
@@ -199,9 +212,9 @@ class UploadedFile extends File
/**
* Returns the maximum size of an uploaded file as configured in php.ini
*
* @return
type
The maximum size of an uploaded file in bytes
* @return
int
The maximum size of an uploaded file in bytes
*/
static
publ
ic
function
getMaxFilesize
()
public
stat
ic
function
getMaxFilesize
()
{
$max
=
trim
(
ini_get
(
'upload_max_filesize'
));
...
...
laravel/vendor/Symfony/Component/HttpFoundation/FileBag.php
View file @
cb567c5e
...
...
@@ -23,7 +23,7 @@ use Symfony\Component\HttpFoundation\File\UploadedFile;
*/
class
FileBag
extends
ParameterBag
{
static
private
$fileKeys
=
array
(
'error'
,
'name'
,
'size'
,
'tmp_name'
,
'type'
);
private
static
$fileKeys
=
array
(
'error'
,
'name'
,
'size'
,
'tmp_name'
,
'type'
);
/**
* Constructor.
...
...
@@ -38,8 +38,7 @@ class FileBag extends ParameterBag
}
/**
* (non-PHPdoc)
* @see Symfony\Component\HttpFoundation\ParameterBag::replace()
* {@inheritdoc}
*
* @api
*/
...
...
@@ -50,23 +49,21 @@ class FileBag extends ParameterBag
}
/**
* (non-PHPdoc)
* @see Symfony\Component\HttpFoundation\ParameterBag::set()
* {@inheritdoc}
*
* @api
*/
public
function
set
(
$key
,
$value
)
{
if
(
is_array
(
$value
)
||
$value
instanceof
UploadedFile
)
{
parent
::
set
(
$key
,
$this
->
convertFileInformation
(
$value
));
}
else
{
if
(
!
is_array
(
$value
)
&&
!
$value
instanceof
UploadedFile
)
{
throw
new
\InvalidArgumentException
(
'An uploaded file must be an array or an instance of UploadedFile.'
);
}
parent
::
set
(
$key
,
$this
->
convertFileInformation
(
$value
));
}
/**
* (non-PHPdoc)
* @see Symfony\Component\HttpFoundation\ParameterBag::add()
* {@inheritdoc}
*
* @api
*/
...
...
laravel/vendor/Symfony/Component/HttpFoundation/HeaderBag.php
View file @
cb567c5e
...
...
@@ -18,7 +18,7 @@ namespace Symfony\Component\HttpFoundation;
*
* @api
*/
class
HeaderBag
class
HeaderBag
implements
\IteratorAggregate
,
\Countable
{
protected
$headers
;
protected
$cacheControl
;
...
...
@@ -50,16 +50,13 @@ class HeaderBag
return
''
;
}
$beautifier
=
function
(
$name
)
{
return
preg_replace_callback
(
'/\-(.)/'
,
function
(
$match
)
{
return
'-'
.
strtoupper
(
$match
[
1
]);
},
ucfirst
(
$name
));
};
$max
=
max
(
array_map
(
'strlen'
,
array_keys
(
$this
->
headers
)))
+
1
;
$content
=
''
;
ksort
(
$this
->
headers
);
foreach
(
$this
->
headers
as
$name
=>
$values
)
{
$name
=
implode
(
'-'
,
array_map
(
'ucfirst'
,
explode
(
'-'
,
$name
)));
foreach
(
$values
as
$value
)
{
$content
.=
sprintf
(
"%-
{
$max
}
s %s
\r\n
"
,
$
beautifier
(
$name
)
.
':'
,
$value
);
$content
.=
sprintf
(
"%-
{
$max
}
s %s
\r\n
"
,
$
name
.
':'
,
$value
);
}
}
...
...
@@ -160,7 +157,7 @@ class HeaderBag
{
$key
=
strtr
(
strtolower
(
$key
),
'_'
,
'-'
);
$values
=
(
array
)
$values
;
$values
=
array_values
((
array
)
$values
)
;
if
(
true
===
$replace
||
!
isset
(
$this
->
headers
[
$key
]))
{
$this
->
headers
[
$key
]
=
$values
;
...
...
@@ -226,7 +223,9 @@ class HeaderBag
* @param string $key The parameter key
* @param \DateTime $default The default value
*
* @return \DateTime The filtered value
* @return null|\DateTime The filtered value
*
* @throws \RuntimeException When the HTTP header is not parseable
*
* @api
*/
...
...
@@ -267,6 +266,26 @@ class HeaderBag
$this
->
set
(
'Cache-Control'
,
$this
->
getCacheControlHeader
());
}
/**
* Returns an iterator for headers.
*
* @return \ArrayIterator An \ArrayIterator instance
*/
public
function
getIterator
()
{
return
new
\ArrayIterator
(
$this
->
headers
);
}
/**
* Returns the number of headers.
*
* @return int The number of headers
*/
public
function
count
()
{
return
count
(
$this
->
headers
);
}
protected
function
getCacheControlHeader
()
{
$parts
=
array
();
...
...
@@ -298,7 +317,7 @@ class HeaderBag
$cacheControl
=
array
();
preg_match_all
(
'#([a-zA-Z][a-zA-Z_-]*)\s*(?:=(?:"([^"]*)"|([^ \t",;]*)))?#'
,
$header
,
$matches
,
PREG_SET_ORDER
);
foreach
(
$matches
as
$match
)
{
$cacheControl
[
strtolower
(
$match
[
1
])]
=
isset
(
$match
[
2
])
&&
$match
[
2
]
?
$match
[
2
]
:
(
isset
(
$match
[
3
])
?
$match
[
3
]
:
true
);
$cacheControl
[
strtolower
(
$match
[
1
])]
=
isset
(
$match
[
3
])
?
$match
[
3
]
:
(
isset
(
$match
[
2
])
?
$match
[
2
]
:
true
);
}
return
$cacheControl
;
...
...
laravel/vendor/Symfony/Component/HttpFoundation/JsonResponse.php
View file @
cb567c5e
...
...
@@ -18,6 +18,9 @@ namespace Symfony\Component\HttpFoundation;
*/
class
JsonResponse
extends
Response
{
protected
$data
;
protected
$callback
;
/**
* Constructor.
*
...
...
@@ -26,24 +29,85 @@ class JsonResponse extends Response
* @param array $headers An array of response headers
*/
public
function
__construct
(
$data
=
array
(),
$status
=
200
,
$headers
=
array
())
{
parent
::
__construct
(
''
,
$status
,
$headers
);
$this
->
setData
(
$data
);
}
/**
* {@inheritDoc}
*/
public
static
function
create
(
$data
=
array
(),
$status
=
200
,
$headers
=
array
())
{
return
new
static
(
$data
,
$status
,
$headers
);
}
/**
* Sets the JSONP callback.
*
* @param string $callback
*
* @return JsonResponse
*/
public
function
setCallback
(
$callback
=
null
)
{
if
(
null
!==
$callback
)
{
// taken from http://www.geekality.net/2011/08/03/valid-javascript-identifier/
$pattern
=
'/^[$_\p{L}][$_\p{L}\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*+$/u'
;
$parts
=
explode
(
'.'
,
$callback
);
foreach
(
$parts
as
$part
)
{
if
(
!
preg_match
(
$pattern
,
$part
))
{
throw
new
\InvalidArgumentException
(
'The callback name is not valid.'
);
}
}
}
$this
->
callback
=
$callback
;
return
$this
->
update
();
}
/**
* Sets the data to be sent as json.
*
* @param mixed $data
*
* @return JsonResponse
*/
public
function
setData
(
$data
=
array
())
{
// root should be JSON object, not array
if
(
is_array
(
$data
)
&&
0
===
count
(
$data
))
{
$data
=
new
\ArrayObject
();
}
parent
::
__construct
(
json_encode
(
$data
),
$status
,
array_merge
(
array
(
'Content-Type'
=>
'application/json'
),
$headers
)
);
// Encode <, >, ', &, and " for RFC4627-compliant JSON, which may also be embedded into HTML.
$this
->
data
=
json_encode
(
$data
,
JSON_HEX_TAG
|
JSON_HEX_APOS
|
JSON_HEX_AMP
|
JSON_HEX_QUOT
);
return
$this
->
update
();
}
/**
* {@inheritDoc}
* Updates the content and headers according to the json data and callback.
*
* @return JsonResponse
*/
static
public
function
create
(
$data
=
array
(),
$status
=
200
,
$headers
=
array
()
)
protected
function
update
(
)
{
return
new
static
(
$data
,
$status
,
$headers
);
if
(
null
!==
$this
->
callback
)
{
// Not using application/javascript for compatibility reasons with older browsers.
$this
->
headers
->
set
(
'Content-Type'
,
'text/javascript'
);
return
$this
->
setContent
(
sprintf
(
'%s(%s);'
,
$this
->
callback
,
$this
->
data
));
}
// Only set the header when there is none or when it equals 'text/javascript' (from a previous update with callback)
// in order to not overwrite a custom definition.
if
(
!
$this
->
headers
->
has
(
'Content-Type'
)
||
'text/javascript'
===
$this
->
headers
->
get
(
'Content-Type'
))
{
$this
->
headers
->
set
(
'Content-Type'
,
'application/json'
);
}
return
$this
->
setContent
(
$this
->
data
);
}
}
laravel/vendor/Symfony/Component/HttpFoundation/ParameterBag.php
View file @
cb567c5e
...
...
@@ -18,7 +18,7 @@ namespace Symfony\Component\HttpFoundation;
*
* @api
*/
class
ParameterBag
class
ParameterBag
implements
\IteratorAggregate
,
\Countable
{
/**
* Parameter storage.
...
...
@@ -94,6 +94,8 @@ class ParameterBag
* @param mixed $default The default value if the parameter key does not exist
* @param boolean $deep If true, a path like foo[bar] will find deeper items
*
* @return mixed
*
* @api
*/
public
function
get
(
$path
,
$default
=
null
,
$deep
=
false
)
...
...
@@ -109,7 +111,7 @@ class ParameterBag
$value
=
$this
->
parameters
[
$root
];
$currentKey
=
null
;
for
(
$i
=
$pos
,
$c
=
strlen
(
$path
);
$i
<
$c
;
$i
++
)
{
for
(
$i
=
$pos
,
$c
=
strlen
(
$path
);
$i
<
$c
;
$i
++
)
{
$char
=
$path
[
$i
];
if
(
'['
===
$char
)
{
...
...
@@ -240,7 +242,7 @@ class ParameterBag
* @param mixed $default The default value if the parameter key does not exist
* @param boolean $deep If true, a path like foo[bar] will find deeper items
*
* @return
string
The filtered value
* @return
integer
The filtered value
*
* @api
*/
...
...
@@ -278,4 +280,24 @@ class ParameterBag
return
filter_var
(
$value
,
$filter
,
$options
);
}
/**
* Returns an iterator for parameters.
*
* @return \ArrayIterator An \ArrayIterator instance
*/
public
function
getIterator
()
{
return
new
\ArrayIterator
(
$this
->
parameters
);
}
/**
* Returns the number of parameters.
*
* @return int The number of parameters
*/
public
function
count
()
{
return
count
(
$this
->
parameters
);
}
}
laravel/vendor/Symfony/Component/HttpFoundation/README.md
View file @
cb567c5e
...
...
@@ -38,10 +38,9 @@ If you are using PHP 5.3.x you must add the following to your autoloader:
$loader->registerPrefixFallback(__DIR__.'/../vendor/symfony/src/Symfony/Component/HttpFoundation/Resources/stubs');
}
Resources
---------
Unit tests
:
You can run the unit tests with the following command
:
https://github.com/symfony/symfony/tree/master/tests/Symfony/Tests/Component/HttpFoundation
phpunit
laravel/vendor/Symfony/Component/HttpFoundation/RedirectResponse.php
View file @
cb567c5e
...
...
@@ -39,24 +39,9 @@ class RedirectResponse extends Response
throw
new
\InvalidArgumentException
(
'Cannot redirect to an empty URL.'
);
}
$this
->
targetUrl
=
$url
;
parent
::
__construct
(
sprintf
(
'<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="refresh" content="1;url=%1$s" />
parent
::
__construct
(
''
,
$status
,
$headers
);
<title>Redirecting to %1$s</title>
</head>
<body>
Redirecting to <a href="%1$s">%1$s</a>.
</body>
</html>'
,
htmlspecialchars
(
$url
,
ENT_QUOTES
,
'UTF-8'
)),
$status
,
array_merge
(
$headers
,
array
(
'Location'
=>
$url
))
);
$this
->
setTargetUrl
(
$url
);
if
(
!
$this
->
isRedirect
())
{
throw
new
\InvalidArgumentException
(
sprintf
(
'The HTTP status code is not a redirect ("%s" given).'
,
$status
));
...
...
@@ -66,7 +51,7 @@ class RedirectResponse extends Response
/**
* {@inheritDoc}
*/
static
publ
ic
function
create
(
$url
=
''
,
$status
=
302
,
$headers
=
array
())
public
stat
ic
function
create
(
$url
=
''
,
$status
=
302
,
$headers
=
array
())
{
return
new
static
(
$url
,
$status
,
$headers
);
}
...
...
@@ -80,4 +65,38 @@ class RedirectResponse extends Response
{
return
$this
->
targetUrl
;
}
/**
* Sets the redirect target of this response.
*
* @param string $url The URL to redirect to
*
* @return RedirectResponse The current response.
*/
public
function
setTargetUrl
(
$url
)
{
if
(
empty
(
$url
))
{
throw
new
\InvalidArgumentException
(
'Cannot redirect to an empty URL.'
);
}
$this
->
targetUrl
=
$url
;
$this
->
setContent
(
sprintf
(
'<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="refresh" content="1;url=%1$s" />
<title>Redirecting to %1$s</title>
</head>
<body>
Redirecting to <a href="%1$s">%1$s</a>.
</body>
</html>'
,
htmlspecialchars
(
$url
,
ENT_QUOTES
,
'UTF-8'
)));
$this
->
headers
->
set
(
'Location'
,
$url
);
return
$this
;
}
}
laravel/vendor/Symfony/Component/HttpFoundation/Request.php
View file @
cb567c5e
This diff is collapsed.
Click to expand it.
laravel/vendor/Symfony/Component/HttpFoundation/RequestMatcher.php
View file @
cb567c5e
...
...
@@ -31,9 +31,9 @@ class RequestMatcher implements RequestMatcherInterface
private
$host
;
/**
* @var
string
* @var
array
*/
private
$methods
;
private
$methods
=
array
()
;
/**
* @var string
...
...
@@ -41,19 +41,26 @@ class RequestMatcher implements RequestMatcherInterface
private
$ip
;
/**
* Attributes.
*
* @var array
*/
private
$attributes
;
private
$attributes
=
array
()
;
/**
* @param string|null $path
* @param string|null $host
* @param string|string[]|null $methods
* @param string|null $ip
* @param array $attributes
*/
public
function
__construct
(
$path
=
null
,
$host
=
null
,
$methods
=
null
,
$ip
=
null
,
array
$attributes
=
array
())
{
$this
->
path
=
$path
;
$this
->
host
=
$host
;
$this
->
methods
=
$methods
;
$this
->
ip
=
$ip
;
$this
->
attributes
=
$attributes
;
$this
->
matchPath
(
$path
);
$this
->
matchHost
(
$host
);
$this
->
matchMethod
(
$methods
);
$this
->
matchIp
(
$ip
);
foreach
(
$attributes
as
$k
=>
$v
)
{
$this
->
matchAttribute
(
$k
,
$v
);
}
}
/**
...
...
@@ -89,11 +96,11 @@ class RequestMatcher implements RequestMatcherInterface
/**
* Adds a check for the HTTP method.
*
* @param string|
array
$method An HTTP method or an array of HTTP methods
* @param string|
string[]|null
$method An HTTP method or an array of HTTP methods
*/
public
function
matchMethod
(
$method
)
{
$this
->
methods
=
array_map
(
'strtoupper'
,
is_array
(
$method
)
?
$method
:
array
(
$method
)
);
$this
->
methods
=
array_map
(
'strtoupper'
,
(
array
)
$method
);
}
/**
...
...
@@ -114,7 +121,7 @@ class RequestMatcher implements RequestMatcherInterface
*/
public
function
matches
(
Request
$request
)
{
if
(
null
!==
$this
->
methods
&&
!
in_array
(
$request
->
getMethod
(),
$this
->
methods
))
{
if
(
$this
->
methods
&&
!
in_array
(
$request
->
getMethod
(),
$this
->
methods
))
{
return
false
;
}
...
...
@@ -127,12 +134,12 @@ class RequestMatcher implements RequestMatcherInterface
if
(
null
!==
$this
->
path
)
{
$path
=
str_replace
(
'#'
,
'\\#'
,
$this
->
path
);
if
(
!
preg_match
(
'#'
.
$path
.
'#'
,
$request
->
getPathInfo
(
)))
{
if
(
!
preg_match
(
'#'
.
$path
.
'#'
,
rawurldecode
(
$request
->
getPathInfo
()
)))
{
return
false
;
}
}
if
(
null
!==
$this
->
host
&&
!
preg_match
(
'#'
.
str_replace
(
'#'
,
'\\#'
,
$this
->
host
)
.
'#'
,
$request
->
getHost
()))
{
if
(
null
!==
$this
->
host
&&
!
preg_match
(
'#'
.
str_replace
(
'#'
,
'\\#'
,
$this
->
host
)
.
'#
i
'
,
$request
->
getHost
()))
{
return
false
;
}
...
...
@@ -198,12 +205,21 @@ class RequestMatcher implements RequestMatcherInterface
*/
protected
function
checkIp6
(
$requestIp
,
$ip
)
{
if
(
!
defined
(
'AF_INET6'
))
{
if
(
!
((
extension_loaded
(
'sockets'
)
&&
defined
(
'AF_INET6'
))
||
@
inet_pton
(
'::1'
)
))
{
throw
new
\RuntimeException
(
'Unable to check Ipv6. Check that PHP was not compiled with option "disable-ipv6".'
);
}
if
(
false
!==
strpos
(
$ip
,
'/'
))
{
list
(
$address
,
$netmask
)
=
explode
(
'/'
,
$ip
,
2
);
if
(
$netmask
<
1
||
$netmask
>
128
)
{
return
false
;
}
}
else
{
$address
=
$ip
;
$netmask
=
128
;
}
$bytesAddr
=
unpack
(
"n*"
,
inet_pton
(
$address
));
$bytesTest
=
unpack
(
"n*"
,
inet_pton
(
$requestIp
));
...
...
laravel/vendor/Symfony/Component/HttpFoundation/RequestMatcherInterface.php
View file @
cb567c5e
...
...
@@ -29,5 +29,5 @@ interface RequestMatcherInterface
*
* @api
*/
function
matches
(
Request
$request
);
public
function
matches
(
Request
$request
);
}
laravel/vendor/Symfony/Component/HttpFoundation/Resources/stubs/SessionHandlerInterface.php
View file @
cb567c5e
...
...
@@ -12,7 +12,7 @@
/**
* SessionHandlerInterface
*
* Provides forward compat
a
bility with PHP 5.4
* Provides forward compat
i
bility with PHP 5.4
*
* Extensive documentation can be found at php.net, see links:
*
...
...
@@ -36,7 +36,7 @@ interface SessionHandlerInterface
*
* @return boolean
*/
function
open
(
$savePath
,
$sessionName
);
public
function
open
(
$savePath
,
$sessionName
);
/**
* Close session.
...
...
@@ -45,18 +45,20 @@ interface SessionHandlerInterface
*
* @return boolean
*/
function
close
();
public
function
close
();
/**
* Read session.
*
* @param string $sessionId
*
* @see http://php.net/sessionhandlerinterface.read
*
* @throws \RuntimeException On fatal error but not "record not found".
*
* @return string String as stored in persistent storage or empty string in all other cases.
*/
function
read
(
$sessionId
);
public
function
read
(
$sessionId
);
/**
* Commit session to storage.
...
...
@@ -68,7 +70,7 @@ interface SessionHandlerInterface
*
* @return boolean
*/
function
write
(
$sessionId
,
$data
);
public
function
write
(
$sessionId
,
$data
);
/**
* Destroys this session.
...
...
@@ -81,7 +83,7 @@ interface SessionHandlerInterface
*
* @return boolean
*/
function
destroy
(
$sessionId
);
public
function
destroy
(
$sessionId
);
/**
* Garbage collection for storage.
...
...
@@ -94,5 +96,5 @@ interface SessionHandlerInterface
*
* @return boolean
*/
function
gc
(
$lifetime
);
public
function
gc
(
$lifetime
);
}
laravel/vendor/Symfony/Component/HttpFoundation/Response.php
View file @
cb567c5e
...
...
@@ -61,7 +61,7 @@ class Response
*
* @var array
*/
static
publ
ic
$statusTexts
=
array
(
public
stat
ic
$statusTexts
=
array
(
100
=>
'Continue'
,
101
=>
'Switching Protocols'
,
102
=>
'Processing'
,
// RFC2518
...
...
@@ -83,6 +83,7 @@ class Response
305
=>
'Use Proxy'
,
306
=>
'Reserved'
,
307
=>
'Temporary Redirect'
,
308
=>
'Permanent Redirect'
,
// RFC-reschke-http-status-308-07
400
=>
'Bad Request'
,
401
=>
'Unauthorized'
,
402
=>
'Payment Required'
,
...
...
@@ -101,26 +102,26 @@ class Response
415
=>
'Unsupported Media Type'
,
416
=>
'Requested Range Not Satisfiable'
,
417
=>
'Expectation Failed'
,
418
=>
'I\'m a teapot'
,
418
=>
'I\'m a teapot'
,
// RFC2324
422
=>
'Unprocessable Entity'
,
// RFC4918
423
=>
'Locked'
,
// RFC4918
424
=>
'Failed Dependency'
,
// RFC4918
425
=>
'Reserved for WebDAV advanced collections expired proposal'
,
// RFC2817
426
=>
'Upgrade Required'
,
// RFC2817
428
=>
'Precondition Required'
,
// RFC-nottingham-http-new-status-04
429
=>
'Too Many Requests'
,
// RFC-nottingham-http-new-status-04
431
=>
'Request Header Fields Too Large'
,
// RFC-nottingham-http-new-status-04
428
=>
'Precondition Required'
,
// RFC6585
429
=>
'Too Many Requests'
,
// RFC6585
431
=>
'Request Header Fields Too Large'
,
// RFC6585
500
=>
'Internal Server Error'
,
501
=>
'Not Implemented'
,
502
=>
'Bad Gateway'
,
503
=>
'Service Unavailable'
,
504
=>
'Gateway Timeout'
,
505
=>
'HTTP Version Not Supported'
,
506
=>
'Variant Also Negotiates (Experimental)'
,
// [RFC2295]
506
=>
'Variant Also Negotiates (Experimental)'
,
// RFC2295
507
=>
'Insufficient Storage'
,
// RFC4918
508
=>
'Loop Detected'
,
// RFC5842
510
=>
'Not Extended'
,
// RFC2774
511
=>
'Network Authentication Required'
,
// RFC-nottingham-http-new-status-04
511
=>
'Network Authentication Required'
,
// RFC6585
);
/**
...
...
@@ -157,7 +158,7 @@ class Response
*
* @return Response
*/
static
publ
ic
function
create
(
$content
=
''
,
$status
=
200
,
$headers
=
array
())
public
stat
ic
function
create
(
$content
=
''
,
$status
=
200
,
$headers
=
array
())
{
return
new
static
(
$content
,
$status
,
$headers
);
}
...
...
@@ -165,7 +166,7 @@ class Response
/**
* Returns the Response as an HTTP string.
*
* The string representation of the Resonse is the same as the
* The string representation of the Res
p
onse is the same as the
* one that will be sent to the client only if the prepare() method
* has been called before.
*
...
...
@@ -197,13 +198,15 @@ class Response
* the Request that is "associated" with this Response.
*
* @param Request $request A Request instance
*
* @return Response The current response.
*/
public
function
prepare
(
Request
$request
)
{
$headers
=
$this
->
headers
;
if
(
$this
->
isInformational
()
||
in_array
(
$this
->
statusCode
,
array
(
204
,
304
)))
{
$this
->
setContent
(
''
);
$this
->
setContent
(
null
);
}
// Content-type based on the Request
...
...
@@ -231,11 +234,24 @@ class Response
if
(
'HEAD'
===
$request
->
getMethod
())
{
// cf. RFC2616 14.13
$length
=
$headers
->
get
(
'Content-Length'
);
$this
->
setContent
(
''
);
$this
->
setContent
(
null
);
if
(
$length
)
{
$headers
->
set
(
'Content-Length'
,
$length
);
}
}
// Fix protocol
if
(
'HTTP/1.0'
!=
$request
->
server
->
get
(
'SERVER_PROTOCOL'
))
{
$this
->
setProtocolVersion
(
'1.1'
);
}
// Check if we need to send extra expire info headers
if
(
'1.0'
==
$this
->
getProtocolVersion
()
&&
'no-cache'
==
$this
->
headers
->
get
(
'Cache-Control'
))
{
$this
->
headers
->
set
(
'pragma'
,
'no-cache'
);
$this
->
headers
->
set
(
'expires'
,
-
1
);
}
return
$this
;
}
/**
...
...
@@ -294,6 +310,18 @@ class Response
if
(
function_exists
(
'fastcgi_finish_request'
))
{
fastcgi_finish_request
();
}
elseif
(
'cli'
!==
PHP_SAPI
)
{
// ob_get_level() never returns 0 on some Windows configurations, so if
// the level is the same two times in a row, the loop should be stopped.
$previous
=
null
;
$obStatus
=
ob_get_status
(
1
);
while
((
$level
=
ob_get_level
())
>
0
&&
$level
!==
$previous
)
{
$previous
=
$level
;
if
(
$obStatus
[
$level
-
1
]
&&
isset
(
$obStatus
[
$level
-
1
][
'del'
])
&&
$obStatus
[
$level
-
1
][
'del'
])
{
ob_end_flush
();
}
}
flush
();
}
return
$this
;
...
...
@@ -365,7 +393,10 @@ class Response
* Sets the response status code.
*
* @param integer $code HTTP status code
* @param string $text HTTP status text
* @param mixed $text HTTP status text
*
* If the status text is null it will be automatically populated for the known
* status codes and left empty otherwise.
*
* @return Response
*
...
...
@@ -375,12 +406,24 @@ class Response
*/
public
function
setStatusCode
(
$code
,
$text
=
null
)
{
$this
->
statusCode
=
(
int
)
$code
;
$this
->
statusCode
=
$code
=
(
int
)
$code
;
if
(
$this
->
isInvalid
())
{
throw
new
\InvalidArgumentException
(
sprintf
(
'The HTTP status code "%s" is not valid.'
,
$code
));
}
$this
->
statusText
=
false
===
$text
?
''
:
(
null
===
$text
?
self
::
$statusTexts
[
$this
->
statusCode
]
:
$text
);
if
(
null
===
$text
)
{
$this
->
statusText
=
isset
(
self
::
$statusTexts
[
$code
])
?
self
::
$statusTexts
[
$code
]
:
''
;
return
$this
;
}
if
(
false
===
$text
)
{
$this
->
statusText
=
''
;
return
$this
;
}
$this
->
statusText
=
$text
;
return
$this
;
}
...
...
@@ -528,7 +571,7 @@ class Response
*/
public
function
mustRevalidate
()
{
return
$this
->
headers
->
hasCacheControlDirective
(
'must-revalidate'
)
||
$this
->
headers
->
has
(
'
must-
proxy-revalidate'
);
return
$this
->
headers
->
hasCacheControlDirective
(
'must-revalidate'
)
||
$this
->
headers
->
has
(
'proxy-revalidate'
);
}
/**
...
...
@@ -542,7 +585,7 @@ class Response
*/
public
function
getDate
()
{
return
$this
->
headers
->
getDate
(
'Date'
);
return
$this
->
headers
->
getDate
(
'Date'
,
new
\DateTime
()
);
}
/**
...
...
@@ -701,7 +744,7 @@ class Response
* When the responses TTL is <= 0, the response may not be served from cache without first
* revalidating with the origin.
*
* @return integer The TTL in seconds
* @return integer
|null
The TTL in seconds
*
* @api
*/
...
...
@@ -960,6 +1003,10 @@ class Response
*/
public
function
isNotModified
(
Request
$request
)
{
if
(
!
$request
->
isMethodSafe
())
{
return
false
;
}
$lastModified
=
$request
->
headers
->
get
(
'If-Modified-Since'
);
$notModified
=
false
;
if
(
$etags
=
$request
->
getEtags
())
{
...
...
@@ -1095,7 +1142,7 @@ class Response
*/
public
function
isRedirect
(
$location
=
null
)
{
return
in_array
(
$this
->
statusCode
,
array
(
201
,
301
,
302
,
303
,
307
))
&&
(
null
===
$location
?:
$location
==
$this
->
headers
->
get
(
'Location'
));
return
in_array
(
$this
->
statusCode
,
array
(
201
,
301
,
302
,
303
,
307
,
308
))
&&
(
null
===
$location
?:
$location
==
$this
->
headers
->
get
(
'Location'
));
}
/**
...
...
laravel/vendor/Symfony/Component/HttpFoundation/ResponseHeaderBag.php
View file @
cb567c5e
...
...
@@ -231,7 +231,7 @@ class ResponseHeaderBag extends HeaderBag
throw
new
\InvalidArgumentException
(
sprintf
(
'The disposition must be either "%s" or "%s".'
,
self
::
DISPOSITION_ATTACHMENT
,
self
::
DISPOSITION_INLINE
));
}
if
(
!
$filenameFallback
)
{
if
(
''
==
$filenameFallback
)
{
$filenameFallback
=
$filename
;
}
...
...
@@ -246,14 +246,14 @@ class ResponseHeaderBag extends HeaderBag
}
// path separators aren't allowed in either.
if
(
preg_match
(
'#[/\\\\]#'
,
$filename
)
||
preg_match
(
'#[/\\\\]#'
,
$filenameFallback
))
{
if
(
false
!==
strpos
(
$filename
,
'/'
)
||
false
!==
strpos
(
$filename
,
'\\'
)
||
false
!==
strpos
(
$filenameFallback
,
'/'
)
||
false
!==
strpos
(
$filenameFallback
,
'\\'
))
{
throw
new
\InvalidArgumentException
(
'The filename and the fallback cannot contain the "/" and "\\" characters.'
);
}
$output
=
sprintf
(
'%s; filename="%s"'
,
$disposition
,
str_replace
(
array
(
'\\'
,
'"'
),
array
(
'\\\\'
,
'\\"'
)
,
$filenameFallback
));
$output
=
sprintf
(
'%s; filename="%s"'
,
$disposition
,
str_replace
(
'"'
,
'\\"'
,
$filenameFallback
));
if
(
$filename
!=
$filenameFallback
)
{
$output
.=
sprintf
(
"; filename*=utf-8''%s"
,
str_replace
(
array
(
"'"
,
'('
,
')'
,
'*'
),
array
(
'%27'
,
'%28'
,
'%29'
,
'%2A'
),
urlencode
(
$filename
)
));
if
(
$filename
!=
=
$filenameFallback
)
{
$output
.=
sprintf
(
"; filename*=utf-8''%s"
,
rawurlencode
(
$filename
));
}
return
$output
;
...
...
laravel/vendor/Symfony/Component/HttpFoundation/ServerBag.php
View file @
cb567c5e
...
...
@@ -16,13 +16,14 @@ namespace Symfony\Component\HttpFoundation;
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Bulat Shakirzyanov <mallluhuct@gmail.com>
* @author Robert Kiss <kepten@gmail.com>
*/
class
ServerBag
extends
ParameterBag
{
/**
* Gets the HTTP headers.
*
* @return
string
* @return
array
*/
public
function
getHeaders
()
{
...
...
@@ -33,14 +34,47 @@ class ServerBag extends ParameterBag
}
// CONTENT_* are not prefixed with HTTP_
elseif
(
in_array
(
$key
,
array
(
'CONTENT_LENGTH'
,
'CONTENT_MD5'
,
'CONTENT_TYPE'
)))
{
$headers
[
$key
]
=
$
this
->
parameters
[
$key
]
;
$headers
[
$key
]
=
$
value
;
}
}
// PHP_AUTH_USER/PHP_AUTH_PW
if
(
isset
(
$this
->
parameters
[
'PHP_AUTH_USER'
]))
{
$pass
=
isset
(
$this
->
parameters
[
'PHP_AUTH_PW'
])
?
$this
->
parameters
[
'PHP_AUTH_PW'
]
:
''
;
$headers
[
'AUTHORIZATION'
]
=
'Basic '
.
base64_encode
(
$this
->
parameters
[
'PHP_AUTH_USER'
]
.
':'
.
$pass
);
$headers
[
'PHP_AUTH_USER'
]
=
$this
->
parameters
[
'PHP_AUTH_USER'
];
$headers
[
'PHP_AUTH_PW'
]
=
isset
(
$this
->
parameters
[
'PHP_AUTH_PW'
])
?
$this
->
parameters
[
'PHP_AUTH_PW'
]
:
''
;
}
else
{
/*
* php-cgi under Apache does not pass HTTP Basic user/pass to PHP by default
* For this workaround to work, add these lines to your .htaccess file:
* RewriteCond %{HTTP:Authorization} ^(.+)$
* RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
*
* A sample .htaccess file:
* RewriteEngine On
* RewriteCond %{HTTP:Authorization} ^(.+)$
* RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
* RewriteCond %{REQUEST_FILENAME} !-f
* RewriteRule ^(.*)$ app.php [QSA,L]
*/
$authorizationHeader
=
null
;
if
(
isset
(
$this
->
parameters
[
'HTTP_AUTHORIZATION'
]))
{
$authorizationHeader
=
$this
->
parameters
[
'HTTP_AUTHORIZATION'
];
}
elseif
(
isset
(
$this
->
parameters
[
'REDIRECT_HTTP_AUTHORIZATION'
]))
{
$authorizationHeader
=
$this
->
parameters
[
'REDIRECT_HTTP_AUTHORIZATION'
];
}
// Decode AUTHORIZATION header into PHP_AUTH_USER and PHP_AUTH_PW when authorization header is basic
if
((
null
!==
$authorizationHeader
)
&&
(
0
===
stripos
(
$authorizationHeader
,
'basic'
)))
{
$exploded
=
explode
(
':'
,
base64_decode
(
substr
(
$authorizationHeader
,
6
)));
if
(
count
(
$exploded
)
==
2
)
{
list
(
$headers
[
'PHP_AUTH_USER'
],
$headers
[
'PHP_AUTH_PW'
])
=
$exploded
;
}
}
}
// PHP_AUTH_USER/PHP_AUTH_PW
if
(
isset
(
$headers
[
'PHP_AUTH_USER'
]))
{
$headers
[
'AUTHORIZATION'
]
=
'Basic '
.
base64_encode
(
$headers
[
'PHP_AUTH_USER'
]
.
':'
.
$headers
[
'PHP_AUTH_PW'
]);
}
return
$headers
;
...
...
laravel/vendor/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBag.php
View file @
cb567c5e
...
...
@@ -14,7 +14,7 @@ namespace Symfony\Component\HttpFoundation\Session\Attribute;
/**
* This class relates to session attribute storage
*/
class
AttributeBag
implements
AttributeBagInterface
class
AttributeBag
implements
AttributeBagInterface
,
\IteratorAggregate
,
\Countable
{
private
$name
=
'attributes'
;
...
...
@@ -134,4 +134,24 @@ class AttributeBag implements AttributeBagInterface
return
$return
;
}
/**
* Returns an iterator for attributes.
*
* @return \ArrayIterator An \ArrayIterator instance
*/
public
function
getIterator
()
{
return
new
\ArrayIterator
(
$this
->
attributes
);
}
/**
* Returns the number of attributes.
*
* @return int The number of attributes
*/
public
function
count
()
{
return
count
(
$this
->
attributes
);
}
}
laravel/vendor/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBagInterface.php
View file @
cb567c5e
...
...
@@ -27,7 +27,7 @@ interface AttributeBagInterface extends SessionBagInterface
*
* @return Boolean true if the attribute is defined, false otherwise
*/
function
has
(
$name
);
public
function
has
(
$name
);
/**
* Returns an attribute.
...
...
@@ -37,7 +37,7 @@ interface AttributeBagInterface extends SessionBagInterface
*
* @return mixed
*/
function
get
(
$name
,
$default
=
null
);
public
function
get
(
$name
,
$default
=
null
);
/**
* Sets an attribute.
...
...
@@ -45,21 +45,21 @@ interface AttributeBagInterface extends SessionBagInterface
* @param string $name
* @param mixed $value
*/
function
set
(
$name
,
$value
);
public
function
set
(
$name
,
$value
);
/**
* Returns attributes.
*
* @return array Attributes
*/
function
all
();
public
function
all
();
/**
* Sets attributes.
*
* @param array $attributes Attributes
*/
function
replace
(
array
$attributes
);
public
function
replace
(
array
$attributes
);
/**
* Removes an attribute.
...
...
@@ -68,5 +68,5 @@ interface AttributeBagInterface extends SessionBagInterface
*
* @return mixed The removed value
*/
function
remove
(
$name
);
public
function
remove
(
$name
);
}
laravel/vendor/Symfony/Component/HttpFoundation/Session/Flash/AutoExpireFlashBag.php
View file @
cb567c5e
...
...
@@ -75,7 +75,15 @@ class AutoExpireFlashBag implements FlashBagInterface
/**
* {@inheritdoc}
*/
public
function
peek
(
$type
,
$default
=
null
)
public
function
add
(
$type
,
$message
)
{
$this
->
flashes
[
'new'
][
$type
][]
=
$message
;
}
/**
* {@inheritdoc}
*/
public
function
peek
(
$type
,
array
$default
=
array
())
{
return
$this
->
has
(
$type
)
?
$this
->
flashes
[
'display'
][
$type
]
:
$default
;
}
...
...
@@ -85,13 +93,13 @@ class AutoExpireFlashBag implements FlashBagInterface
*/
public
function
peekAll
()
{
return
array_key_exists
(
'display'
,
$this
->
flashes
)
?
(
array
)
$this
->
flashes
[
'display'
]
:
array
();
return
array_key_exists
(
'display'
,
$this
->
flashes
)
?
(
array
)
$this
->
flashes
[
'display'
]
:
array
();
}
/**
* {@inheritdoc}
*/
public
function
get
(
$type
,
$default
=
null
)
public
function
get
(
$type
,
array
$default
=
array
()
)
{
$return
=
$default
;
...
...
@@ -129,9 +137,9 @@ class AutoExpireFlashBag implements FlashBagInterface
/**
* {@inheritdoc}
*/
public
function
set
(
$type
,
$message
)
public
function
set
(
$type
,
$message
s
)
{
$this
->
flashes
[
'new'
][
$type
]
=
$message
;
$this
->
flashes
[
'new'
][
$type
]
=
(
array
)
$messages
;
}
/**
...
...
@@ -139,7 +147,7 @@ class AutoExpireFlashBag implements FlashBagInterface
*/
public
function
has
(
$type
)
{
return
array_key_exists
(
$type
,
$this
->
flashes
[
'display'
]);
return
array_key_exists
(
$type
,
$this
->
flashes
[
'display'
])
&&
$this
->
flashes
[
'display'
][
$type
]
;
}
/**
...
...
@@ -163,9 +171,6 @@ class AutoExpireFlashBag implements FlashBagInterface
*/
public
function
clear
()
{
$return
=
$this
->
all
();
$this
->
flashes
=
array
(
'display'
=>
array
(),
'new'
=>
array
());
return
$return
;
return
$this
->
all
();
}
}
laravel/vendor/Symfony/Component/HttpFoundation/Session/Flash/FlashBag.php
View file @
cb567c5e
...
...
@@ -16,7 +16,7 @@ namespace Symfony\Component\HttpFoundation\Session\Flash;
*
* @author Drak <drak@zikula.org>
*/
class
FlashBag
implements
FlashBagInterface
class
FlashBag
implements
FlashBagInterface
,
\IteratorAggregate
,
\Countable
{
private
$name
=
'flashes'
;
...
...
@@ -68,7 +68,15 @@ class FlashBag implements FlashBagInterface
/**
* {@inheritdoc}
*/
public
function
peek
(
$type
,
$default
=
null
)
public
function
add
(
$type
,
$message
)
{
$this
->
flashes
[
$type
][]
=
$message
;
}
/**
* {@inheritdoc}
*/
public
function
peek
(
$type
,
array
$default
=
array
())
{
return
$this
->
has
(
$type
)
?
$this
->
flashes
[
$type
]
:
$default
;
}
...
...
@@ -84,7 +92,7 @@ class FlashBag implements FlashBagInterface
/**
* {@inheritdoc}
*/
public
function
get
(
$type
,
$default
=
null
)
public
function
get
(
$type
,
array
$default
=
array
()
)
{
if
(
!
$this
->
has
(
$type
))
{
return
$default
;
...
...
@@ -111,9 +119,9 @@ class FlashBag implements FlashBagInterface
/**
* {@inheritdoc}
*/
public
function
set
(
$type
,
$message
)
public
function
set
(
$type
,
$message
s
)
{
$this
->
flashes
[
$type
]
=
$message
;
$this
->
flashes
[
$type
]
=
(
array
)
$messages
;
}
/**
...
...
@@ -129,7 +137,7 @@ class FlashBag implements FlashBagInterface
*/
public
function
has
(
$type
)
{
return
array_key_exists
(
$type
,
$this
->
flashes
);
return
array_key_exists
(
$type
,
$this
->
flashes
)
&&
$this
->
flashes
[
$type
]
;
}
/**
...
...
@@ -155,4 +163,24 @@ class FlashBag implements FlashBagInterface
{
return
$this
->
all
();
}
/**
* Returns an iterator for flashes.
*
* @return \ArrayIterator An \ArrayIterator instance
*/
public
function
getIterator
()
{
return
new
\ArrayIterator
(
$this
->
all
());
}
/**
* Returns the number of flashes.
*
* @return int The number of flashes
*/
public
function
count
()
{
return
count
(
$this
->
flashes
);
}
}
laravel/vendor/Symfony/Component/HttpFoundation/Session/Flash/FlashBagInterface.php
View file @
cb567c5e
...
...
@@ -21,51 +21,59 @@ use Symfony\Component\HttpFoundation\Session\SessionBagInterface;
interface
FlashBagInterface
extends
SessionBagInterface
{
/**
*
Registers a message for a given
type.
*
Adds a flash message for
type.
*
* @param string $type
* @param string $message
*/
function
set
(
$type
,
$message
);
public
function
add
(
$type
,
$message
);
/**
* Gets flash message for a given type.
* Registers a message for a given type.
*
* @param string $type
* @param string|array $message
*/
public
function
set
(
$type
,
$message
);
/**
* Gets flash messages for a given type.
*
* @param string $type Message category type.
* @param
string $default Default value if $type doee
not exist.
* @param
array $default Default value if $type does
not exist.
*
* @return
string
* @return
array
*/
function
peek
(
$type
,
$default
=
null
);
public
function
peek
(
$type
,
array
$default
=
array
()
);
/**
* Gets all flash messages.
*
* @return array
*/
function
peekAll
();
public
function
peekAll
();
/**
* Gets and clears flash from the stack.
*
* @param string $type
* @param
string $default Default value if $type doee
not exist.
* @param
array $default Default value if $type does
not exist.
*
* @return
string
* @return
array
*/
function
get
(
$type
,
$default
=
null
);
public
function
get
(
$type
,
array
$default
=
array
()
);
/**
* Gets and clears flashes from the stack.
*
* @return array
*/
function
all
();
public
function
all
();
/**
* Sets all flash messages.
*/
function
setAll
(
array
$messages
);
public
function
setAll
(
array
$messages
);
/**
* Has flash messages for a given type?
...
...
@@ -74,12 +82,12 @@ interface FlashBagInterface extends SessionBagInterface
*
* @return boolean
*/
function
has
(
$type
);
public
function
has
(
$type
);
/**
* Returns a list of all defined types.
*
* @return array
*/
function
keys
();
public
function
keys
();
}
laravel/vendor/Symfony/Component/HttpFoundation/Session/Session.php
View file @
cb567c5e
...
...
@@ -27,7 +27,7 @@ use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;
*
* @api
*/
class
Session
implements
SessionInterface
class
Session
implements
SessionInterface
,
\IteratorAggregate
,
\Countable
{
/**
* Storage driver.
...
...
@@ -57,13 +57,13 @@ class Session implements SessionInterface
{
$this
->
storage
=
$storage
?:
new
NativeSessionStorage
();
$attribute
Bag
=
$attributes
?:
new
AttributeBag
();
$this
->
attributeName
=
$attribute
Bag
->
getName
();
$this
->
registerBag
(
$attribute
Bag
);
$attribute
s
=
$attributes
?:
new
AttributeBag
();
$this
->
attributeName
=
$attribute
s
->
getName
();
$this
->
registerBag
(
$attribute
s
);
$flash
Bag
=
$flashes
?:
new
FlashBag
();
$this
->
flashName
=
$flash
Bag
->
getName
();
$this
->
registerBag
(
$flash
Bag
);
$flash
es
=
$flashes
?:
new
FlashBag
();
$this
->
flashName
=
$flash
es
->
getName
();
$this
->
registerBag
(
$flash
es
);
}
/**
...
...
@@ -133,19 +133,47 @@ class Session implements SessionInterface
/**
* {@inheritdoc}
*/
public
function
invalidate
()
public
function
isStarted
()
{
return
$this
->
storage
->
isStarted
();
}
/**
* Returns an iterator for attributes.
*
* @return \ArrayIterator An \ArrayIterator instance
*/
public
function
getIterator
()
{
return
new
\ArrayIterator
(
$this
->
storage
->
getBag
(
$this
->
attributeName
)
->
all
());
}
/**
* Returns the number of attributes.
*
* @return int The number of attributes
*/
public
function
count
()
{
return
count
(
$this
->
storage
->
getBag
(
$this
->
attributeName
)
->
all
());
}
/**
* {@inheritdoc}
*/
public
function
invalidate
(
$lifetime
=
null
)
{
$this
->
storage
->
clear
();
return
$this
->
storage
->
regenerate
(
tru
e
);
return
$this
->
migrate
(
true
,
$lifetim
e
);
}
/**
* {@inheritdoc}
*/
public
function
migrate
(
$destroy
=
false
)
public
function
migrate
(
$destroy
=
false
,
$lifetime
=
null
)
{
return
$this
->
storage
->
regenerate
(
$destroy
);
return
$this
->
storage
->
regenerate
(
$destroy
,
$lifetime
);
}
/**
...
...
@@ -189,9 +217,15 @@ class Session implements SessionInterface
}
/**
* Registers a SessionBagInterface with the session.
*
* @param SessionBagInterface $bag
* {@inheritdoc}
*/
public
function
getMetadataBag
()
{
return
$this
->
storage
->
getMetadataBag
();
}
/**
* {@inheritdoc}
*/
public
function
registerBag
(
SessionBagInterface
$bag
)
{
...
...
@@ -199,11 +233,7 @@ class Session implements SessionInterface
}
/**
* Get's a bag instance.
*
* @param string $name
*
* @return SessionBagInterface
* {@inheritdoc}
*/
public
function
getBag
(
$name
)
{
...
...
@@ -229,7 +259,20 @@ class Session implements SessionInterface
*/
public
function
getFlashes
()
{
return
$this
->
getBag
(
'flashes'
)
->
all
();
$all
=
$this
->
getBag
(
$this
->
flashName
)
->
all
();
$return
=
array
();
if
(
$all
)
{
foreach
(
$all
as
$name
=>
$array
)
{
if
(
is_numeric
(
key
(
$array
)))
{
$return
[
$name
]
=
reset
(
$array
);
}
else
{
$return
[
$name
]
=
$array
;
}
}
}
return
$return
;
}
/**
...
...
@@ -239,7 +282,9 @@ class Session implements SessionInterface
*/
public
function
setFlashes
(
$values
)
{
$this
->
getBag
(
'flashes'
)
->
setAll
(
$values
);
foreach
(
$values
as
$name
=>
$value
)
{
$this
->
getBag
(
$this
->
flashName
)
->
set
(
$name
,
$value
);
}
}
/**
...
...
@@ -252,7 +297,9 @@ class Session implements SessionInterface
*/
public
function
getFlash
(
$name
,
$default
=
null
)
{
return
$this
->
getBag
(
'flashes'
)
->
get
(
$name
,
$default
);
$return
=
$this
->
getBag
(
$this
->
flashName
)
->
get
(
$name
);
return
empty
(
$return
)
?
$default
:
reset
(
$return
);
}
/**
...
...
@@ -263,7 +310,7 @@ class Session implements SessionInterface
*/
public
function
setFlash
(
$name
,
$value
)
{
$this
->
getBag
(
'flashes'
)
->
set
(
$name
,
$value
);
$this
->
getBag
(
$this
->
flashName
)
->
set
(
$name
,
$value
);
}
/**
...
...
@@ -275,7 +322,7 @@ class Session implements SessionInterface
*/
public
function
hasFlash
(
$name
)
{
return
$this
->
getBag
(
'flashes'
)
->
has
(
$name
);
return
$this
->
getBag
(
$this
->
flashName
)
->
has
(
$name
);
}
/**
...
...
@@ -285,7 +332,7 @@ class Session implements SessionInterface
*/
public
function
removeFlash
(
$name
)
{
$this
->
getBag
(
'flashes'
)
->
get
(
$name
);
$this
->
getBag
(
$this
->
flashName
)
->
get
(
$name
);
}
/**
...
...
@@ -295,6 +342,6 @@ class Session implements SessionInterface
*/
public
function
clearFlashes
()
{
return
$this
->
getBag
(
'flashes'
)
->
clear
();
return
$this
->
getBag
(
$this
->
flashName
)
->
clear
();
}
}
laravel/vendor/Symfony/Component/HttpFoundation/Session/SessionBagInterface.php
View file @
cb567c5e
...
...
@@ -23,26 +23,26 @@ interface SessionBagInterface
*
* @return string
*/
function
getName
();
public
function
getName
();
/**
* Initializes the Bag
*
* @param array $array
*/
function
initialize
(
array
&
$array
);
public
function
initialize
(
array
&
$array
);
/**
* Gets the storage key for this bag.
*
* @return string
*/
function
getStorageKey
();
public
function
getStorageKey
();
/**
* Clears out data from bag.
*
* @return mixed Whatever data was contained.
*/
function
clear
();
public
function
clear
();
}
laravel/vendor/Symfony/Component/HttpFoundation/Session/SessionInterface.php
View file @
cb567c5e
...
...
@@ -11,6 +11,8 @@
namespace
Symfony\Component\HttpFoundation\Session
;
use
Symfony\Component\HttpFoundation\Session\Storage\MetadataBag
;
/**
* Interface for the session.
*
...
...
@@ -27,7 +29,7 @@ interface SessionInterface
*
* @api
*/
function
start
();
public
function
start
();
/**
* Returns the session ID.
...
...
@@ -36,7 +38,7 @@ interface SessionInterface
*
* @api
*/
function
getId
();
public
function
getId
();
/**
* Sets the session ID
...
...
@@ -45,7 +47,7 @@ interface SessionInterface
*
* @api
*/
function
setId
(
$id
);
public
function
setId
(
$id
);
/**
* Returns the session name.
...
...
@@ -54,7 +56,7 @@ interface SessionInterface
*
* @api
*/
function
getName
();
public
function
getName
();
/**
* Sets the session name.
...
...
@@ -63,7 +65,7 @@ interface SessionInterface
*
* @api
*/
function
setName
(
$name
);
public
function
setName
(
$name
);
/**
* Invalidates the current session.
...
...
@@ -71,23 +73,32 @@ interface SessionInterface
* Clears all session attributes and flashes and regenerates the
* session and deletes the old session from persistence.
*
* @param integer $lifetime Sets the cookie lifetime for the session cookie. A null value
* will leave the system settings unchanged, 0 sets the cookie
* to expire with browser session. Time is in seconds, and is
* not a Unix timestamp.
*
* @return Boolean True if session invalidated, false if error.
*
* @api
*/
function
invalidate
(
);
public
function
invalidate
(
$lifetime
=
null
);
/**
* Migrates the current session to a new session id while maintaining all
* session attributes.
*
* @param Boolean $destroy Whether to delete the old session or leave it to garbage collection.
* @param integer $lifetime Sets the cookie lifetime for the session cookie. A null value
* will leave the system settings unchanged, 0 sets the cookie
* to expire with browser session. Time is in seconds, and is
* not a Unix timestamp.
*
* @return Boolean True if session migrated, false if error.
*
* @api
*/
function
migrate
(
$destroy
=
false
);
public
function
migrate
(
$destroy
=
false
,
$lifetime
=
null
);
/**
* Force the session to be saved and closed.
...
...
@@ -96,7 +107,7 @@ interface SessionInterface
* the session will be automatically saved at the end of
* code execution.
*/
function
save
();
public
function
save
();
/**
* Checks if an attribute is defined.
...
...
@@ -107,7 +118,7 @@ interface SessionInterface
*
* @api
*/
function
has
(
$name
);
public
function
has
(
$name
);
/**
* Returns an attribute.
...
...
@@ -119,7 +130,7 @@ interface SessionInterface
*
* @api
*/
function
get
(
$name
,
$default
=
null
);
public
function
get
(
$name
,
$default
=
null
);
/**
* Sets an attribute.
...
...
@@ -129,7 +140,7 @@ interface SessionInterface
*
* @api
*/
function
set
(
$name
,
$value
);
public
function
set
(
$name
,
$value
);
/**
* Returns attributes.
...
...
@@ -138,14 +149,14 @@ interface SessionInterface
*
* @api
*/
function
all
();
public
function
all
();
/**
* Sets attributes.
*
* @param array $attributes Attributes
*/
function
replace
(
array
$attributes
);
public
function
replace
(
array
$attributes
);
/**
* Removes an attribute.
...
...
@@ -156,12 +167,42 @@ interface SessionInterface
*
* @api
*/
function
remove
(
$name
);
public
function
remove
(
$name
);
/**
* Clears all attributes.
*
* @api
*/
function
clear
();
public
function
clear
();
/**
* Checks if the session was started.
*
* @return Boolean
*/
public
function
isStarted
();
/**
* Registers a SessionBagInterface with the session.
*
* @param SessionBagInterface $bag
*/
public
function
registerBag
(
SessionBagInterface
$bag
);
/**
* Gets a bag instance by name.
*
* @param string $name
*
* @return SessionBagInterface
*/
public
function
getBag
(
$name
);
/**
* Gets session meta.
*
* @return MetadataBag
*/
public
function
getMetadataBag
();
}
laravel/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcacheSessionHandler.php
View file @
cb567c5e
...
...
@@ -19,85 +19,55 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
class
MemcacheSessionHandler
implements
\SessionHandlerInterface
{
/**
* Memcache driver.
*
* @var \Memcache
* @var \Memcache Memcache driver.
*/
private
$memcache
;
/**
* Configuration options.
*
* @var array
* @var integer Time to live in seconds
*/
private
$
memcacheOptions
;
private
$
ttl
;
/**
* Key prefix for shared environments.
*
* @var string
* @var string Key prefix for shared environments.
*/
private
$prefix
;
/**
* Constructor.
*
* List of available options:
* * prefix: The prefix to use for the memcache keys in order to avoid collision
* * expiretime: The time to live in seconds
*
* @param \Memcache $memcache A \Memcache instance
* @param array $memcacheOptions An associative array of Memcache options
* @param array $options Session configuration options.
* @param array $options An associative array of Memcache options
*
* @throws \InvalidArgumentException When unsupported options are passed
*/
public
function
__construct
(
\Memcache
$memcache
,
array
$
memcacheOptions
=
array
(),
array
$
options
=
array
())
public
function
__construct
(
\Memcache
$memcache
,
array
$options
=
array
())
{
$this
->
memcache
=
$memcache
;
// defaults
if
(
!
isset
(
$memcacheOptions
[
'serverpool'
]))
{
$memcacheOptions
[
'serverpool'
]
=
array
(
array
(
'host'
=>
'127.0.0.1'
,
'port'
=>
11211
,
'timeout'
=>
1
,
'persistent'
=>
false
,
'weight'
=>
1
,
'retry_interval'
=>
15
,
if
(
$diff
=
array_diff
(
array_keys
(
$options
),
array
(
'prefix'
,
'expiretime'
)))
{
throw
new
\InvalidArgumentException
(
sprintf
(
'The following options are not supported "%s"'
,
implode
(
', '
,
$diff
)
));
}
$memcacheOptions
[
'expiretime'
]
=
isset
(
$memcacheOptions
[
'expiretime'
])
?
(
int
)
$memcacheOptions
[
'expiretime'
]
:
86400
;
$this
->
prefix
=
isset
(
$memcacheOptions
[
'prefix'
])
?
$memcacheOptions
[
'prefix'
]
:
'sf2s'
;
$this
->
memcacheOptions
=
$memcacheOptions
;
}
protected
function
addServer
(
array
$server
)
{
if
(
!
array_key_exists
(
'host'
,
$server
))
{
throw
new
\InvalidArgumentException
(
'host key must be set'
);
}
$server
[
'port'
]
=
isset
(
$server
[
'port'
])
?
(
int
)
$server
[
'port'
]
:
11211
;
$server
[
'timeout'
]
=
isset
(
$server
[
'timeout'
])
?
(
int
)
$server
[
'timeout'
]
:
1
;
$server
[
'persistent'
]
=
isset
(
$server
[
'persistent'
])
?
(
bool
)
$server
[
'persistent'
]
:
false
;
$server
[
'weight'
]
=
isset
(
$server
[
'weight'
])
?
(
int
)
$server
[
'weight'
]
:
1
;
$server
[
'retry_interval'
]
=
isset
(
$server
[
'retry_interval'
])
?
(
int
)
$server
[
'retry_interval'
]
:
15
;
$this
->
memcache
->
addserver
(
$server
[
'host'
],
$server
[
'port'
],
$server
[
'persistent'
],
$server
[
'weight'
],
$server
[
'timeout'
],
$server
[
'retry_interval'
]);
$this
->
memcache
=
$memcache
;
$this
->
ttl
=
isset
(
$options
[
'expiretime'
])
?
(
int
)
$options
[
'expiretime'
]
:
86400
;
$this
->
prefix
=
isset
(
$options
[
'prefix'
])
?
$options
[
'prefix'
]
:
'sf2s'
;
}
/**
* {@inherit
d
oc}
* {@inherit
D
oc}
*/
public
function
open
(
$savePath
,
$sessionName
)
{
foreach
(
$this
->
memcacheOptions
[
'serverpool'
]
as
$server
)
{
$this
->
addServer
(
$server
);
}
return
true
;
}
/**
* {@inherit
d
oc}
* {@inherit
D
oc}
*/
public
function
close
()
{
...
...
@@ -105,7 +75,7 @@ class MemcacheSessionHandler implements \SessionHandlerInterface
}
/**
* {@inherit
d
oc}
* {@inherit
D
oc}
*/
public
function
read
(
$sessionId
)
{
...
...
@@ -113,15 +83,15 @@ class MemcacheSessionHandler implements \SessionHandlerInterface
}
/**
* {@inherit
d
oc}
* {@inherit
D
oc}
*/
public
function
write
(
$sessionId
,
$data
)
{
return
$this
->
memcache
->
set
(
$this
->
prefix
.
$sessionId
,
$data
,
0
,
$this
->
memcacheOptions
[
'expiretime'
]
);
return
$this
->
memcache
->
set
(
$this
->
prefix
.
$sessionId
,
$data
,
0
,
time
()
+
$this
->
ttl
);
}
/**
* {@inherit
d
oc}
* {@inherit
D
oc}
*/
public
function
destroy
(
$sessionId
)
{
...
...
@@ -129,7 +99,7 @@ class MemcacheSessionHandler implements \SessionHandlerInterface
}
/**
* {@inherit
d
oc}
* {@inherit
D
oc}
*/
public
function
gc
(
$lifetime
)
{
...
...
laravel/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php
View file @
cb567c5e
...
...
@@ -24,55 +24,56 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
class
MemcachedSessionHandler
implements
\SessionHandlerInterface
{
/**
* Memcached driver.
*
* @var \Memcached
* @var \Memcached Memcached driver.
*/
private
$memcached
;
/**
* Configuration options.
*
* @var array
* @var integer Time to live in seconds
*/
private
$ttl
;
/**
* @var string Key prefix for shared environments.
*/
private
$
memcachedOptions
;
private
$
prefix
;
/**
* Constructor.
*
* List of available options:
* * prefix: The prefix to use for the memcached keys in order to avoid collision
* * expiretime: The time to live in seconds
*
* @param \Memcached $memcached A \Memcached instance
* @param array $memcachedOptions An associative array of Memcached options
* @param array $options Session configuration options.
* @param array $options An associative array of Memcached options
*
* @throws \InvalidArgumentException When unsupported options are passed
*/
public
function
__construct
(
\Memcached
$memcached
,
array
$
memcachedOptions
=
array
(),
array
$
options
=
array
())
public
function
__construct
(
\Memcached
$memcached
,
array
$options
=
array
())
{
$this
->
memcached
=
$memcached
;
// defaults
if
(
!
isset
(
$memcachedOptions
[
'serverpool'
]))
{
$memcachedOptions
[
'serverpool'
][]
=
array
(
'host'
=>
'127.0.0.1'
,
'port'
=>
11211
,
'weight'
=>
1
);
if
(
$diff
=
array_diff
(
array_keys
(
$options
),
array
(
'prefix'
,
'expiretime'
)))
{
throw
new
\InvalidArgumentException
(
sprintf
(
'The following options are not supported "%s"'
,
implode
(
', '
,
$diff
)
));
}
$memcachedOptions
[
'expiretime'
]
=
isset
(
$memcachedOptions
[
'expiretime'
])
?
(
int
)
$memcachedOptions
[
'expiretime'
]
:
86400
;
$this
->
memcached
->
setOption
(
\Memcached
::
OPT_PREFIX_KEY
,
isset
(
$memcachedOptions
[
'prefix'
])
?
$memcachedOptions
[
'prefix'
]
:
'sf2s'
);
$this
->
memcachedOptions
=
$memcachedOptions
;
$this
->
ttl
=
isset
(
$options
[
'expiretime'
])
?
(
int
)
$options
[
'expiretime'
]
:
86400
;
$this
->
prefix
=
isset
(
$options
[
'prefix'
])
?
$options
[
'prefix'
]
:
'sf2s'
;
}
/**
* {@inherit
d
oc}
* {@inherit
D
oc}
*/
public
function
open
(
$savePath
,
$sessionName
)
{
return
$this
->
memcached
->
addServers
(
$this
->
memcachedOptions
[
'serverpool'
])
;
return
true
;
}
/**
* {@inherit
d
oc}
* {@inherit
D
oc}
*/
public
function
close
()
{
...
...
@@ -80,51 +81,35 @@ class MemcachedSessionHandler implements \SessionHandlerInterface
}
/**
* {@inherit
d
oc}
* {@inherit
D
oc}
*/
public
function
read
(
$sessionId
)
{
return
$this
->
memcached
->
get
(
$sessionId
)
?:
''
;
return
$this
->
memcached
->
get
(
$
this
->
prefix
.
$
sessionId
)
?:
''
;
}
/**
* {@inherit
d
oc}
* {@inherit
D
oc}
*/
public
function
write
(
$sessionId
,
$data
)
{
return
$this
->
memcached
->
set
(
$
sessionId
,
$data
,
$this
->
memcachedOptions
[
'expiretime'
]
);
return
$this
->
memcached
->
set
(
$
this
->
prefix
.
$sessionId
,
$data
,
time
()
+
$this
->
ttl
);
}
/**
* {@inherit
d
oc}
* {@inherit
D
oc}
*/
public
function
destroy
(
$sessionId
)
{
return
$this
->
memcached
->
delete
(
$sessionId
);
return
$this
->
memcached
->
delete
(
$
this
->
prefix
.
$
sessionId
);
}
/**
* {@inherit
d
oc}
* {@inherit
D
oc}
*/
public
function
gc
(
$lifetime
)
{
// not required here because memcached will auto expire the records anyhow.
return
true
;
}
/**
* Adds a server to the memcached handler.
*
* @param array $server
*/
protected
function
addServer
(
array
$server
)
{
if
(
array_key_exists
(
'host'
,
$server
))
{
throw
new
\InvalidArgumentException
(
'host key must be set'
);
}
$server
[
'port'
]
=
isset
(
$server
[
'port'
])
?
(
int
)
$server
[
'port'
]
:
11211
;
$server
[
'timeout'
]
=
isset
(
$server
[
'timeout'
])
?
(
int
)
$server
[
'timeout'
]
:
1
;
$server
[
'presistent'
]
=
isset
(
$server
[
'presistent'
])
?
(
bool
)
$server
[
'presistent'
]
:
false
;
$server
[
'weight'
]
=
isset
(
$server
[
'weight'
])
?
(
bool
)
$server
[
'weight'
]
:
1
;
}
}
laravel/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php
0 → 100755
View file @
cb567c5e
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace
Symfony\Component\HttpFoundation\Session\Storage\Handler
;
/**
* MongoDB session handler
*
* @author Markus Bachmann <markus.bachmann@bachi.biz>
*/
class
MongoDbSessionHandler
implements
\SessionHandlerInterface
{
/**
* @var \Mongo
*/
private
$mongo
;
/**
* @var \MongoCollection
*/
private
$collection
;
/**
* @var array
*/
private
$options
;
/**
* Constructor.
*
* @param \Mongo|\MongoClient $mongo A MongoClient or Mongo instance
* @param array $options An associative array of field options
*
* @throws \InvalidArgumentException When MongoClient or Mongo instance not provided
* @throws \InvalidArgumentException When "database" or "collection" not provided
*/
public
function
__construct
(
$mongo
,
array
$options
)
{
if
(
!
(
$mongo
instanceof
\MongoClient
||
$mongo
instanceof
\Mongo
))
{
throw
new
\InvalidArgumentException
(
'MongoClient or Mongo instance required'
);
}
if
(
!
isset
(
$options
[
'database'
])
||
!
isset
(
$options
[
'collection'
]))
{
throw
new
\InvalidArgumentException
(
'You must provide the "database" and "collection" option for MongoDBSessionHandler'
);
}
$this
->
mongo
=
$mongo
;
$this
->
options
=
array_merge
(
array
(
'id_field'
=>
'sess_id'
,
'data_field'
=>
'sess_data'
,
'time_field'
=>
'sess_time'
,
),
$options
);
}
/**
* {@inheritDoc}
*/
public
function
open
(
$savePath
,
$sessionName
)
{
return
true
;
}
/**
* {@inheritDoc}
*/
public
function
close
()
{
return
true
;
}
/**
* {@inheritDoc}
*/
public
function
destroy
(
$sessionId
)
{
$this
->
getCollection
()
->
remove
(
array
(
$this
->
options
[
'id_field'
]
=>
$sessionId
),
array
(
'justOne'
=>
true
)
);
return
true
;
}
/**
* {@inheritDoc}
*/
public
function
gc
(
$lifetime
)
{
$time
=
new
\MongoTimestamp
(
time
()
-
$lifetime
);
$this
->
getCollection
()
->
remove
(
array
(
$this
->
options
[
'time_field'
]
=>
array
(
'$lt'
=>
$time
),
));
}
/**
* {@inheritDoc]
*/
public
function
write
(
$sessionId
,
$data
)
{
$data
=
array
(
$this
->
options
[
'id_field'
]
=>
$sessionId
,
$this
->
options
[
'data_field'
]
=>
new
\MongoBinData
(
$data
,
\MongoBinData
::
BYTE_ARRAY
),
$this
->
options
[
'time_field'
]
=>
new
\MongoTimestamp
()
);
$this
->
getCollection
()
->
update
(
array
(
$this
->
options
[
'id_field'
]
=>
$sessionId
),
array
(
'$set'
=>
$data
),
array
(
'upsert'
=>
true
)
);
return
true
;
}
/**
* {@inheritDoc}
*/
public
function
read
(
$sessionId
)
{
$dbData
=
$this
->
getCollection
()
->
findOne
(
array
(
$this
->
options
[
'id_field'
]
=>
$sessionId
,
));
return
null
===
$dbData
?
''
:
$dbData
[
$this
->
options
[
'data_field'
]]
->
bin
;
}
/**
* Return a "MongoCollection" instance
*
* @return \MongoCollection
*/
private
function
getCollection
()
{
if
(
null
===
$this
->
collection
)
{
$this
->
collection
=
$this
->
mongo
->
selectCollection
(
$this
->
options
[
'database'
],
$this
->
options
[
'collection'
]);
}
return
$this
->
collection
;
}
}
laravel/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeFileSessionHandler.php
View file @
cb567c5e
...
...
@@ -23,7 +23,13 @@ class NativeFileSessionHandler extends NativeSessionHandler
/**
* Constructor.
*
* @param string $savePath Path of directory to save session files. Default null will leave setting as defined by PHP.
* @param string $savePath Path of directory to save session files.
* Default null will leave setting as defined by PHP.
* '/path', 'N;/path', or 'N;octal-mode;/path
*
* @see http://php.net/session.configuration.php#ini.session.save-path for further details.
*
* @throws \InvalidArgumentException On invalid $savePath
*/
public
function
__construct
(
$savePath
=
null
)
{
...
...
@@ -31,11 +37,22 @@ class NativeFileSessionHandler extends NativeSessionHandler
$savePath
=
ini_get
(
'session.save_path'
);
}
if
(
$savePath
&&
!
is_dir
(
$savePath
))
{
mkdir
(
$savePath
,
0777
,
true
);
$baseDir
=
$savePath
;
if
(
$count
=
substr_count
(
$savePath
,
';'
))
{
if
(
$count
>
2
)
{
throw
new
\InvalidArgumentException
(
sprintf
(
'Invalid argument $savePath \'%s\''
,
$savePath
));
}
// characters after last ';' are the path
$baseDir
=
ltrim
(
strrchr
(
$savePath
,
';'
),
';'
);
}
if
(
$baseDir
&&
!
is_dir
(
$baseDir
))
{
mkdir
(
$baseDir
,
0777
,
true
);
}
ini_set
(
'session.save_handler'
,
'files'
);
ini_set
(
'session.save_path'
,
$savePath
);
ini_set
(
'session.save_handler'
,
'files'
);
}
}
laravel/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeMemcacheSessionHandler.php
deleted
100755 → 0
View file @
f754e1fa
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace
Symfony\Component\HttpFoundation\Session\Storage\Handler
;
/**
* NativeMemcacheSessionHandler.
*
* Driver for the memcache session save hadlers provided by the memcache PHP extension.
*
* @see http://php.net/memcache
*
* @author Drak <drak@zikula.org>
*/
class
NativeMemcacheSessionHandler
extends
NativeSessionHandler
{
/**
* Constructor.
*
* @param string $savePath Path of memcache server.
* @param array $options Session configuration options.
*/
public
function
__construct
(
$savePath
=
'tcp://127.0.0.1:11211?persistent=0'
,
array
$options
=
array
())
{
if
(
!
extension_loaded
(
'memcache'
))
{
throw
new
\RuntimeException
(
'PHP does not have "memcache" session module registered'
);
}
if
(
null
===
$savePath
)
{
$savePath
=
ini_get
(
'session.save_path'
);
}
ini_set
(
'session.save_handler'
,
'memcache'
);
ini_set
(
'session.save_path'
,
$savePath
);
$this
->
setOptions
(
$options
);
}
/**
* Set any memcached ini values.
*
* @see http://php.net/memcache.ini
*/
protected
function
setOptions
(
array
$options
)
{
foreach
(
$options
as
$key
=>
$value
)
{
if
(
in_array
(
$key
,
array
(
'memcache.allow_failover'
,
'memcache.max_failover_attempts'
,
'memcache.chunk_size'
,
'memcache.default_port'
,
'memcache.hash_strategy'
,
'memcache.hash_function'
,
'memcache.protocol'
,
'memcache.redundancy'
,
'memcache.session_redundancy'
,
'memcache.compress_threshold'
,
'memcache.lock_timeout'
)))
{
ini_set
(
$key
,
$value
);
}
}
}
}
laravel/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeMemcachedSessionHandler.php
deleted
100755 → 0
View file @
f754e1fa
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace
Symfony\Component\HttpFoundation\Session\Storage\Handler
;
/**
* NativeMemcachedSessionHandler.
*
* Driver for the memcached session save hadlers provided by the memcached PHP extension.
*
* @see http://php.net/memcached.sessions
*
* @author Drak <drak@zikula.org>
*/
class
NativeMemcachedSessionHandler
extends
NativeSessionHandler
{
/**
* Constructor.
*
* @param string $savePath Comma separated list of servers: e.g. memcache1.example.com:11211,memcache2.example.com:11211
* @param array $options Session configuration options.
*/
public
function
__construct
(
$savePath
=
'127.0.0.1:11211'
,
array
$options
=
array
())
{
if
(
!
extension_loaded
(
'memcached'
))
{
throw
new
\RuntimeException
(
'PHP does not have "memcached" session module registered'
);
}
if
(
null
===
$savePath
)
{
$savePath
=
ini_get
(
'session.save_path'
);
}
ini_set
(
'session.save_handler'
,
'memcached'
);
ini_set
(
'session.save_path'
,
$savePath
);
$this
->
setOptions
(
$options
);
}
/**
* Set any memcached ini values.
*
* @see https://github.com/php-memcached-dev/php-memcached/blob/master/memcached.ini
*/
protected
function
setOptions
(
array
$options
)
{
foreach
(
$options
as
$key
=>
$value
)
{
if
(
in_array
(
$key
,
array
(
'memcached.sess_locking'
,
'memcached.sess_lock_wait'
,
'memcached.sess_prefix'
,
'memcached.compression_type'
,
'memcached.compression_factor'
,
'memcached.compression_threshold'
,
'memcached.serializer'
)))
{
ini_set
(
$key
,
$value
);
}
}
}
}
laravel/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSqliteSessionHandler.php
deleted
100755 → 0
View file @
f754e1fa
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace
Symfony\Component\HttpFoundation\Session\Storage\Handler
;
/**
* NativeSqliteSessionHandler.
*
* Driver for the sqlite session save hadlers provided by the SQLite PHP extension.
*
* @author Drak <drak@zikula.org>
*/
class
NativeSqliteSessionHandler
extends
NativeSessionHandler
{
/**
* Constructor.
*
* @param string $savePath Path to SQLite database file itself.
* @param array $options Session configuration options.
*/
public
function
__construct
(
$savePath
,
array
$options
=
array
())
{
if
(
!
extension_loaded
(
'sqlite'
))
{
throw
new
\RuntimeException
(
'PHP does not have "sqlite" session module registered'
);
}
if
(
null
===
$savePath
)
{
$savePath
=
ini_get
(
'session.save_path'
);
}
ini_set
(
'session.save_handler'
,
'sqlite'
);
ini_set
(
'session.save_path'
,
$savePath
);
$this
->
setOptions
(
$options
);
}
/**
* Set any sqlite ini values.
*
* @see http://php.net/sqlite.configuration
*/
protected
function
setOptions
(
array
$options
)
{
foreach
(
$options
as
$key
=>
$value
)
{
if
(
in_array
(
$key
,
array
(
'sqlite.assoc_case'
)))
{
ini_set
(
$key
,
$value
);
}
}
}
}
laravel/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/NullSessionHandler.php
View file @
cb567c5e
...
...
@@ -14,7 +14,7 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
/**
* NullSessionHandler.
*
* Can be used in unit testing or in a sit
ation
where persisted sessions are not desired.
* Can be used in unit testing or in a sit
uations
where persisted sessions are not desired.
*
* @author Drak <drak@zikula.org>
*
...
...
laravel/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php
View file @
cb567c5e
...
...
@@ -20,30 +20,30 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
class
PdoSessionHandler
implements
\SessionHandlerInterface
{
/**
* PDO instance.
*
* @var \PDO
* @var \PDO PDO instance.
*/
private
$pdo
;
/**
* Database options.
*
*
* @var array
* @var array Database options.
*/
private
$dbOptions
;
/**
* Constructor.
*
* List of available options:
* * db_table: The name of the table [required]
* * db_id_col: The column where to store the session id [default: sess_id]
* * db_data_col: The column where to store the session data [default: sess_data]
* * db_time_col: The column where to store the timestamp [default: sess_time]
*
* @param \PDO $pdo A \PDO instance
* @param array $dbOptions An associative array of DB options
* @param array $options Session configuration options
*
* @throws \InvalidArgumentException When "db_table" option is not provided
*/
public
function
__construct
(
\PDO
$pdo
,
array
$dbOptions
=
array
()
,
array
$options
=
array
()
)
public
function
__construct
(
\PDO
$pdo
,
array
$dbOptions
=
array
())
{
if
(
!
array_key_exists
(
'db_table'
,
$dbOptions
))
{
throw
new
\InvalidArgumentException
(
'You must provide the "db_table" option for a PdoSessionStorage.'
);
...
...
@@ -58,7 +58,7 @@ class PdoSessionHandler implements \SessionHandlerInterface
}
/**
* {@inherit
d
oc}
* {@inherit
D
oc}
*/
public
function
open
(
$path
,
$name
)
{
...
...
@@ -66,7 +66,7 @@ class PdoSessionHandler implements \SessionHandlerInterface
}
/**
* {@inherit
d
oc}
* {@inherit
D
oc}
*/
public
function
close
()
{
...
...
@@ -74,7 +74,7 @@ class PdoSessionHandler implements \SessionHandlerInterface
}
/**
* {@inherit
d
oc}
* {@inherit
D
oc}
*/
public
function
destroy
(
$id
)
{
...
...
@@ -97,7 +97,7 @@ class PdoSessionHandler implements \SessionHandlerInterface
}
/**
* {@inherit
d
oc}
* {@inherit
D
oc}
*/
public
function
gc
(
$lifetime
)
{
...
...
@@ -106,11 +106,11 @@ class PdoSessionHandler implements \SessionHandlerInterface
$dbTimeCol
=
$this
->
dbOptions
[
'db_time_col'
];
// delete the session records that have expired
$sql
=
"DELETE FROM
$dbTable
WHERE
$dbTimeCol
<
(:time -
$lifetime
)
"
;
$sql
=
"DELETE FROM
$dbTable
WHERE
$dbTimeCol
<
:time
"
;
try
{
$stmt
=
$this
->
pdo
->
prepare
(
$sql
);
$stmt
->
bindValue
(
':time'
,
time
(),
\PDO
::
PARAM_INT
);
$stmt
->
bindValue
(
':time'
,
time
()
-
$lifetime
,
\PDO
::
PARAM_INT
);
$stmt
->
execute
();
}
catch
(
\PDOException
$e
)
{
throw
new
\RuntimeException
(
sprintf
(
'PDOException was thrown when trying to manipulate session data: %s'
,
$e
->
getMessage
()),
0
,
$e
);
...
...
@@ -120,7 +120,7 @@ class PdoSessionHandler implements \SessionHandlerInterface
}
/**
* {@inherit
d
oc}
* {@inherit
D
oc}
*/
public
function
read
(
$id
)
{
...
...
@@ -154,7 +154,7 @@ class PdoSessionHandler implements \SessionHandlerInterface
}
/**
* {@inherit
d
oc}
* {@inherit
D
oc}
*/
public
function
write
(
$id
,
$data
)
{
...
...
@@ -164,15 +164,34 @@ class PdoSessionHandler implements \SessionHandlerInterface
$dbIdCol
=
$this
->
dbOptions
[
'db_id_col'
];
$dbTimeCol
=
$this
->
dbOptions
[
'db_time_col'
];
$sql
=
(
'mysql'
===
$this
->
pdo
->
getAttribute
(
\PDO
::
ATTR_DRIVER_NAME
))
?
"INSERT INTO
$dbTable
(
$dbIdCol
,
$dbDataCol
,
$dbTimeCol
) VALUES (:id, :data, :time) "
.
"ON DUPLICATE KEY UPDATE
$dbDataCol
= VALUES(
$dbDataCol
),
$dbTimeCol
= CASE WHEN
$dbTimeCol
= :time THEN (VALUES(
$dbTimeCol
) + 1) ELSE VALUES(
$dbTimeCol
) END"
:
"UPDATE
$dbTable
SET
$dbDataCol
= :data,
$dbTimeCol
= :time WHERE
$dbIdCol
= :id"
;
try
{
//session data can contain non binary safe characters so we need to encode it
$encoded
=
base64_encode
(
$data
);
$stmt
=
$this
->
pdo
->
prepare
(
$sql
);
try
{
$driver
=
$this
->
pdo
->
getAttribute
(
\PDO
::
ATTR_DRIVER_NAME
);
if
(
'mysql'
===
$driver
)
{
// MySQL would report $stmt->rowCount() = 0 on UPDATE when the data is left unchanged
// it could result in calling createNewSession() whereas the session already exists in
// the DB which would fail as the id is unique
$stmt
=
$this
->
pdo
->
prepare
(
"INSERT INTO
$dbTable
(
$dbIdCol
,
$dbDataCol
,
$dbTimeCol
) VALUES (:id, :data, :time) "
.
"ON DUPLICATE KEY UPDATE
$dbDataCol
= VALUES(
$dbDataCol
),
$dbTimeCol
= VALUES(
$dbTimeCol
)"
);
$stmt
->
bindParam
(
':id'
,
$id
,
\PDO
::
PARAM_STR
);
$stmt
->
bindParam
(
':data'
,
$encoded
,
\PDO
::
PARAM_STR
);
$stmt
->
bindValue
(
':time'
,
time
(),
\PDO
::
PARAM_INT
);
$stmt
->
execute
();
}
elseif
(
'oci'
===
$driver
)
{
$stmt
=
$this
->
pdo
->
prepare
(
"MERGE INTO
$dbTable
USING DUAL ON(
$dbIdCol
= :id) "
.
"WHEN NOT MATCHED THEN INSERT (
$dbIdCol
,
$dbDataCol
,
$dbTimeCol
) VALUES (:id, :data, sysdate) "
.
"WHEN MATCHED THEN UPDATE SET
$dbDataCol
= :data WHERE
$dbIdCol
= :id"
);
$stmt
->
bindParam
(
':id'
,
$id
,
\PDO
::
PARAM_STR
);
$stmt
->
bindParam
(
':data'
,
$encoded
,
\PDO
::
PARAM_STR
);
$stmt
->
execute
();
}
else
{
$stmt
=
$this
->
pdo
->
prepare
(
"UPDATE
$dbTable
SET
$dbDataCol
= :data,
$dbTimeCol
= :time WHERE
$dbIdCol
= :id"
);
$stmt
->
bindParam
(
':id'
,
$id
,
\PDO
::
PARAM_STR
);
$stmt
->
bindParam
(
':data'
,
$encoded
,
\PDO
::
PARAM_STR
);
$stmt
->
bindValue
(
':time'
,
time
(),
\PDO
::
PARAM_INT
);
...
...
@@ -183,6 +202,7 @@ class PdoSessionHandler implements \SessionHandlerInterface
// session_regenerate_id()
$this
->
createNewSession
(
$id
,
$data
);
}
}
}
catch
(
\PDOException
$e
)
{
throw
new
\RuntimeException
(
sprintf
(
'PDOException was thrown when trying to write the session data: %s'
,
$e
->
getMessage
()),
0
,
$e
);
}
...
...
laravel/vendor/Symfony/Component/HttpFoundation/Session/Storage/MetadataBag.php
0 → 100755
View file @
cb567c5e
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace
Symfony\Component\HttpFoundation\Session\Storage
;
use
Symfony\Component\HttpFoundation\Session\SessionBagInterface
;
/**
* Metadata container.
*
* Adds metadata to the session.
*
* @author Drak <drak@zikula.org>
*/
class
MetadataBag
implements
SessionBagInterface
{
const
CREATED
=
'c'
;
const
UPDATED
=
'u'
;
const
LIFETIME
=
'l'
;
/**
* @var string
*/
private
$name
=
'__metadata'
;
/**
* @var string
*/
private
$storageKey
;
/**
* @var array
*/
protected
$meta
=
array
();
/**
* Unix timestamp.
*
* @var integer
*/
private
$lastUsed
;
/**
* Constructor.
*
* @param string $storageKey The key used to store bag in the session.
*/
public
function
__construct
(
$storageKey
=
'_sf2_meta'
)
{
$this
->
storageKey
=
$storageKey
;
$this
->
meta
=
array
(
self
::
CREATED
=>
0
,
self
::
UPDATED
=>
0
,
self
::
LIFETIME
=>
0
);
}
/**
* {@inheritdoc}
*/
public
function
initialize
(
array
&
$array
)
{
$this
->
meta
=
&
$array
;
if
(
isset
(
$array
[
self
::
CREATED
]))
{
$this
->
lastUsed
=
$this
->
meta
[
self
::
UPDATED
];
$this
->
meta
[
self
::
UPDATED
]
=
time
();
}
else
{
$this
->
stampCreated
();
}
}
/**
* Gets the lifetime that the session cookie was set with.
*
* @return integer
*/
public
function
getLifetime
()
{
return
$this
->
meta
[
self
::
LIFETIME
];
}
/**
* Stamps a new session's metadata.
*
* @param integer $lifetime Sets the cookie lifetime for the session cookie. A null value
* will leave the system settings unchanged, 0 sets the cookie
* to expire with browser session. Time is in seconds, and is
* not a Unix timestamp.
*/
public
function
stampNew
(
$lifetime
=
null
)
{
$this
->
stampCreated
(
$lifetime
);
}
/**
* {@inheritdoc}
*/
public
function
getStorageKey
()
{
return
$this
->
storageKey
;
}
/**
* Gets the created timestamp metadata.
*
* @return integer Unix timestamp
*/
public
function
getCreated
()
{
return
$this
->
meta
[
self
::
CREATED
];
}
/**
* Gets the last used metadata.
*
* @return integer Unix timestamp
*/
public
function
getLastUsed
()
{
return
$this
->
lastUsed
;
}
/**
* {@inheritdoc}
*/
public
function
clear
()
{
// nothing to do
}
/**
* {@inheritdoc}
*/
public
function
getName
()
{
return
$this
->
name
;
}
/**
* Sets name.
*
* @param string $name
*/
public
function
setName
(
$name
)
{
$this
->
name
=
$name
;
}
private
function
stampCreated
(
$lifetime
=
null
)
{
$timeStamp
=
time
();
$this
->
meta
[
self
::
CREATED
]
=
$this
->
meta
[
self
::
UPDATED
]
=
$this
->
lastUsed
=
$timeStamp
;
$this
->
meta
[
self
::
LIFETIME
]
=
(
null
===
$lifetime
)
?
ini_get
(
'session.cookie_lifetime'
)
:
$lifetime
;
}
}
laravel/vendor/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php
View file @
cb567c5e
...
...
@@ -12,6 +12,7 @@
namespace
Symfony\Component\HttpFoundation\Session\Storage
;
use
Symfony\Component\HttpFoundation\Session\SessionBagInterface
;
use
Symfony\Component\HttpFoundation\Session\Storage\MetadataBag
;
/**
* MockArraySessionStorage mocks the session for unit tests.
...
...
@@ -52,14 +53,26 @@ class MockArraySessionStorage implements SessionStorageInterface
*/
protected
$data
=
array
();
/**
* @var MetadataBag
*/
protected
$metadataBag
;
/**
* @var array
*/
protected
$bags
;
/**
* Constructor.
*
* @param string $name Session name
* @param MetadataBag $metaBag MetadataBag instance.
*/
public
function
__construct
(
$name
=
'MOCKSESSID'
)
public
function
__construct
(
$name
=
'MOCKSESSID'
,
MetadataBag
$metaBag
=
null
)
{
$this
->
name
=
$name
;
$this
->
setMetadataBag
(
$metaBag
);
}
/**
...
...
@@ -90,16 +103,16 @@ class MockArraySessionStorage implements SessionStorageInterface
return
true
;
}
/**
* {@inheritdoc}
*/
public
function
regenerate
(
$destroy
=
false
)
public
function
regenerate
(
$destroy
=
false
,
$lifetime
=
null
)
{
if
(
!
$this
->
started
)
{
$this
->
start
();
}
$this
->
metadataBag
->
stampNew
(
$lifetime
);
$this
->
id
=
$this
->
generateId
();
return
true
;
...
...
@@ -146,6 +159,9 @@ class MockArraySessionStorage implements SessionStorageInterface
*/
public
function
save
()
{
if
(
!
$this
->
started
||
$this
->
closed
)
{
throw
new
\RuntimeException
(
"Trying to save a session that was not started yet or was already closed"
);
}
// nothing to do since we don't persist the session data
$this
->
closed
=
false
;
}
...
...
@@ -191,6 +207,38 @@ class MockArraySessionStorage implements SessionStorageInterface
return
$this
->
bags
[
$name
];
}
/**
* {@inheritdoc}
*/
public
function
isStarted
()
{
return
$this
->
started
;
}
/**
* Sets the MetadataBag.
*
* @param MetadataBag $bag
*/
public
function
setMetadataBag
(
MetadataBag
$bag
=
null
)
{
if
(
null
===
$bag
)
{
$bag
=
new
MetadataBag
();
}
$this
->
metadataBag
=
$bag
;
}
/**
* Gets the MetadataBag.
*
* @return MetadataBag
*/
public
function
getMetadataBag
()
{
return
$this
->
metadataBag
;
}
/**
* Generates a session ID.
*
...
...
@@ -206,7 +254,9 @@ class MockArraySessionStorage implements SessionStorageInterface
protected
function
loadSession
()
{
foreach
(
$this
->
bags
as
$bag
)
{
$bags
=
array_merge
(
$this
->
bags
,
array
(
$this
->
metadataBag
));
foreach
(
$bags
as
$bag
)
{
$key
=
$bag
->
getStorageKey
();
$this
->
data
[
$key
]
=
isset
(
$this
->
data
[
$key
])
?
$this
->
data
[
$key
]
:
array
();
$bag
->
initialize
(
$this
->
data
[
$key
]);
...
...
laravel/vendor/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php
View file @
cb567c5e
...
...
@@ -29,13 +29,19 @@ class MockFileSessionStorage extends MockArraySessionStorage
*/
private
$savePath
;
/**
* @var array
*/
private
$sessionData
;
/**
* Constructor.
*
* @param string $savePath Path of directory to save session files.
* @param string $name Session name.
* @param MetadataBag $metaBag MetadataBag instance.
*/
public
function
__construct
(
$savePath
=
null
,
$name
=
'MOCKSESSID'
)
public
function
__construct
(
$savePath
=
null
,
$name
=
'MOCKSESSID'
,
MetadataBag
$metaBag
=
null
)
{
if
(
null
===
$savePath
)
{
$savePath
=
sys_get_temp_dir
();
...
...
@@ -47,7 +53,7 @@ class MockFileSessionStorage extends MockArraySessionStorage
$this
->
savePath
=
$savePath
;
parent
::
__construct
(
$name
);
parent
::
__construct
(
$name
,
$metaBag
);
}
/**
...
...
@@ -73,15 +79,17 @@ class MockFileSessionStorage extends MockArraySessionStorage
/**
* {@inheritdoc}
*/
public
function
regenerate
(
$destroy
=
false
)
public
function
regenerate
(
$destroy
=
false
,
$lifetime
=
null
)
{
if
(
!
$this
->
started
)
{
$this
->
start
();
}
if
(
$destroy
)
{
$this
->
destroy
();
}
$this
->
id
=
$this
->
generateId
();
return
true
;
return
parent
::
regenerate
(
$destroy
,
$lifetime
);
}
/**
...
...
@@ -89,7 +97,16 @@ class MockFileSessionStorage extends MockArraySessionStorage
*/
public
function
save
()
{
if
(
!
$this
->
started
)
{
throw
new
\RuntimeException
(
"Trying to save a session that was not started yet or was already closed"
);
}
file_put_contents
(
$this
->
getFilePath
(),
serialize
(
$this
->
data
));
// this is needed for Silex, where the session object is re-used across requests
// in functional tests. In Symfony, the container is rebooted, so we don't have
// this issue
$this
->
started
=
false
;
}
/**
...
...
laravel/vendor/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php
View file @
cb567c5e
...
...
@@ -12,6 +12,7 @@
namespace
Symfony\Component\HttpFoundation\Session\Storage
;
use
Symfony\Component\HttpFoundation\Session\SessionBagInterface
;
use
Symfony\Component\HttpFoundation\Session\Storage\MetadataBag
;
use
Symfony\Component\HttpFoundation\Session\Storage\Proxy\NativeProxy
;
use
Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy
;
use
Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy
;
...
...
@@ -45,17 +46,24 @@ class NativeSessionStorage implements SessionStorageInterface
*/
protected
$saveHandler
;
/**
* @var MetadataBag
*/
protected
$metadataBag
;
/**
* Constructor.
*
* Depending on how you want the storage driver to behave you probably
* want to
p
override this constructor entirely.
* want to override this constructor entirely.
*
* List of options for $options array with their defaults.
* @see http://php.net/session.configuration for options
* but we omit 'session.' from the beginning of the keys for convenience.
*
* auto_start, "0"
* ("auto_start", is not supported as it tells PHP to start a session before
* PHP starts to execute user-land code. Setting during runtime has no effect).
*
* cache_limiter, "nocache" (use "0" to prevent headers from being sent entirely).
* cookie_domain, ""
* cookie_httponly, ""
...
...
@@ -85,11 +93,10 @@ class NativeSessionStorage implements SessionStorageInterface
*
* @param array $options Session configuration options.
* @param object $handler SessionHandlerInterface.
* @param MetadataBag $metaBag MetadataBag.
*/
public
function
__construct
(
array
$options
=
array
(),
$handler
=
null
)
public
function
__construct
(
array
$options
=
array
(),
$handler
=
null
,
MetadataBag
$metaBag
=
null
)
{
// sensible defaults
ini_set
(
'session.auto_start'
,
0
);
// by default we prefer to explicitly start the session using the class.
ini_set
(
'session.cache_limiter'
,
''
);
// disable by default because it's managed by HeaderBag (if used)
ini_set
(
'session.use_cookies'
,
1
);
...
...
@@ -99,6 +106,7 @@ class NativeSessionStorage implements SessionStorageInterface
register_shutdown_function
(
'session_write_close'
);
}
$this
->
setMetadataBag
(
$metaBag
);
$this
->
setOptions
(
$options
);
$this
->
setSaveHandler
(
$handler
);
}
...
...
@@ -165,7 +173,7 @@ class NativeSessionStorage implements SessionStorageInterface
*/
public
function
setId
(
$id
)
{
return
$this
->
saveHandler
->
setId
(
$id
);
$this
->
saveHandler
->
setId
(
$id
);
}
/**
...
...
@@ -187,8 +195,16 @@ class NativeSessionStorage implements SessionStorageInterface
/**
* {@inheritdoc}
*/
public
function
regenerate
(
$destroy
=
false
)
public
function
regenerate
(
$destroy
=
false
,
$lifetime
=
null
)
{
if
(
null
!==
$lifetime
)
{
ini_set
(
'session.cookie_lifetime'
,
$lifetime
);
}
if
(
$destroy
)
{
$this
->
metadataBag
->
stampNew
();
}
return
session_regenerate_id
(
$destroy
);
}
...
...
@@ -240,15 +256,47 @@ class NativeSessionStorage implements SessionStorageInterface
throw
new
\InvalidArgumentException
(
sprintf
(
'The SessionBagInterface %s is not registered.'
,
$name
));
}
if
(
ini_get
(
'session.auto_start'
)
&&
!
$this
->
started
)
{
$this
->
start
();
}
elseif
(
$this
->
saveHandler
->
isActive
()
&&
!
$this
->
started
)
{
if
(
$this
->
saveHandler
->
isActive
()
&&
!
$this
->
started
)
{
$this
->
loadSession
();
}
elseif
(
!
$this
->
started
)
{
$this
->
start
();
}
return
$this
->
bags
[
$name
];
}
/**
* Sets the MetadataBag.
*
* @param MetadataBag $metaBag
*/
public
function
setMetadataBag
(
MetadataBag
$metaBag
=
null
)
{
if
(
null
===
$metaBag
)
{
$metaBag
=
new
MetadataBag
();
}
$this
->
metadataBag
=
$metaBag
;
}
/**
* Gets the MetadataBag.
*
* @return MetadataBag
*/
public
function
getMetadataBag
()
{
return
$this
->
metadataBag
;
}
/**
* {@inheritdoc}
*/
public
function
isStarted
()
{
return
$this
->
started
;
}
/**
* Sets session.* ini variables.
*
...
...
@@ -261,9 +309,8 @@ class NativeSessionStorage implements SessionStorageInterface
*/
public
function
setOptions
(
array
$options
)
{
foreach
(
$options
as
$key
=>
$value
)
{
if
(
in_array
(
$key
,
array
(
'auto_start'
,
'cache_limiter'
,
'cookie_domain'
,
'cookie_httponly'
,
$validOptions
=
array_flip
(
array
(
'cache_limiter'
,
'cookie_domain'
,
'cookie_httponly'
,
'cookie_lifetime'
,
'cookie_path'
,
'cookie_secure'
,
'entropy_file'
,
'entropy_length'
,
'gc_divisor'
,
'gc_maxlifetime'
,
'gc_probability'
,
'hash_bits_per_character'
,
...
...
@@ -271,7 +318,11 @@ class NativeSessionStorage implements SessionStorageInterface
'serialize_handler'
,
'use_cookies'
,
'use_only_cookies'
,
'use_trans_sid'
,
'upload_progress.enabled'
,
'upload_progress.cleanup'
,
'upload_progress.prefix'
,
'upload_progress.name'
,
'upload_progress.freq'
,
'upload_progress.min-freq'
,
'url_rewriter.tags'
)))
{
'upload_progress.freq'
,
'upload_progress.min-freq'
,
'url_rewriter.tags'
,
));
foreach
(
$options
as
$key
=>
$value
)
{
if
(
isset
(
$validOptions
[
$key
]))
{
ini_set
(
'session.'
.
$key
,
$value
);
}
}
...
...
@@ -298,7 +349,7 @@ class NativeSessionStorage implements SessionStorageInterface
if
(
!
$saveHandler
instanceof
AbstractProxy
&&
$saveHandler
instanceof
\SessionHandlerInterface
)
{
$saveHandler
=
new
SessionHandlerProxy
(
$saveHandler
);
}
elseif
(
!
$saveHandler
instanceof
AbstractProxy
)
{
$saveHandler
=
new
NativeProxy
(
$saveHandler
);
$saveHandler
=
new
NativeProxy
();
}
$this
->
saveHandler
=
$saveHandler
;
...
...
@@ -335,7 +386,9 @@ class NativeSessionStorage implements SessionStorageInterface
$session
=
&
$_SESSION
;
}
foreach
(
$this
->
bags
as
$bag
)
{
$bags
=
array_merge
(
$this
->
bags
,
array
(
$this
->
metadataBag
));
foreach
(
$bags
as
$bag
)
{
$key
=
$bag
->
getStorageKey
();
$session
[
$key
]
=
isset
(
$session
[
$key
])
?
$session
[
$key
]
:
array
();
$bag
->
initialize
(
$session
[
$key
]);
...
...
laravel/vendor/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php
View file @
cb567c5e
...
...
@@ -58,7 +58,7 @@ abstract class AbstractProxy
/**
* Returns true if this handler wraps an internal PHP session save handler using \SessionHandler.
*
* @return
bool
* @return
Boolean
*/
public
function
isWrapper
()
{
...
...
@@ -68,7 +68,7 @@ abstract class AbstractProxy
/**
* Has a session started?
*
* @return
bool
* @return
Boolean
*/
public
function
isActive
()
{
...
...
@@ -78,7 +78,7 @@ abstract class AbstractProxy
/**
* Sets the active flag.
*
* @param
bool
$flag
* @param
Boolean
$flag
*/
public
function
setActive
(
$flag
)
{
...
...
laravel/vendor/Symfony/Component/HttpFoundation/Session/Storage/Proxy/NativeProxy.php
View file @
cb567c5e
...
...
@@ -32,7 +32,7 @@ class NativeProxy extends AbstractProxy
/**
* Returns true if this handler wraps an internal PHP session save handler using \SessionHandler.
*
* @return
bool
False.
* @return
Boolean
False.
*/
public
function
isWrapper
()
{
...
...
laravel/vendor/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php
View file @
cb567c5e
...
...
@@ -42,7 +42,7 @@ class SessionHandlerProxy extends AbstractProxy implements \SessionHandlerInterf
*/
public
function
open
(
$savePath
,
$sessionName
)
{
$return
=
(
bool
)
$this
->
handler
->
open
(
$savePath
,
$sessionName
);
$return
=
(
bool
)
$this
->
handler
->
open
(
$savePath
,
$sessionName
);
if
(
true
===
$return
)
{
$this
->
active
=
true
;
...
...
laravel/vendor/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php
View file @
cb567c5e
...
...
@@ -12,6 +12,7 @@
namespace
Symfony\Component\HttpFoundation\Session\Storage
;
use
Symfony\Component\HttpFoundation\Session\SessionBagInterface
;
use
Symfony\Component\HttpFoundation\Session\Storage\MetadataBag
;
/**
* StorageInterface.
...
...
@@ -32,7 +33,14 @@ interface SessionStorageInterface
*
* @api
*/
function
start
();
public
function
start
();
/**
* Checks if the session is started.
*
* @return boolean True if started, false otherwise.
*/
public
function
isStarted
();
/**
* Returns the session ID
...
...
@@ -41,7 +49,7 @@ interface SessionStorageInterface
*
* @api
*/
function
getId
();
public
function
getId
();
/**
* Sets the session ID
...
...
@@ -50,7 +58,7 @@ interface SessionStorageInterface
*
* @api
*/
function
setId
(
$id
);
public
function
setId
(
$id
);
/**
* Returns the session name
...
...
@@ -59,7 +67,7 @@ interface SessionStorageInterface
*
* @api
*/
function
getName
();
public
function
getName
();
/**
* Sets the session name
...
...
@@ -68,7 +76,7 @@ interface SessionStorageInterface
*
* @api
*/
function
setName
(
$name
);
public
function
setName
(
$name
);
/**
* Regenerates id that represents this storage.
...
...
@@ -82,6 +90,10 @@ interface SessionStorageInterface
* only delete the session data from persistent storage.
*
* @param Boolean $destroy Destroy session when regenerating?
* @param integer $lifetime Sets the cookie lifetime for the session cookie. A null value
* will leave the system settings unchanged, 0 sets the cookie
* to expire with browser session. Time is in seconds, and is
* not a Unix timestamp.
*
* @return Boolean True if session regenerated, false if error
*
...
...
@@ -89,7 +101,7 @@ interface SessionStorageInterface
*
* @api
*/
function
regenerate
(
$destroy
=
false
);
public
function
regenerate
(
$destroy
=
false
,
$lifetime
=
null
);
/**
* Force the session to be saved and closed.
...
...
@@ -98,13 +110,16 @@ interface SessionStorageInterface
* used for a storage object design for unit or functional testing where
* a real PHP session would interfere with testing, in which case it
* it should actually persist the session data if required.
*
* @throws \RuntimeException If the session is saved without being started, or if the session
* is already closed.
*/
function
save
();
public
function
save
();
/**
* Clear all session data in memory.
*/
function
clear
();
public
function
clear
();
/**
* Gets a SessionBagInterface by name.
...
...
@@ -115,12 +130,17 @@ interface SessionStorageInterface
*
* @throws \InvalidArgumentException If the bag does not exist
*/
function
getBag
(
$name
);
public
function
getBag
(
$name
);
/**
* Registers a SessionBagInterface for use.
*
* @param SessionBagInterface $bag
*/
function
registerBag
(
SessionBagInterface
$bag
);
public
function
registerBag
(
SessionBagInterface
$bag
);
/**
* @return MetadataBag
*/
public
function
getMetadataBag
();
}
laravel/vendor/Symfony/Component/HttpFoundation/StreamedResponse.php
View file @
cb567c5e
...
...
@@ -72,21 +72,17 @@ class StreamedResponse extends Response
}
/**
*
@{
inheritdoc}
*
{@
inheritdoc}
*/
public
function
prepare
(
Request
$request
)
{
if
(
'1.0'
!=
$request
->
server
->
get
(
'SERVER_PROTOCOL'
))
{
$this
->
setProtocolVersion
(
'1.1'
);
}
$this
->
headers
->
set
(
'Cache-Control'
,
'no-cache'
);
parent
::
prepare
(
$request
);
return
parent
::
prepare
(
$request
);
}
/**
*
@{
inheritdoc}
*
{@
inheritdoc}
*
* This method only sends the content once.
*/
...
...
@@ -106,7 +102,7 @@ class StreamedResponse extends Response
}
/**
*
@{
inheritdoc}
*
{@
inheritdoc}
*
* @throws \LogicException when the content is not null
*/
...
...
@@ -118,7 +114,7 @@ class StreamedResponse extends Response
}
/**
*
@{
inheritdoc}
*
{@
inheritdoc}
*
* @return false
*/
...
...
laravel/vendor/Symfony/Component/HttpFoundation/composer.json
View file @
cb567c5e
...
...
@@ -16,7 +16,7 @@
}
],
"require"
:
{
"php"
:
">=5.3.
2
"
"php"
:
">=5.3.
3
"
},
"autoload"
:
{
"psr-0"
:
{
...
...
@@ -25,9 +25,5 @@
}
},
"target-dir"
:
"Symfony/Component/HttpFoundation"
,
"extra"
:
{
"branch-alias"
:
{
"dev-master"
:
"2.1-dev"
}
}
"minimum-stability"
:
"dev"
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment