- Patch #1343160 by msonnabaum: update Symfony2 components to latest release.

8.0.x
Dries 2012-02-23 09:24:11 -05:00
parent b956b400dd
commit 87e5ffc3b5
19 changed files with 113 additions and 75 deletions

View File

@ -17,7 +17,7 @@ namespace Symfony\Component\ClassLoader;
* It is able to load classes that use either: * It is able to load classes that use either:
* *
* * The technical interoperability standards for PHP 5.3 namespaces and * * The technical interoperability standards for PHP 5.3 namespaces and
* class names (http://groups.google.com/group/php-standards/web/psr-0-final-proposal); * class names (https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md);
* *
* * The PEAR naming convention for classes (http://pear.php.net/). * * The PEAR naming convention for classes (http://pear.php.net/).
* *

View File

@ -17,7 +17,7 @@ namespace Symfony\Component\ClassLoader;
* It is able to load classes that use either: * It is able to load classes that use either:
* *
* * The technical interoperability standards for PHP 5.3 namespaces and * * The technical interoperability standards for PHP 5.3 namespaces and
* class names (http://groups.google.com/group/php-standards/web/psr-0-final-proposal); * class names (https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md);
* *
* * The PEAR naming convention for classes (http://pear.php.net/). * * The PEAR naming convention for classes (http://pear.php.net/).
* *

View File

@ -4,7 +4,6 @@
"description": "Symfony ClassLoader Component", "description": "Symfony ClassLoader Component",
"keywords": [], "keywords": [],
"homepage": "http://symfony.com", "homepage": "http://symfony.com",
"version": "2.0.4",
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
{ {
@ -18,5 +17,9 @@
], ],
"require": { "require": {
"php": ">=5.3.2" "php": ">=5.3.2"
} },
"autoload": {
"psr-0": { "Symfony\\Component\\ClassLoader": "" }
},
"target-dir": "Symfony/Component/ClassLoader"
} }

View File

@ -46,6 +46,6 @@ class ApacheRequest extends Request
*/ */
protected function preparePathInfo() protected function preparePathInfo()
{ {
return $this->server->get('PATH_INFO'); return $this->server->get('PATH_INFO') ?: substr($this->prepareRequestUri(), strlen($this->prepareBaseUrl())) ?: '/';
} }
} }

View File

@ -48,10 +48,6 @@ class Cookie
throw new \InvalidArgumentException(sprintf('The cookie name "%s" contains invalid characters.', $name)); throw new \InvalidArgumentException(sprintf('The cookie name "%s" contains invalid characters.', $name));
} }
if (preg_match("/[,; \t\r\n\013\014]/", $value)) {
throw new \InvalidArgumentException(sprintf('The cookie value "%s" contains invalid characters.', $value));
}
if (empty($name)) { if (empty($name)) {
throw new \InvalidArgumentException('The cookie name cannot be empty.'); throw new \InvalidArgumentException('The cookie name cannot be empty.');
} }

View File

