diff --git a/core/composer.json b/core/composer.json new file mode 100644 index 0000000..c6d2454 --- /dev/null +++ b/core/composer.json @@ -0,0 +1,12 @@ +{ + "require": { + "php": ">=5.3.2", + "symfony/http-foundation": "2.0.10" + }, + "autoload": { + "psr-0": { + "Drupal\\Core": "lib/", + "Drupal\\Component": "lib/" + } + } +} diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index ab06260..944fde6 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -2298,23 +2298,7 @@ function _drupal_bootstrap_configuration() { drupal_settings_initialize(); // Include and activate the class loader. - $loader = drupal_classloader(); - - // Register explicit vendor namespaces. - $loader->registerNamespaces(array( - // All Symfony-borrowed code lives in /core/vendor/Symfony. - 'Symfony' => DRUPAL_ROOT . '/core/vendor', - )); - // Register the Drupal namespace for classes in core as a fallback. - // This allows to register additional namespaces within the Drupal namespace - // (e.g., for modules) and avoids an additional file_exists() on the Drupal - // core namespace, since the class loader can already determine the best - // namespace match based on a string comparison. It further allows modules to - // register/overload namespaces in Drupal core. - $loader->registerNamespaceFallbacks(array( - // All Drupal-namespaced code in core lives in /core/lib/Drupal. - 'Drupal' => DRUPAL_ROOT . '/core/lib', - )); + drupal_classloader(); } /** @@ -3047,40 +3031,30 @@ function drupal_get_complete_schema($rebuild = FALSE) { * Initializes and returns the class loader. * * The class loader is responsible for lazy-loading all PSR-0 compatible - * classes, interfaces, and traits (PHP 5.4 and later). Its only dependencies - * are DRUPAL_ROOT and variable_get(). Otherwise it may be called as early as - * possible. + * classes, interfaces, and traits (PHP 5.4 and later). Its only dependency is + * DRUPAL_ROOT, otherwise it may be called as early as possible. + * + * Example: + * @code + * // Register MyModule's PSR-0 class namespace. + * $loader = drupal_classloader(); + * $path = drupal_get_path('module', 'mymodule') . '/lib/'; + * $loader->add("Drupal\\Module\\MyModule", $path); + * $loader->register(); + * @endcode * - * @return Symfony\Component\ClassLoader\UniversalClassLoader - * A UniversalClassLoader class instance (or extension thereof). + * @return Composer\Autoload\ClassLoader + * A class instance, which allows registering namespaces to file system paths. */ function drupal_classloader() { - // Include the Symfony ClassLoader for loading PSR-0-compatible classes. - require_once DRUPAL_ROOT . '/core/vendor/Symfony/Component/ClassLoader/UniversalClassLoader.php'; - - // By default, use the UniversalClassLoader which is best for development, - // as it does not break when code is moved on the file system. However, as it - // is slow, allow to use the APC class loader in production. + // Include the auto-generated Composer ClassLoader for loading classes that + // are PSR-0-compatible. static $loader; - if (!isset($loader)) { - // @todo Use a cleaner way than variable_get() to switch autoloaders. - switch (variable_get('autoloader_mode', 'default')) { - case 'apc': - if (function_exists('apc_store')) { - require_once DRUPAL_ROOT . '/core/vendor/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php'; - $loader = new ApcUniversalClassLoader('drupal.' . $GLOBALS['drupal_hash_salt']); - break; - } - // Fall through to the default loader if APC was not loaded, so that the - // site does not fail completely. - case 'dev': - case 'default': - default: - $loader = new UniversalClassLoader(); - break; - } - $loader->register(); + // Drupal Core's classes are auto-loaded by autoload.php, and the class + // instance used to register the namespaces is returned. This file is + // auto-generated by Composer during the build process of composer.json. + $loader = require_once DRUPAL_ROOT . '/core/vendor/.composer/autoload.php'; } return $loader; } diff --git a/core/vendor/.composer/ClassLoader.php b/core/vendor/.composer/ClassLoader.php new file mode 100644 index 0000000..24a1374 --- /dev/null +++ b/core/vendor/.composer/ClassLoader.php @@ -0,0 +1,2 @@ +prefixes; } public function getFallbackDirs() { return $this->fallbackDirs; } public function add($prefix, $paths) { if (!$prefix) { foreach ((array) $paths as $path) { $this->fallbackDirs[] = $path; } return; } if (isset($this->prefixes[$prefix])) { $this->prefixes[$prefix] = array_merge( $this->prefixes[$prefix], (array) $paths ); } else { $this->prefixes[$prefix] = (array) $paths; } } public function setUseIncludePath($useIncludePath) { $this->useIncludePath = $useIncludePath; } public function getUseIncludePath() { return $this->useIncludePath; } public function register($prepend = false) { spl_autoload_register(array($this, 'loadClass'), true, $prepend); } public function unregister() { spl_autoload_unregister(array($this, 'loadClass')); } public function loadClass($class) { if ($file = $this->findFile($class)) { require $file; return true; } } public function findFile($class) { if ('\\' == $class[0]) { $class = substr($class, 1); } if (false !== $pos = strrpos($class, '\\')) { $classPath = str_replace('\\', DIRECTORY_SEPARATOR, substr($class, 0, $pos)) . DIRECTORY_SEPARATOR; $className = substr($class, $pos + 1); } else { $classPath = null; $className = $class; } $classPath .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; foreach ($this->prefixes as $prefix => $dirs) { foreach ($dirs as $dir) { if (0 === strpos($class, $prefix)) { if (file_exists($dir . DIRECTORY_SEPARATOR . $classPath)) { return $dir . DIRECTORY_SEPARATOR . $classPath; } } } } foreach ($this->fallbackDirs as $dir) { if (file_exists($dir . DIRECTORY_SEPARATOR . $classPath)) { return $dir . DIRECTORY_SEPARATOR . $classPath; } } if ($this->useIncludePath && $file = stream_resolve_include_path($classPath)) { return $file; } } } \ No newline at end of file diff --git a/core/vendor/.composer/autoload.php b/core/vendor/.composer/autoload.php new file mode 100644 index 0000000..3f20144 --- /dev/null +++ b/core/vendor/.composer/autoload.php @@ -0,0 +1,22 @@ + $path) { + $loader->add($namespace, $path); + } + + $loader->register(); + + return $loader; +}; + +return $__composer_autoload_init(); \ No newline at end of file diff --git a/core/vendor/.composer/autoload_namespaces.php b/core/vendor/.composer/autoload_namespaces.php new file mode 100644 index 0000000..465a49e --- /dev/null +++ b/core/vendor/.composer/autoload_namespaces.php @@ -0,0 +1,11 @@ + $vendorDir . '/symfony/http-foundation/', + 'Drupal\\Core' => dirname($vendorDir) . '/lib/', + 'Drupal\\Component' => dirname($vendorDir) . '/lib/', +); diff --git a/core/vendor/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php b/core/vendor/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php deleted file mode 100644 index 278f510..0000000 --- a/core/vendor/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php +++ /dev/null @@ -1,96 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ClassLoader; - -/** - * ApcUniversalClassLoader implements a "universal" autoloader cached in APC for PHP 5.3. - * - * It is able to load classes that use either: - * - * * The technical interoperability standards for PHP 5.3 namespaces and - * class names (http://groups.google.com/group/php-standards/web/psr-0-final-proposal); - * - * * The PEAR naming convention for classes (http://pear.php.net/). - * - * Classes from a sub-namespace or a sub-hierarchy of PEAR classes can be - * looked for in a list of locations to ease the vendoring of a sub-set of - * classes for large projects. - * - * Example usage: - * - * require 'vendor/symfony/src/Symfony/Component/ClassLoader/UniversalClassLoader.php'; - * require 'vendor/symfony/src/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php'; - * - * use Symfony\Component\ClassLoader\ApcUniversalClassLoader; - * - * $loader = new ApcUniversalClassLoader('apc.prefix.'); - * - * // register classes with namespaces - * $loader->registerNamespaces(array( - * 'Symfony\Component' => __DIR__.'/component', - * 'Symfony' => __DIR__.'/framework', - * 'Sensio' => array(__DIR__.'/src', __DIR__.'/vendor'), - * )); - * - * // register a library using the PEAR naming convention - * $loader->registerPrefixes(array( - * 'Swift_' => __DIR__.'/Swift', - * )); - * - * // activate the autoloader - * $loader->register(); - * - * In this example, if you try to use a class in the Symfony\Component - * namespace or one of its children (Symfony\Component\Console for instance), - * the autoloader will first look for the class under the component/ - * directory, and it will then fallback to the framework/ directory if not - * found before giving up. - * - * @author Fabien Potencier - * @author Kris Wallsmith - * - * @api - */ -class ApcUniversalClassLoader extends UniversalClassLoader -{ - private $prefix; - - /** - * Constructor. - * - * @param string $prefix A prefix to create a namespace in APC - * - * @api - */ - public function __construct($prefix) - { - if (!extension_loaded('apc')) { - throw new \RuntimeException('Unable to use ApcUniversalClassLoader as APC is not enabled.'); - } - - $this->prefix = $prefix; - } - - /** - * Finds a file by class name while caching lookups to APC. - * - * @param string $class A class name to resolve to file - */ - public function findFile($class) - { - if (false === $file = apc_fetch($this->prefix.$class)) { - apc_store($this->prefix.$class, $file = parent::findFile($class)); - } - - return $file; - } -} diff --git a/core/vendor/Symfony/Component/ClassLoader/ClassCollectionLoader.php b/core/vendor/Symfony/Component/ClassLoader/ClassCollectionLoader.php deleted file mode 100644 index da777f2..0000000 --- a/core/vendor/Symfony/Component/ClassLoader/ClassCollectionLoader.php +++ /dev/null @@ -1,222 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ClassLoader; - -/** - * ClassCollectionLoader. - * - * @author Fabien Potencier - */ -class ClassCollectionLoader -{ - static private $loaded; - - /** - * Loads a list of classes and caches them in one big file. - * - * @param array $classes An array of classes to load - * @param string $cacheDir A cache directory - * @param string $name The cache name prefix - * @param Boolean $autoReload Whether to flush the cache when the cache is stale or not - * @param Boolean $adaptive Whether to remove already declared classes or not - * @param string $extension File extension of the resulting file - * - * @throws \InvalidArgumentException When class can't be loaded - */ - static public function load($classes, $cacheDir, $name, $autoReload, $adaptive = false, $extension = '.php') - { - // each $name can only be loaded once per PHP process - if (isset(self::$loaded[$name])) { - return; - } - - self::$loaded[$name] = true; - - if ($adaptive) { - // don't include already declared classes - $classes = array_diff($classes, get_declared_classes(), get_declared_interfaces()); - - // the cache is different depending on which classes are already declared - $name = $name.'-'.substr(md5(implode('|', $classes)), 0, 5); - } - - $cache = $cacheDir.'/'.$name.$extension; - - // auto-reload - $reload = false; - if ($autoReload) { - $metadata = $cacheDir.'/'.$name.$extension.'.meta'; - if (!file_exists($metadata) || !file_exists($cache)) { - $reload = true; - } else { - $time = filemtime($cache); - $meta = unserialize(file_get_contents($metadata)); - - if ($meta[1] != $classes) { - $reload = true; - } else { - foreach ($meta[0] as $resource) { - if (!file_exists($resource) || filemtime($resource) > $time) { - $reload = true; - - break; - } - } - } - } - } - - if (!$reload && file_exists($cache)) { - require_once $cache; - - return; - } - - $files = array(); - $content = ''; - foreach ($classes as $class) { - if (!class_exists($class) && !interface_exists($class) && (!function_exists('trait_exists') || !trait_exists($class))) { - throw new \InvalidArgumentException(sprintf('Unable to load class "%s"', $class)); - } - - $r = new \ReflectionClass($class); - $files[] = $r->getFileName(); - - $c = preg_replace(array('/^\s*<\?php/', '/\?>\s*$/'), '', file_get_contents($r->getFileName())); - - // add namespace declaration for global code - if (!$r->inNamespace()) { - $c = "\nnamespace\n{\n".self::stripComments($c)."\n}\n"; - } else { - $c = self::fixNamespaceDeclarations(' - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ClassLoader; - -/** - * Checks that the class is actually declared in the included file. - * - * @author Fabien Potencier - */ -class DebugUniversalClassLoader extends UniversalClassLoader -{ - /** - * Replaces all regular UniversalClassLoader instances by a DebugUniversalClassLoader ones. - */ - static public function enable() - { - if (!is_array($functions = spl_autoload_functions())) { - return; - } - - foreach ($functions as $function) { - spl_autoload_unregister($function); - } - - foreach ($functions as $function) { - if (is_array($function) && $function[0] instanceof UniversalClassLoader) { - $loader = new static(); - $loader->registerNamespaceFallbacks($function[0]->getNamespaceFallbacks()); - $loader->registerPrefixFallbacks($function[0]->getPrefixFallbacks()); - $loader->registerNamespaces($function[0]->getNamespaces()); - $loader->registerPrefixes($function[0]->getPrefixes()); - - $function[0] = $loader; - } - - spl_autoload_register($function); - } - } - - /** - * {@inheritDoc} - */ - public function loadClass($class) - { - if ($file = $this->findFile($class)) { - require $file; - - if (!class_exists($class, false) && !interface_exists($class, false) && (!function_exists('trait_exists') || !trait_exists($class, false))) { - throw new \RuntimeException(sprintf('The autoloader expected class "%s" to be defined in file "%s". The file was found but the class was not in it, the class name or namespace probably has a typo.', $class, $file)); - } - } - } -} diff --git a/core/vendor/Symfony/Component/ClassLoader/MapClassLoader.php b/core/vendor/Symfony/Component/ClassLoader/MapClassLoader.php deleted file mode 100644 index cf17d42..0000000 --- a/core/vendor/Symfony/Component/ClassLoader/MapClassLoader.php +++ /dev/null @@ -1,76 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ClassLoader; - -/** - * A class loader that uses a mapping file to look up paths. - * - * @author Fabien Potencier - */ -class MapClassLoader -{ - private $map = array(); - - /** - * Constructor. - * - * @param array $map A map where keys are classes and values the absolute file path - */ - public function __construct(array $map) - { - $this->map = $map; - } - - /** - * Registers this instance as an autoloader. - * - * @param Boolean $prepend Whether to prepend the autoloader or not - */ - public function register($prepend = false) - { - spl_autoload_register(array($this, 'loadClass'), true, $prepend); - } - - /** - * Loads the given class or interface. - * - * @param string $class The name of the class - */ - public function loadClass($class) - { - if ('\\' === $class[0]) { - $class = substr($class, 1); - } - - if (isset($this->map[$class])) { - require $this->map[$class]; - } - } - - /** - * Finds the path to the file where the class is defined. - * - * @param string $class The name of the class - * - * @return string|null The path, if found - */ - public function findFile($class) - { - if ('\\' === $class[0]) { - $class = substr($class, 1); - } - - if (isset($this->map[$class])) { - return $this->map[$class]; - } - } -} diff --git a/core/vendor/Symfony/Component/ClassLoader/UniversalClassLoader.php b/core/vendor/Symfony/Component/ClassLoader/UniversalClassLoader.php deleted file mode 100644 index d296b94..0000000 --- a/core/vendor/Symfony/Component/ClassLoader/UniversalClassLoader.php +++ /dev/null @@ -1,265 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ClassLoader; - -/** - * UniversalClassLoader implements a "universal" autoloader for PHP 5.3. - * - * It is able to load classes that use either: - * - * * The technical interoperability standards for PHP 5.3 namespaces and - * class names (http://groups.google.com/group/php-standards/web/psr-0-final-proposal); - * - * * The PEAR naming convention for classes (http://pear.php.net/). - * - * Classes from a sub-namespace or a sub-hierarchy of PEAR classes can be - * looked for in a list of locations to ease the vendoring of a sub-set of - * classes for large projects. - * - * Example usage: - * - * $loader = new UniversalClassLoader(); - * - * // register classes with namespaces - * $loader->registerNamespaces(array( - * 'Symfony\Component' => __DIR__.'/component', - * 'Symfony' => __DIR__.'/framework', - * 'Sensio' => array(__DIR__.'/src', __DIR__.'/vendor'), - * )); - * - * // register a library using the PEAR naming convention - * $loader->registerPrefixes(array( - * 'Swift_' => __DIR__.'/Swift', - * )); - * - * // activate the autoloader - * $loader->register(); - * - * In this example, if you try to use a class in the Symfony\Component - * namespace or one of its children (Symfony\Component\Console for instance), - * the autoloader will first look for the class under the component/ - * directory, and it will then fallback to the framework/ directory if not - * found before giving up. - * - * @author Fabien Potencier - * - * @api - */ -class UniversalClassLoader -{ - private $namespaces = array(); - private $prefixes = array(); - private $namespaceFallbacks = array(); - private $prefixFallbacks = array(); - - /** - * Gets the configured namespaces. - * - * @return array A hash with namespaces as keys and directories as values - */ - public function getNamespaces() - { - return $this->namespaces; - } - - /** - * Gets the configured class prefixes. - * - * @return array A hash with class prefixes as keys and directories as values - */ - public function getPrefixes() - { - return $this->prefixes; - } - - /** - * Gets the directory(ies) to use as a fallback for namespaces. - * - * @return array An array of directories - */ - public function getNamespaceFallbacks() - { - return $this->namespaceFallbacks; - } - - /** - * Gets the directory(ies) to use as a fallback for class prefixes. - * - * @return array An array of directories - */ - public function getPrefixFallbacks() - { - return $this->prefixFallbacks; - } - - /** - * Registers the directory to use as a fallback for namespaces. - * - * @param array $dirs An array of directories - * - * @api - */ - public function registerNamespaceFallbacks(array $dirs) - { - $this->namespaceFallbacks = $dirs; - } - - /** - * Registers the directory to use as a fallback for class prefixes. - * - * @param array $dirs An array of directories - * - * @api - */ - public function registerPrefixFallbacks(array $dirs) - { - $this->prefixFallbacks = $dirs; - } - - /** - * Registers an array of namespaces - * - * @param array $namespaces An array of namespaces (namespaces as keys and locations as values) - * - * @api - */ - public function registerNamespaces(array $namespaces) - { - foreach ($namespaces as $namespace => $locations) { - $this->namespaces[$namespace] = (array) $locations; - } - } - - /** - * Registers a namespace. - * - * @param string $namespace The namespace - * @param array|string $paths The location(s) of the namespace - * - * @api - */ - public function registerNamespace($namespace, $paths) - { - $this->namespaces[$namespace] = (array) $paths; - } - - /** - * Registers an array of classes using the PEAR naming convention. - * - * @param array $classes An array of classes (prefixes as keys and locations as values) - * - * @api - */ - public function registerPrefixes(array $classes) - { - foreach ($classes as $prefix => $locations) { - $this->prefixes[$prefix] = (array) $locations; - } - } - - /** - * Registers a set of classes using the PEAR naming convention. - * - * @param string $prefix The classes prefix - * @param array|string $paths The location(s) of the classes - * - * @api - */ - public function registerPrefix($prefix, $paths) - { - $this->prefixes[$prefix] = (array) $paths; - } - - /** - * Registers this instance as an autoloader. - * - * @param Boolean $prepend Whether to prepend the autoloader or not - * - * @api - */ - public function register($prepend = false) - { - spl_autoload_register(array($this, 'loadClass'), true, $prepend); - } - - /** - * Loads the given class or interface. - * - * @param string $class The name of the class - */ - public function loadClass($class) - { - if ($file = $this->findFile($class)) { - require $file; - } - } - - /** - * Finds the path to the file where the class is defined. - * - * @param string $class The name of the class - * - * @return string|null The path, if found - */ - public function findFile($class) - { - if ('\\' == $class[0]) { - $class = substr($class, 1); - } - - if (false !== $pos = strrpos($class, '\\')) { - // namespaced class name - $namespace = substr($class, 0, $pos); - foreach ($this->namespaces as $ns => $dirs) { - if (0 !== strpos($namespace, $ns)) { - continue; - } - - foreach ($dirs as $dir) { - $className = substr($class, $pos + 1); - $file = $dir.DIRECTORY_SEPARATOR.str_replace('\\', DIRECTORY_SEPARATOR, $namespace).DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $className).'.php'; - if (file_exists($file)) { - return $file; - } - } - } - - foreach ($this->namespaceFallbacks as $dir) { - $file = $dir.DIRECTORY_SEPARATOR.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php'; - if (file_exists($file)) { - return $file; - } - } - } else { - // PEAR-like class name - foreach ($this->prefixes as $prefix => $dirs) { - if (0 !== strpos($class, $prefix)) { - continue; - } - - foreach ($dirs as $dir) { - $file = $dir.DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $class).'.php'; - if (file_exists($file)) { - return $file; - } - } - } - - foreach ($this->prefixFallbacks as $dir) { - $file = $dir.DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $class).'.php'; - if (file_exists($file)) { - return $file; - } - } - } - } -} diff --git a/core/vendor/Symfony/Component/ClassLoader/composer.json b/core/vendor/Symfony/Component/ClassLoader/composer.json deleted file mode 100644 index 35b573e..0000000 --- a/core/vendor/Symfony/Component/ClassLoader/composer.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "symfony/class-loader", - "type": "library", - "description": "Symfony ClassLoader Component", - "keywords": [], - "homepage": "http://symfony.com", - "version": "2.0.4", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - } - ], - "require": { - "php": ">=5.3.2" - } -} diff --git a/core/vendor/Symfony/Component/HttpFoundation/LICENSE b/core/vendor/Symfony/Component/HttpFoundation/LICENSE deleted file mode 100644 index 89df448..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2004-2011 Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/core/vendor/Symfony/Component/HttpFoundation/ApacheRequest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ApacheRequest.php similarity index 89% rename from core/vendor/Symfony/Component/HttpFoundation/ApacheRequest.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ApacheRequest.php index 2721581..ca8f8ee 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/ApacheRequest.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ApacheRequest.php @@ -46,6 +46,6 @@ class ApacheRequest extends Request */ protected function preparePathInfo() { - return $this->server->get('PATH_INFO'); + return $this->server->get('PATH_INFO') ?: substr($this->prepareRequestUri(), strlen($this->prepareBaseUrl())) ?: '/'; } } diff --git a/core/vendor/Symfony/Component/HttpFoundation/Cookie.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Cookie.php similarity index 96% rename from core/vendor/Symfony/Component/HttpFoundation/Cookie.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Cookie.php index 8392812..0511162 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/Cookie.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Cookie.php @@ -48,10 +48,6 @@ class Cookie 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)) { throw new \InvalidArgumentException('The cookie name cannot be empty.'); } diff --git a/core/vendor/Symfony/Component/HttpFoundation/File/Exception/AccessDeniedException.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/Exception/AccessDeniedException.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/File/Exception/AccessDeniedException.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/Exception/AccessDeniedException.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/File/Exception/FileException.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/Exception/FileException.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/File/Exception/FileException.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/Exception/FileException.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/File/Exception/FileNotFoundException.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/Exception/FileNotFoundException.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/File/Exception/FileNotFoundException.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/Exception/FileNotFoundException.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/File/Exception/UnexpectedTypeException.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/Exception/UnexpectedTypeException.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/File/Exception/UnexpectedTypeException.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/Exception/UnexpectedTypeException.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/File/Exception/UploadException.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/Exception/UploadException.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/File/Exception/UploadException.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/Exception/UploadException.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/File/File.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/File.php similarity index 98% rename from core/vendor/Symfony/Component/HttpFoundation/File/File.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/File.php index 3a900fd..58bc6f4 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/File/File.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/File.php @@ -428,6 +428,7 @@ class File extends \SplFileInfo 'video/vnd.sealedmedia.softseal.mov' => 'smov', 'video/vnd.vivo' => 'vivo', 'video/x-fli' => 'fli', + 'video/x-flv' => 'flv', 'video/x-ms-asf' => 'asf', 'video/x-ms-wmv' => 'wmv', 'video/x-msvideo' => 'avi', @@ -445,15 +446,16 @@ class File extends \SplFileInfo /** * 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 * * @api */ - public function __construct($path) + public function __construct($path, $checkPath = true) { - if (!is_file($path)) { + if ($checkPath && !is_file($path)) { throw new FileNotFoundException($path); } diff --git a/core/vendor/Symfony/Component/HttpFoundation/File/MimeType/ContentTypeMimeTypeGuesser.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/ContentTypeMimeTypeGuesser.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/File/MimeType/ContentTypeMimeTypeGuesser.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/ContentTypeMimeTypeGuesser.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php similarity index 91% rename from core/vendor/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php index 23dd463..9601618 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php @@ -97,7 +97,9 @@ class MimeTypeGuesser implements MimeTypeGuesserInterface * value. * * @param string $path The path to the file + * * @return string The mime type or NULL, if none could be guessed + * * @throws FileException If the file does not exist */ public function guess($path) @@ -110,16 +112,14 @@ class MimeTypeGuesser implements MimeTypeGuesserInterface 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; + if (null !== $mimeType = $guesser->guess($path)) { + return $mimeType; } } - - return $mimeType; } } diff --git a/core/vendor/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesserInterface.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesserInterface.php similarity index 90% rename from core/vendor/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesserInterface.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesserInterface.php index c111583..66178bb 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesserInterface.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesserInterface.php @@ -19,10 +19,12 @@ namespace Symfony\Component\HttpFoundation\File\MimeType; 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 + * * @return string The mime type or NULL, if none could be guessed + * * @throws FileNotFoundException If the file does not exist * @throws AccessDeniedException If the file could not be read */ diff --git a/core/vendor/Symfony/Component/HttpFoundation/File/UploadedFile.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/UploadedFile.php similarity index 98% rename from core/vendor/Symfony/Component/HttpFoundation/File/UploadedFile.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/UploadedFile.php index 936ed70..4e51c50 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/File/UploadedFile.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/UploadedFile.php @@ -100,9 +100,7 @@ class UploadedFile extends File $this->error = $error ?: UPLOAD_ERR_OK; $this->test = (Boolean) $test; - if (UPLOAD_ERR_OK === $this->error) { - parent::__construct($path); - } + parent::__construct($path, UPLOAD_ERR_OK === $this->error); } /** diff --git a/core/vendor/Symfony/Component/HttpFoundation/FileBag.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/FileBag.php similarity index 99% rename from core/vendor/Symfony/Component/HttpFoundation/FileBag.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/FileBag.php index 602cff2..702ab84 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/FileBag.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/FileBag.php @@ -122,6 +122,7 @@ class FileBag extends ParameterBag * just returns the original array unmodified. * * @param array $data + * * @return array */ protected function fixPhpFilesArray($data) diff --git a/core/vendor/Symfony/Component/HttpFoundation/HeaderBag.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/HeaderBag.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/HeaderBag.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/HeaderBag.php diff --git a/core/vendor/Symfony/Component/ClassLoader/LICENSE b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/LICENSE similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/LICENSE rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/LICENSE diff --git a/core/vendor/Symfony/Component/HttpFoundation/ParameterBag.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ParameterBag.php similarity index 86% rename from core/vendor/Symfony/Component/HttpFoundation/ParameterBag.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ParameterBag.php index 3a38b5f..e5d237c 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/ParameterBag.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ParameterBag.php @@ -86,8 +86,8 @@ class ParameterBag * Returns a parameter by name. * * @param string $path The key - * @param mixed $default The default value - * @param boolean $deep + * @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 * * @api */ @@ -113,7 +113,7 @@ class ParameterBag } $currentKey = ''; - } else if (']' === $char) { + } elseif (']' === $char) { if (null === $currentKey) { 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. * * @param string $key The parameter key - * @param mixed $default The default value - * @param boolean $deep + * @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 * @@ -199,8 +199,8 @@ class ParameterBag * Returns the alphabetic characters and digits of the parameter value. * * @param string $key The parameter key - * @param mixed $default The default value - * @param boolean $deep + * @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 * @@ -215,8 +215,8 @@ class ParameterBag * Returns the digits of the parameter value. * * @param string $key The parameter key - * @param mixed $default The default value - * @param boolean $deep + * @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 * @@ -231,8 +231,8 @@ class ParameterBag * Returns the parameter value converted to integer. * * @param string $key The parameter key - * @param mixed $default The default value - * @param boolean $deep + * @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 * diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/README.md b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/README.md new file mode 100644 index 0000000..67823e7 --- /dev/null +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/README.md @@ -0,0 +1,36 @@ +HttpFoundation Component +======================== + +HttpFoundation defines an object-oriented layer for the HTTP specification. + +It provides an abstraction for requests, responses, uploaded files, cookies, +sessions, ... + +In this example, we get a Request object from the current PHP global +variables: + + use Symfony\Component\HttpFoundation\Request; + use Symfony\Component\HttpFoundation\Response; + + $request = Request::createFromGlobals(); + echo $request->getPathInfo(); + +You can also create a Request directly -- that's interesting for unit testing: + + $request = Request::create('/?foo=bar', 'GET'); + echo $request->getPathInfo(); + +And here is how to create and send a Response: + + $response = new Response('Not Found', 404, array('Content-Type' => 'text/plain')); + $response->send(); + +The Request and the Response classes have many other methods that implement +the HTTP specification. + +Resources +--------- + +Unit tests: + +https://github.com/symfony/symfony/tree/master/tests/Symfony/Tests/Component/HttpFoundation diff --git a/core/vendor/Symfony/Component/HttpFoundation/RedirectResponse.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RedirectResponse.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/RedirectResponse.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RedirectResponse.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/Request.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Request.php similarity index 96% rename from core/vendor/Symfony/Component/HttpFoundation/Request.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Request.php index e66abb7..3a20ed9 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/Request.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Request.php @@ -453,7 +453,9 @@ class Request if ($this->server->has('HTTP_CLIENT_IP')) { return $this->server->get('HTTP_CLIENT_IP'); } 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() { - 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 * and have consistent escaping. * - * @return string A normalized query string for the Request + * @return string|null A normalized query string for the Request * * @api */ @@ -845,6 +851,24 @@ class Request $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. * @@ -903,7 +927,7 @@ class Request * * @param array $locales An array of ordered available locales * - * @return string The preferred locale + * @return string|null The preferred locale * * @api */ @@ -911,7 +935,7 @@ class Request { $preferredLanguages = $this->getLanguages(); - if (null === $locales) { + if (empty($locales)) { return isset($preferredLanguages[0]) ? $preferredLanguages[0] : null; } @@ -1017,6 +1041,8 @@ class Request * Splits an Accept-* HTTP header. * * @param string $header Header to split + * + * @return array Array indexed by the values of the Accept-* header in preferred order */ public function splitHttpAcceptHeader($header) { @@ -1027,9 +1053,9 @@ class Request $values = array(); foreach (array_filter(explode(',', $header)) as $value) { // Cut off any q-value that might come after a semi-colon - if ($pos = strpos($value, ';')) { - $q = (float) trim(substr($value, strpos($value, '=') + 1)); - $value = trim(substr($value, 0, $pos)); + if (preg_match('/;\s*(q=.*$)/', $value, $match)) { + $q = (float) substr(trim($match[1]), 2); + $value = trim(substr($value, 0, -strlen($match[0]))); } else { $q = 1; } @@ -1057,7 +1083,7 @@ class Request { $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 $requestUri = $this->headers->get('X_REWRITE_URL'); } elseif ($this->server->get('IIS_WasUrlRewritten') == '1' && $this->server->get('UNENCODED_URL') != '') { diff --git a/core/vendor/Symfony/Component/HttpFoundation/RequestMatcher.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RequestMatcher.php similarity index 96% rename from core/vendor/Symfony/Component/HttpFoundation/RequestMatcher.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RequestMatcher.php index 52ba078..e82b3e1 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/RequestMatcher.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RequestMatcher.php @@ -135,7 +135,7 @@ class RequestMatcher implements RequestMatcherInterface protected function checkIp4($requestIp, $ip) { if (false !== strpos($ip, '/')) { - list($address, $netmask) = explode('/', $ip); + list($address, $netmask) = explode('/', $ip, 2); if ($netmask < 1 || $netmask > 32) { 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".'); } - list($address, $netmask) = explode('/', $ip); + list($address, $netmask) = explode('/', $ip, 2); $bytes_addr = unpack("n*", inet_pton($address)); $bytes_test = unpack("n*", inet_pton($requestIp)); for ($i = 1, $ceil = ceil($netmask / 16); $i <= $ceil; $i++) { $left = $netmask - 16 * ($i-1); - $left = ($left <= 16) ?: 16; + $left = ($left <= 16) ? $left : 16; $mask = ~(0xffff >> $left) & 0xffff; if (($bytes_addr[$i] & $mask) != ($bytes_test[$i] & $mask)) { return false; diff --git a/core/vendor/Symfony/Component/HttpFoundation/RequestMatcherInterface.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RequestMatcherInterface.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/RequestMatcherInterface.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RequestMatcherInterface.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/Response.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Response.php similarity index 95% rename from core/vendor/Symfony/Component/HttpFoundation/Response.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Response.php index e8a7d56..b6cb484 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/Response.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Response.php @@ -134,7 +134,7 @@ class Response $charset = $this->charset ?: 'UTF-8'; if (!$this->headers->has('Content-Type')) { $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 $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. * @@ -215,7 +215,7 @@ class Response } /** - * Gets the current response content + * Gets the current response 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 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 * @@ -283,7 +283,7 @@ class Response } /** - * Sets response charset. + * Sets the response charset. * * @param string $charset Character set * @@ -409,7 +409,7 @@ class Response * * @return \DateTime A \DateTime instance * - * @throws \RuntimeException when the header is not parseable + * @throws \RuntimeException When the header is not parseable * * @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. * @@ -522,7 +522,7 @@ class Response * * This methods sets the Cache-Control max-age directive. * - * @param integer $value A number of seconds + * @param integer $value Number of seconds * * @api */ @@ -536,7 +536,7 @@ class Response * * This methods sets the Cache-Control s-maxage directive. * - * @param integer $value A number of seconds + * @param integer $value Number of seconds * * @api */ @@ -572,7 +572,7 @@ class Response * * This method adjusts the Cache-Control/s-maxage directive. * - * @param integer $seconds The number of seconds + * @param integer $seconds Number of seconds * * @api */ @@ -586,7 +586,7 @@ class Response * * This method adjusts the Cache-Control/max-age directive. * - * @param integer $seconds The number of seconds + * @param integer $seconds Number of seconds * * @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. * @@ -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 * @@ -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. * @@ -672,7 +672,7 @@ class Response public function setCache(array $options) { 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'])) { @@ -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. * * 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 * - * @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 */ diff --git a/core/vendor/Symfony/Component/HttpFoundation/ResponseHeaderBag.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ResponseHeaderBag.php similarity index 99% rename from core/vendor/Symfony/Component/HttpFoundation/ResponseHeaderBag.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ResponseHeaderBag.php index f243dcc..999f0ab 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/ResponseHeaderBag.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ResponseHeaderBag.php @@ -120,6 +120,7 @@ class ResponseHeaderBag extends HeaderBag * Sets a cookie. * * @param Cookie $cookie + * * @return void * * @api @@ -135,6 +136,7 @@ class ResponseHeaderBag extends HeaderBag * @param string $name * @param string $path * @param string $domain + * * @return void * * @api @@ -195,6 +197,7 @@ class ResponseHeaderBag extends HeaderBag * @param string $name * @param string $path * @param string $domain + * * @return void * * @api diff --git a/core/vendor/Symfony/Component/HttpFoundation/ServerBag.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ServerBag.php similarity index 96% rename from core/vendor/Symfony/Component/HttpFoundation/ServerBag.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ServerBag.php index 02db3b1..9cb7786 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/ServerBag.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ServerBag.php @@ -23,7 +23,7 @@ class ServerBag extends ParameterBag { $headers = array(); foreach ($this->parameters as $key => $value) { - if ('HTTP_' === substr($key, 0, 5)) { + if (0 === strpos($key, 'HTTP_')) { $headers[substr($key, 5)] = $value; } // CONTENT_* are not prefixed with HTTP_ diff --git a/core/vendor/Symfony/Component/HttpFoundation/Session.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/Session.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/SessionStorage/ArraySessionStorage.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/SessionStorage/ArraySessionStorage.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/SessionStorage/ArraySessionStorage.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/SessionStorage/ArraySessionStorage.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/SessionStorage/FilesystemSessionStorage.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/SessionStorage/FilesystemSessionStorage.php similarity index 97% rename from core/vendor/Symfony/Component/HttpFoundation/SessionStorage/FilesystemSessionStorage.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/SessionStorage/FilesystemSessionStorage.php index 87abd01..e6eb9ba 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/SessionStorage/FilesystemSessionStorage.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/SessionStorage/FilesystemSessionStorage.php @@ -94,7 +94,8 @@ class FilesystemSessionStorage extends NativeSessionStorage * * 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 * diff --git a/core/vendor/Symfony/Component/HttpFoundation/SessionStorage/NativeSessionStorage.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/SessionStorage/NativeSessionStorage.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/SessionStorage/NativeSessionStorage.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/SessionStorage/NativeSessionStorage.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/SessionStorage/PdoSessionStorage.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/SessionStorage/PdoSessionStorage.php similarity index 94% rename from core/vendor/Symfony/Component/HttpFoundation/SessionStorage/PdoSessionStorage.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/SessionStorage/PdoSessionStorage.php index 78f90b8..09d032a 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/SessionStorage/PdoSessionStorage.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/SessionStorage/PdoSessionStorage.php @@ -143,7 +143,6 @@ class PdoSessionStorage extends NativeSessionStorage $sql = "DELETE FROM $dbTable WHERE $dbTimeCol < (:time - $lifetime)"; try { - $this->db->query($sql); $stmt = $this->db->prepare($sql); $stmt->bindValue(':time', time(), \PDO::PARAM_INT); $stmt->execute(); @@ -182,7 +181,7 @@ class PdoSessionStorage extends NativeSessionStorage $sessionRows = $stmt->fetchAll(\PDO::FETCH_NUM); if (count($sessionRows) == 1) { - return $sessionRows[0][0]; + return base64_decode($sessionRows[0][0]); } // session does not exist, create it @@ -218,9 +217,11 @@ class PdoSessionStorage extends NativeSessionStorage : "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->db->prepare($sql); $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->execute(); @@ -252,9 +253,11 @@ class PdoSessionStorage extends NativeSessionStorage $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->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->execute(); diff --git a/core/vendor/Symfony/Component/HttpFoundation/SessionStorage/SessionStorageInterface.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/SessionStorage/SessionStorageInterface.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/SessionStorage/SessionStorageInterface.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/SessionStorage/SessionStorageInterface.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/composer.json b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/composer.json similarity index 76% rename from core/vendor/Symfony/Component/HttpFoundation/composer.json rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/composer.json index b3cfbbd..53e0b10 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/composer.json +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/composer.json @@ -4,7 +4,6 @@ "description": "Symfony HttpFoundation Component", "keywords": [], "homepage": "http://symfony.com", - "version": "2.0.4", "license": "MIT", "authors": [ { @@ -18,5 +17,9 @@ ], "require": { "php": ">=5.3.2" - } + }, + "autoload": { + "psr-0": { "Symfony\\Component\\HttpFoundation": "" } + }, + "target-dir": "Symfony/Component/HttpFoundation" }