@ -428,6 +428,7 @@ class File extends \SplFileInfo
'video/vnd.sealedmedia.softseal.mov' => 'smov', 'video/vnd.sealedmedia.softseal.mov' => 'smov',
'video/vnd.vivo' => 'vivo', 'video/vnd.vivo' => 'vivo',
'video/x-fli' => 'fli', 'video/x-fli' => 'fli',
'video/x-flv' => 'flv',
'video/x-ms-asf' => 'asf', 'video/x-ms-asf' => 'asf',
'video/x-ms-wmv' => 'wmv', 'video/x-ms-wmv' => 'wmv',
'video/x-msvideo' => 'avi', 'video/x-msvideo' => 'avi',
@ -445,15 +446,16 @@ class File extends \SplFileInfo
/** /**
* Constructs a new file from the given path. * Constructs a new file from the given path.
* *
* @param string $path The path to the file * @param string $path The path to the file
* @param Boolean $checkPath Whether to check the path or not
* *
* @throws FileNotFoundException If the given path is not a file * @throws FileNotFoundException If the given path is not a file
* *
* @api * @api
*/ */
public function __construct($path) public function __construct($path, $checkPath = true)
{ {
if (!is_file($path)) { if ($checkPath && !is_file($path)) {
throw new FileNotFoundException($path); throw new FileNotFoundException($path);
} }

View File

@ -97,7 +97,9 @@ class MimeTypeGuesser implements MimeTypeGuesserInterface
* value. * value.
* *
* @param string $path The path to the file * @param string $path The path to the file
*
* @return string The mime type or NULL, if none could be guessed * @return string The mime type or NULL, if none could be guessed
*
* @throws FileException If the file does not exist * @throws FileException If the file does not exist
*/ */
public function guess($path) public function guess($path)
@ -110,16 +112,14 @@ class MimeTypeGuesser implements MimeTypeGuesserInterface
throw new AccessDeniedException($path); throw new AccessDeniedException($path);
} }
$mimeType = null; if (!$this->guessers) {
throw new \LogicException('Unable to guess the mime type as no guessers are available (Did you enable the php_fileinfo extension?)');
foreach ($this->guessers as $guesser) {
$mimeType = $guesser->guess($path);
if (null !== $mimeType) {
break;
}
} }
return $mimeType; foreach ($this->guessers as $guesser) {
if (null !== $mimeType = $guesser->guess($path)) {
return $mimeType;
}
}
} }
} }

View File

@ -19,10 +19,12 @@ namespace Symfony\Component\HttpFoundation\File\MimeType;
interface MimeTypeGuesserInterface interface MimeTypeGuesserInterface
{ {
/** /**
* Guesses the mime type of the file with the given path * Guesses the mime type of the file with the given path.
* *
* @param string $path The path to the file * @param string $path The path to the file
*
* @return string The mime type or NULL, if none could be guessed * @return string The mime type or NULL, if none could be guessed
*
* @throws FileNotFoundException If the file does not exist * @throws FileNotFoundException If the file does not exist
* @throws AccessDeniedException If the file could not be read * @throws AccessDeniedException If the file could not be read
*/ */

View File

@ -100,9 +100,7 @@ class UploadedFile extends File
$this->error = $error ?: UPLOAD_ERR_OK; $this->error = $error ?: UPLOAD_ERR_OK;
$this->test = (Boolean) $test; $this->test = (Boolean) $test;
if (UPLOAD_ERR_OK === $this->error) { parent::__construct($path, UPLOAD_ERR_OK === $this->error);
parent::__construct($path);
}
} }
/** /**

View File

@ -122,6 +122,7 @@ class FileBag extends ParameterBag
* just returns the original array unmodified. * just returns the original array unmodified.
* *
* @param array $data * @param array $data
*
* @return array * @return array
*/ */
protected function fixPhpFilesArray($data) protected function fixPhpFilesArray($data)

View File

@ -86,8 +86,8 @@ class ParameterBag
* Returns a parameter by name. * Returns a parameter by name.
* *
* @param string $path The key * @param string $path The key
* @param mixed $default The default value * @param mixed $default The default value if the parameter key does not exist
* @param boolean $deep * @param boolean $deep If true, a path like foo[bar] will find deeper items
* *
* @api * @api
*/ */
@ -113,7 +113,7 @@ class ParameterBag
} }
$currentKey = ''; $currentKey = '';
} else if (']' === $char) { } elseif (']' === $char) {
if (null === $currentKey) { if (null === $currentKey) {
throw new \InvalidArgumentException(sprintf('Malformed path. Unexpected "]" at position %d.', $i)); throw new \InvalidArgumentException(sprintf('Malformed path. Unexpected "]" at position %d.', $i));
} }
@ -183,8 +183,8 @@ class ParameterBag
* Returns the alphabetic characters of the parameter value. * Returns the alphabetic characters of the parameter value.
* *
* @param string $key The parameter key * @param string $key The parameter key
* @param mixed $default The default value * @param mixed $default The default value if the parameter key does not exist
* @param boolean $deep * @param boolean $deep If true, a path like foo[bar] will find deeper items
* *
* @return string The filtered value * @return string The filtered value
* *
@ -199,8 +199,8 @@ class ParameterBag
* Returns the alphabetic characters and digits of the parameter value. * Returns the alphabetic characters and digits of the parameter value.
* *
* @param string $key The parameter key * @param string $key The parameter key
* @param mixed $default The default value * @param mixed $default The default value if the parameter key does not exist
* @param boolean $deep * @param boolean $deep If true, a path like foo[bar] will find deeper items
* *
* @return string The filtered value * @return string The filtered value
* *
@ -215,8 +215,8 @@ class ParameterBag
* Returns the digits of the parameter value. * Returns the digits of the parameter value.
* *
* @param string $key The parameter key * @param string $key The parameter key
* @param mixed $default The default value * @param mixed $default The default value if the parameter key does not exist
* @param boolean $deep * @param boolean $deep If true, a path like foo[bar] will find deeper items
* *
* @return string The filtered value * @return string The filtered value
* *
@ -231,8 +231,8 @@ class ParameterBag
* Returns the parameter value converted to integer. * Returns the parameter value converted to integer.
* *
* @param string $key The parameter key * @param string $key The parameter key
* @param mixed $default The default value * @param mixed $default The default value if the parameter key does not exist
* @param boolean $deep * @param boolean $deep If true, a path like foo[bar] will find deeper items
* *
* @return string The filtered value * @return string The filtered value
* *

View File

@ -453,7 +453,9 @@ class Request
if ($this->server->has('HTTP_CLIENT_IP')) { if ($this->server->has('HTTP_CLIENT_IP')) {
return $this->server->get('HTTP_CLIENT_IP'); return $this->server->get('HTTP_CLIENT_IP');
} elseif (self::$trustProxy && $this->server->has('HTTP_X_FORWARDED_FOR')) { } elseif (self::$trustProxy && $this->server->has('HTTP_X_FORWARDED_FOR')) {
return $this->server->get('HTTP_X_FORWARDED_FOR'); $clientIp = explode(',', $this->server->get('HTTP_X_FORWARDED_FOR'), 2);
return isset($clientIp[0]) ? trim($clientIp[0]) : '';
} }
} }
@ -560,7 +562,11 @@ class Request
*/ */
public function getPort() public function getPort()
{ {
return $this->headers->get('X-Forwarded-Port') ?: $this->server->get('SERVER_PORT'); if (self::$trustProxy && $this->headers->has('X-Forwarded-Port')) {
return $this->headers->get('X-Forwarded-Port');
} else {
return $this->server->get('SERVER_PORT');
}
} }
/** /**
@ -639,7 +645,7 @@ class Request
* It builds a normalized query string, where keys/value pairs are alphabetized * It builds a normalized query string, where keys/value pairs are alphabetized
* and have consistent escaping. * and have consistent escaping.
* *
* @return string A normalized query string for the Request * @return string|null A normalized query string for the Request
* *
* @api * @api
*/ */
@ -845,6 +851,24 @@ class Request
$this->format = $format; $this->format = $format;
} }
public function setLocale($locale)
{
if (!$this->hasSession()) {
throw new \LogicException('Forward compatibility for Request::setLocale() requires the session to be set.');
}
$this->session->setLocale($locale);
}
public function getLocale()
{
if (!$this->hasSession()) {
throw new \LogicException('Forward compatibility for Request::getLocale() requires the session to be set.');
}
return $this->session->getLocale();
}
/** /**
* Checks whether the method is safe or not. * Checks whether the method is safe or not.
* *
@ -903,7 +927,7 @@ class Request
* *
* @param array $locales An array of ordered available locales * @param array $locales An array of ordered available locales
* *
* @return string The preferred locale * @return string|null The preferred locale
* *
* @api * @api
*/ */
@ -911,7 +935,7 @@ class Request
{ {
$preferredLanguages = $this->getLanguages(); $preferredLanguages = $this->getLanguages();
if (null === $locales) { if (empty($locales)) {
return isset($preferredLanguages[0]) ? $preferredLanguages[0] : null; return isset($preferredLanguages[0]) ? $preferredLanguages[0] : null;
} }
@ -1017,6 +1041,8 @@ class Request
* Splits an Accept-* HTTP header. * Splits an Accept-* HTTP header.
* *
* @param string $header Header to split * @param string $header Header to split
*
* @return array Array indexed by the values of the Accept-* header in preferred order
*/ */
public function splitHttpAcceptHeader($header) public function splitHttpAcceptHeader($header)
{ {
@ -1027,9 +1053,9 @@ class Request
$values = array(); $values = array();
foreach (array_filter(explode(',', $header)) as $value) { foreach (array_filter(explode(',', $header)) as $value) {
// Cut off any q-value that might come after a semi-colon // Cut off any q-value that might come after a semi-colon
if ($pos = strpos($value, ';')) { if (preg_match('/;\s*(q=.*$)/', $value, $match)) {
$q = (float) trim(substr($value, strpos($value, '=') + 1)); $q = (float) substr(trim($match[1]), 2);
$value = trim(substr($value, 0, $pos)); $value = trim(substr($value, 0, -strlen($match[0])));
} else { } else {
$q = 1; $q = 1;
} }
@ -1057,7 +1083,7 @@ class Request
{ {
$requestUri = ''; $requestUri = '';
if ($this->headers->has('X_REWRITE_URL')) { if ($this->headers->has('X_REWRITE_URL') && false !== stripos(PHP_OS, 'WIN')) {
// check this first so IIS will catch // check this first so IIS will catch
$requestUri = $this->headers->get('X_REWRITE_URL'); $requestUri = $this->headers->get('X_REWRITE_URL');
} elseif ($this->server->get('IIS_WasUrlRewritten') == '1' && $this->server->get('UNENCODED_URL') != '') { } elseif ($this->server->get('IIS_WasUrlRewritten') == '1' && $this->server->get('UNENCODED_URL') != '') {

View File

@ -135,7 +135,7 @@ class RequestMatcher implements RequestMatcherInterface
protected function checkIp4($requestIp, $ip) protected function checkIp4($requestIp, $ip)
{ {
if (false !== strpos($ip, '/')) { if (false !== strpos($ip, '/')) {
list($address, $netmask) = explode('/', $ip); list($address, $netmask) = explode('/', $ip, 2);
if ($netmask < 1 || $netmask > 32) { if ($netmask < 1 || $netmask > 32) {
return false; return false;
@ -158,14 +158,14 @@ class RequestMatcher implements RequestMatcherInterface
throw new \RuntimeException('Unable to check Ipv6. Check that PHP was not compiled with option "disable-ipv6".'); throw new \RuntimeException('Unable to check Ipv6. Check that PHP was not compiled with option "disable-ipv6".');
} }
list($address, $netmask) = explode('/', $ip); list($address, $netmask) = explode('/', $ip, 2);
$bytes_addr = unpack("n*", inet_pton($address)); $bytes_addr = unpack("n*", inet_pton($address));
$bytes_test = unpack("n*", inet_pton($requestIp)); $bytes_test = unpack("n*", inet_pton($requestIp));
for ($i = 1, $ceil = ceil($netmask / 16); $i <= $ceil; $i++) { for ($i = 1, $ceil = ceil($netmask / 16); $i <= $ceil; $i++) {
$left = $netmask - 16 * ($i-1); $left = $netmask - 16 * ($i-1);
$left = ($left <= 16) ?: 16; $left = ($left <= 16) ? $left : 16;
$mask = ~(0xffff >> $left) & 0xffff; $mask = ~(0xffff >> $left) & 0xffff;
if (($bytes_addr[$i] & $mask) != ($bytes_test[$i] & $mask)) { if (($bytes_addr[$i] & $mask) != ($bytes_test[$i] & $mask)) {
return false; return false;

View File

@ -134,7 +134,7 @@ class Response
$charset = $this->charset ?: 'UTF-8'; $charset = $this->charset ?: 'UTF-8';
if (!$this->headers->has('Content-Type')) { if (!$this->headers->has('Content-Type')) {
$this->headers->set('Content-Type', 'text/html; charset='.$charset); $this->headers->set('Content-Type', 'text/html; charset='.$charset);
} elseif ('text/' === substr($this->headers->get('Content-Type'), 0, 5) && false === strpos($this->headers->get('Content-Type'), 'charset')) { } elseif (0 === strpos($this->headers->get('Content-Type'), 'text/') && false === strpos($this->headers->get('Content-Type'), 'charset')) {
// add the charset // add the charset
$this->headers->set('Content-Type', $this->headers->get('Content-Type').'; charset='.$charset); $this->headers->set('Content-Type', $this->headers->get('Content-Type').'; charset='.$charset);
} }
@ -197,7 +197,7 @@ class Response
} }
/** /**
* Sets the response content * Sets the response content.
* *
* Valid types are strings, numbers, and objects that implement a __toString() method. * Valid types are strings, numbers, and objects that implement a __toString() method.
* *
@ -215,7 +215,7 @@ class Response
} }
/** /**
* Gets the current response content * Gets the current response content.
* *
* @return string Content * @return string Content
* *
@ -251,7 +251,7 @@ class Response
} }
/** /**
* Sets response status code. * Sets the response status code.
* *
* @param integer $code HTTP status code * @param integer $code HTTP status code
* @param string $text HTTP status text * @param string $text HTTP status text
@ -271,7 +271,7 @@ class Response
} }
/** /**
* Retrieves status code for the current web response. * Retrieves the status code for the current web response.
* *
* @return string Status code * @return string Status code
* *
@ -283,7 +283,7 @@ class Response
} }
/** /**
* Sets response charset. * Sets the response charset.
* *
* @param string $charset Character set * @param string $charset Character set
* *
@ -409,7 +409,7 @@ class Response
* *
* @return \DateTime A \DateTime instance * @return \DateTime A \DateTime instance
* *
* @throws \RuntimeException when the header is not parseable * @throws \RuntimeException When the header is not parseable
* *
* @api * @api
*/ */
@ -470,7 +470,7 @@ class Response
} }
/** /**
* Sets the Expires HTTP header with a \DateTime instance. * Sets the Expires HTTP header with a DateTime instance.
* *
* If passed a null value, it removes the header. * If passed a null value, it removes the header.
* *
@ -522,7 +522,7 @@ class Response
* *
* This methods sets the Cache-Control max-age directive. * This methods sets the Cache-Control max-age directive.
* *
* @param integer $value A number of seconds * @param integer $value Number of seconds
* *
* @api * @api
*/ */
@ -536,7 +536,7 @@ class Response
* *
* This methods sets the Cache-Control s-maxage directive. * This methods sets the Cache-Control s-maxage directive.
* *
* @param integer $value A number of seconds * @param integer $value Number of seconds
* *
* @api * @api
*/ */
@ -572,7 +572,7 @@ class Response
* *
* This method adjusts the Cache-Control/s-maxage directive. * This method adjusts the Cache-Control/s-maxage directive.
* *
* @param integer $seconds The number of seconds * @param integer $seconds Number of seconds
* *
* @api * @api
*/ */
@ -586,7 +586,7 @@ class Response
* *
* This method adjusts the Cache-Control/max-age directive. * This method adjusts the Cache-Control/max-age directive.
* *
* @param integer $seconds The number of seconds * @param integer $seconds Number of seconds
* *
* @api * @api
*/ */
@ -608,7 +608,7 @@ class Response
} }
/** /**
* Sets the Last-Modified HTTP header with a \DateTime instance. * Sets the Last-Modified HTTP header with a DateTime instance.
* *
* If passed a null value, it removes the header. * If passed a null value, it removes the header.
* *
@ -628,7 +628,7 @@ class Response
} }
/** /**
* Returns the literal value of ETag HTTP header. * Returns the literal value of the ETag HTTP header.
* *
* @return string The ETag HTTP header * @return string The ETag HTTP header
* *
@ -661,7 +661,7 @@ class Response
} }
/** /**
* Sets Response cache headers (validation and/or expiration). * Sets the response's cache headers (validation and/or expiration).
* *
* Available options are: etag, last_modified, max_age, s_maxage, private, and public. * Available options are: etag, last_modified, max_age, s_maxage, private, and public.
* *
@ -672,7 +672,7 @@ class Response
public function setCache(array $options) public function setCache(array $options)
{ {
if ($diff = array_diff(array_keys($options), array('etag', 'last_modified', 'max_age', 's_maxage', 'private', 'public'))) { if ($diff = array_diff(array_keys($options), array('etag', 'last_modified', 'max_age', 's_maxage', 'private', 'public'))) {
throw new \InvalidArgumentException(sprintf('Response does not support the following options: "%s".', implode('", "', array_keys($diff)))); throw new \InvalidArgumentException(sprintf('Response does not support the following options: "%s".', implode('", "', array_values($diff))));
} }
if (isset($options['etag'])) { if (isset($options['etag'])) {
@ -771,15 +771,15 @@ class Response
} }
/** /**
* Determines if the Response validators (ETag, Last-Modified) matches * Determines if the Response validators (ETag, Last-Modified) match
* a conditional value specified in the Request. * a conditional value specified in the Request.
* *
* If the Response is not modified, it sets the status code to 304 and * If the Response is not modified, it sets the status code to 304 and
* remove the actual content by calling the setNotModified() method. * removes the actual content by calling the setNotModified() method.
* *
* @param Request $request A Request instance * @param Request $request A Request instance
* *
* @return Boolean true if the Response validators matches the Request, false otherwise * @return Boolean true if the Response validators match the Request, false otherwise
* *
* @api * @api
*/ */

View File

@ -120,6 +120,7 @@ class ResponseHeaderBag extends HeaderBag
* Sets a cookie. * Sets a cookie.
* *
* @param Cookie $cookie * @param Cookie $cookie
*
* @return void * @return void
* *
* @api * @api
@ -135,6 +136,7 @@ class ResponseHeaderBag extends HeaderBag
* @param string $name * @param string $name
* @param string $path * @param string $path
* @param string $domain * @param string $domain
*
* @return void * @return void
* *
* @api * @api
@ -195,6 +197,7 @@ class ResponseHeaderBag extends HeaderBag
* @param string $name * @param string $name
* @param string $path * @param string $path
* @param string $domain * @param string $domain
*
* @return void * @return void
* *
* @api * @api

View File

@ -23,7 +23,7 @@ class ServerBag extends ParameterBag
{ {
$headers = array(); $headers = array();
foreach ($this->parameters as $key => $value) { foreach ($this->parameters as $key => $value) {
if ('HTTP_' === substr($key, 0, 5)) { if (0 === strpos($key, 'HTTP_')) {
$headers[substr($key, 5)] = $value; $headers[substr($key, 5)] = $value;
} }
// CONTENT_* are not prefixed with HTTP_ // CONTENT_* are not prefixed with HTTP_

View File

@ -94,7 +94,8 @@ class FilesystemSessionStorage extends NativeSessionStorage
* *
* The preferred format for a key is directory style so naming conflicts can be avoided. * The preferred format for a key is directory style so naming conflicts can be avoided.
* *
* @param string $key A unique key identifying your data * @param string $key A unique key identifying your data
* @param string $default The default value
* *
* @return mixed Data associated with the key * @return mixed Data associated with the key
* *

View File

@ -143,7 +143,6 @@ class PdoSessionStorage extends NativeSessionStorage
$sql = "DELETE FROM $dbTable WHERE $dbTimeCol < (:time - $lifetime)"; $sql = "DELETE FROM $dbTable WHERE $dbTimeCol < (:time - $lifetime)";
try { try {
$this->db->query($sql);
$stmt = $this->db->prepare($sql); $stmt = $this->db->prepare($sql);
$stmt->bindValue(':time', time(), \PDO::PARAM_INT); $stmt->bindValue(':time', time(), \PDO::PARAM_INT);
$stmt->execute(); $stmt->execute();
@ -182,7 +181,7 @@ class PdoSessionStorage extends NativeSessionStorage
$sessionRows = $stmt->fetchAll(\PDO::FETCH_NUM); $sessionRows = $stmt->fetchAll(\PDO::FETCH_NUM);
if (count($sessionRows) == 1) { if (count($sessionRows) == 1) {
return $sessionRows[0][0]; return base64_decode($sessionRows[0][0]);
} }
// session does not exist, create it // session does not exist, create it
@ -218,9 +217,11 @@ class PdoSessionStorage extends NativeSessionStorage
: "UPDATE $dbTable SET $dbDataCol = :data, $dbTimeCol = :time WHERE $dbIdCol = :id"; : "UPDATE $dbTable SET $dbDataCol = :data, $dbTimeCol = :time WHERE $dbIdCol = :id";
try { try {
//session data can contain non binary safe characters so we need to encode it
$encoded = base64_encode($data);
$stmt = $this->db->prepare($sql); $stmt = $this->db->prepare($sql);
$stmt->bindParam(':id', $id, \PDO::PARAM_STR); $stmt->bindParam(':id', $id, \PDO::PARAM_STR);
$stmt->bindParam(':data', $data, \PDO::PARAM_STR); $stmt->bindParam(':data', $encoded, \PDO::PARAM_STR);
$stmt->bindValue(':time', time(), \PDO::PARAM_INT); $stmt->bindValue(':time', time(), \PDO::PARAM_INT);
$stmt->execute(); $stmt->execute();
@ -252,9 +253,11 @@ class PdoSessionStorage extends NativeSessionStorage
$sql = "INSERT INTO $dbTable ($dbIdCol, $dbDataCol, $dbTimeCol) VALUES (:id, :data, :time)"; $sql = "INSERT INTO $dbTable ($dbIdCol, $dbDataCol, $dbTimeCol) VALUES (:id, :data, :time)";
//session data can contain non binary safe characters so we need to encode it
$encoded = base64_encode($data);
$stmt = $this->db->prepare($sql); $stmt = $this->db->prepare($sql);
$stmt->bindParam(':id', $id, \PDO::PARAM_STR); $stmt->bindParam(':id', $id, \PDO::PARAM_STR);
$stmt->bindParam(':data', $data, \PDO::PARAM_STR); $stmt->bindParam(':data', $encoded, \PDO::PARAM_STR);
$stmt->bindValue(':time', time(), \PDO::PARAM_INT); $stmt->bindValue(':time', time(), \PDO::PARAM_INT);
$stmt->execute(); $stmt->execute();

View File

@ -4,7 +4,6 @@
"description": "Symfony HttpFoundation Component", "description": "Symfony HttpFoundation Component",
"keywords": [], "keywords": [],
"homepage": "http://symfony.com", "homepage": "http://symfony.com",
"version": "2.0.4",
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
{ {
@ -18,5 +17,9 @@
], ],
"require": { "require": {
"php": ">=5.3.2" "php": ">=5.3.2"
} },
"autoload": {
"psr-0": { "Symfony\\Component\\HttpFoundation": "" }
},
"target-dir": "Symfony/Component/HttpFoundation"
} }