diff --git a/core/composer.lock b/core/composer.lock index d8e860821325addc6b16b9b32522b165eeb68050..9ca06b56679315368d9c6651a06cf72a4dcd8c92 100644 --- a/core/composer.lock +++ b/core/composer.lock @@ -366,12 +366,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/ClassLoader", - "reference": "329e3c07fd7222160c647013d4dc936a76743ff6" + "reference": "0730d0f8f99cfeafbc23271f1e87f54da15f1e06" }, "dist": { "type": "zip", - "url": "https://github.com/symfony/ClassLoader/archive/329e3c07fd7222160c647013d4dc936a76743ff6.zip", - "reference": "329e3c07fd7222160c647013d4dc936a76743ff6", + "url": "https://github.com/symfony/ClassLoader/archive/0730d0f8f99cfeafbc23271f1e87f54da15f1e06.zip", + "reference": "0730d0f8f99cfeafbc23271f1e87f54da15f1e06", "shasum": "" }, "require": { @@ -380,7 +380,7 @@ "require-dev": { "symfony/finder": "2.2.*" }, - "time": "2012-11-19 12:58:52", + "time": "2013-01-04 16:58:00", "type": "library", "extra": { "branch-alias": { @@ -417,12 +417,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/DependencyInjection", - "reference": "e2713da6f3713eba1bc26dfeeaa7aefde8914676" + "reference": "13b47742e1ef22aed78132e5e0930d28571142a4" }, "dist": { "type": "zip", - "url": "https://github.com/symfony/DependencyInjection/archive/e2713da6f3713eba1bc26dfeeaa7aefde8914676.zip", - "reference": "e2713da6f3713eba1bc26dfeeaa7aefde8914676", + "url": "https://github.com/symfony/DependencyInjection/archive/13b47742e1ef22aed78132e5e0930d28571142a4.zip", + "reference": "13b47742e1ef22aed78132e5e0930d28571142a4", "shasum": "" }, "require": { @@ -436,7 +436,7 @@ "symfony/yaml": "2.2.*", "symfony/config": "2.2.*" }, - "time": "2012-11-19 12:58:52", + "time": "2013-01-04 16:58:00", "type": "library", "extra": { "branch-alias": { @@ -473,12 +473,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/EventDispatcher", - "reference": "eb290a447c0af5bea0d3de5d95d498afd8c82f89" + "reference": "0fcc9fa82fa3ea7ec2605af2e8137698fbaca3dc" }, "dist": { "type": "zip", - "url": "https://github.com/symfony/EventDispatcher/archive/eb290a447c0af5bea0d3de5d95d498afd8c82f89.zip", - "reference": "eb290a447c0af5bea0d3de5d95d498afd8c82f89", + "url": "https://github.com/symfony/EventDispatcher/archive/0fcc9fa82fa3ea7ec2605af2e8137698fbaca3dc.zip", + "reference": "0fcc9fa82fa3ea7ec2605af2e8137698fbaca3dc", "shasum": "" }, "require": { @@ -491,7 +491,7 @@ "symfony/dependency-injection": "2.2.*", "symfony/http-kernel": "2.2.*" }, - "time": "2012-11-13 14:08:04", + "time": "2013-01-04 17:02:19", "type": "library", "extra": { "branch-alias": { @@ -528,18 +528,18 @@ "source": { "type": "git", "url": "https://github.com/symfony/HttpFoundation", - "reference": "067c310fe4d0691a24adc97f39500233a58e42cb" + "reference": "5aa0119417f1fc8de7513d9432dd2f43f9d9e97b" }, "dist": { "type": "zip", - "url": "https://github.com/symfony/HttpFoundation/archive/067c310fe4d0691a24adc97f39500233a58e42cb.zip", - "reference": "067c310fe4d0691a24adc97f39500233a58e42cb", + "url": "https://github.com/symfony/HttpFoundation/archive/5aa0119417f1fc8de7513d9432dd2f43f9d9e97b.zip", + "reference": "5aa0119417f1fc8de7513d9432dd2f43f9d9e97b", "shasum": "" }, "require": { "php": ">=5.3.3" }, - "time": "2012-12-06 15:23:16", + "time": "2013-01-04 17:02:19", "type": "library", "extra": { "branch-alias": { @@ -579,12 +579,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/HttpKernel", - "reference": "dbd6b331aab91deb9e97307eac666b77a0879e07" + "reference": "ce164c088666b80ffc116173065d504055414137" }, "dist": { "type": "zip", - "url": "https://github.com/symfony/HttpKernel/archive/dbd6b331aab91deb9e97307eac666b77a0879e07.zip", - "reference": "dbd6b331aab91deb9e97307eac666b77a0879e07", + "url": "https://github.com/symfony/HttpKernel/archive/ce164c088666b80ffc116173065d504055414137.zip", + "reference": "ce164c088666b80ffc116173065d504055414137", "shasum": "" }, "require": { @@ -611,7 +611,7 @@ "symfony/dependency-injection": "2.2.*", "symfony/finder": "2.2.*" }, - "time": "2012-12-06 13:04:11", + "time": "2013-01-04 16:58:00", "type": "library", "extra": { "branch-alias": { @@ -691,12 +691,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/Routing", - "reference": "17109bfef57e52b35d76db4d35b3b66b1d176701" + "reference": "87a66890450658ccac99702ac5e4f002ece9e23e" }, "dist": { "type": "zip", - "url": "https://github.com/symfony/Routing/archive/17109bfef57e52b35d76db4d35b3b66b1d176701.zip", - "reference": "17109bfef57e52b35d76db4d35b3b66b1d176701", + "url": "https://github.com/symfony/Routing/archive/87a66890450658ccac99702ac5e4f002ece9e23e.zip", + "reference": "87a66890450658ccac99702ac5e4f002ece9e23e", "shasum": "" }, "require": { @@ -713,7 +713,7 @@ "symfony/config": "2.2.*", "symfony/yaml": "2.2.*" }, - "time": "2012-12-05 15:37:03", + "time": "2012-12-28 13:21:48", "type": "library", "extra": { "branch-alias": { @@ -750,18 +750,18 @@ "source": { "type": "git", "url": "https://github.com/symfony/Serializer", - "reference": "60abc7e72a5198192c42fc07bb8c1e3082e7229e" + "reference": "ef3d92815bdb07281ee8cbd73b3e3f9e41bdc1a0" }, "dist": { "type": "zip", - "url": "https://github.com/symfony/Serializer/archive/60abc7e72a5198192c42fc07bb8c1e3082e7229e.zip", - "reference": "60abc7e72a5198192c42fc07bb8c1e3082e7229e", + "url": "https://github.com/symfony/Serializer/archive/ef3d92815bdb07281ee8cbd73b3e3f9e41bdc1a0.zip", + "reference": "ef3d92815bdb07281ee8cbd73b3e3f9e41bdc1a0", "shasum": "" }, "require": { "php": ">=5.3.3" }, - "time": "2012-11-17 17:07:16", + "time": "2012-12-19 07:09:49", "type": "library", "extra": { "branch-alias": { @@ -798,18 +798,18 @@ "source": { "type": "git", "url": "https://github.com/symfony/Yaml", - "reference": "bed4fddc24392513e01b32a78d600b1272ed9a6c" + "reference": "365b4df7802b9bb93084d2cc9a51fe88b488f956" }, "dist": { "type": "zip", - "url": "https://github.com/symfony/Yaml/archive/bed4fddc24392513e01b32a78d600b1272ed9a6c.zip", - "reference": "bed4fddc24392513e01b32a78d600b1272ed9a6c", + "url": "https://github.com/symfony/Yaml/archive/365b4df7802b9bb93084d2cc9a51fe88b488f956.zip", + "reference": "365b4df7802b9bb93084d2cc9a51fe88b488f956", "shasum": "" }, "require": { "php": ">=5.3.3" }, - "time": "2012-11-13 14:08:04", + "time": "2012-12-19 07:09:49", "type": "library", "extra": { "branch-alias": { diff --git a/core/vendor/autoload.php b/core/vendor/autoload.php index 7bc91232cbcd8b3136b03f9bb78e0fb47a07bc2d..622540f4062ceb38f6d77d5a9ce13d9f926888cd 100644 --- a/core/vendor/autoload.php +++ b/core/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer' . '/autoload_real.php'; -return ComposerAutoloaderInit23a41d5f637bb8e297fc063ef4ab931a::getLoader(); +return ComposerAutoloaderInit4f0cafaacf65c45167c785b9f087e425::getLoader(); diff --git a/core/vendor/composer/autoload_real.php b/core/vendor/composer/autoload_real.php index 9634e0b11d737b753ec7cfb434ea1707b25cfc61..d492d5c65a8a382a00cea8473d90b0a4d0469de1 100644 --- a/core/vendor/composer/autoload_real.php +++ b/core/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php generated by Composer -class ComposerAutoloaderInit23a41d5f637bb8e297fc063ef4ab931a +class ComposerAutoloaderInit4f0cafaacf65c45167c785b9f087e425 { private static $loader; @@ -15,13 +15,13 @@ public static function loadClassLoader($class) public static function getLoader() { - if (null !== static::$loader) { - return static::$loader; + if (null !== self::$loader) { + return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit23a41d5f637bb8e297fc063ef4ab931a', 'loadClassLoader')); - static::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInit23a41d5f637bb8e297fc063ef4ab931a', 'loadClassLoader')); + spl_autoload_register(array('ComposerAutoloaderInit4f0cafaacf65c45167c785b9f087e425', 'loadClassLoader')); + self::$loader = $loader = new \Composer\Autoload\ClassLoader(); + spl_autoload_unregister(array('ComposerAutoloaderInit4f0cafaacf65c45167c785b9f087e425', 'loadClassLoader')); $vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); diff --git a/core/vendor/composer/installed.json b/core/vendor/composer/installed.json index 9dd2912b4cdcba5e3869f9830c98751d7e11b199..bb8d2e19da5e8ec6ae070d5753a1f2cd2ca99b9a 100644 --- a/core/vendor/composer/installed.json +++ b/core/vendor/composer/installed.json @@ -228,6 +228,237 @@ "minification" ] }, + { + "name": "guzzle/common", + "version": "dev-master", + "version_normalized": "9999999-dev", + "target-dir": "Guzzle/Common", + "source": { + "type": "git", + "url": "git://github.com/guzzle/common.git", + "reference": "23162d56daa85b1ee6f1d73d9b5a5ecda2d70849" + }, + "dist": { + "type": "zip", + "url": "https://github.com/guzzle/common/archive/23162d56daa85b1ee6f1d73d9b5a5ecda2d70849.zip", + "reference": "23162d56daa85b1ee6f1d73d9b5a5ecda2d70849", + "shasum": "" + }, + "require": { + "php": ">=5.3.2", + "symfony/event-dispatcher": ">=2.1" + }, + "time": "2012-12-06 02:26:39", + "type": "library", + "installation-source": "source", + "autoload": { + "psr-0": { + "Guzzle\\Common": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Common libraries used by Guzzle", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "event", + "exception", + "common", + "collection" + ] + }, + { + "name": "guzzle/stream", + "version": "dev-master", + "version_normalized": "9999999-dev", + "target-dir": "Guzzle/Stream", + "source": { + "type": "git", + "url": "https://github.com/guzzle/stream", + "reference": "v3.0.5" + }, + "dist": { + "type": "zip", + "url": "https://github.com/guzzle/stream/archive/v3.0.5.zip", + "reference": "v3.0.5", + "shasum": "" + }, + "require": { + "php": ">=5.3.2", + "guzzle/common": "self.version" + }, + "time": "2012-11-11 23:54:57", + "type": "library", + "installation-source": "source", + "autoload": { + "psr-0": { + "Guzzle\\Stream": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle stream wrapper component", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "stream", + "Guzzle", + "component" + ] + }, + { + "name": "guzzle/parser", + "version": "dev-master", + "version_normalized": "9999999-dev", + "target-dir": "Guzzle/Parser", + "source": { + "type": "git", + "url": "git://github.com/guzzle/parser.git", + "reference": "v3.0.5" + }, + "dist": { + "type": "zip", + "url": "https://github.com/guzzle/parser/archive/v3.0.5.zip", + "reference": "v3.0.5", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "time": "2012-11-19 00:07:13", + "type": "library", + "installation-source": "source", + "autoload": { + "psr-0": { + "Guzzle\\Parser": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Interchangeable parsers used by Guzzle", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "http", + "url", + "message", + "cookie", + "URI Template" + ] + }, + { + "name": "guzzle/http", + "version": "dev-master", + "version_normalized": "9999999-dev", + "target-dir": "Guzzle/Http", + "source": { + "type": "git", + "url": "git://github.com/guzzle/http.git", + "reference": "v3.0.5" + }, + "dist": { + "type": "zip", + "url": "https://github.com/guzzle/http/archive/v3.0.5.zip", + "reference": "v3.0.5", + "shasum": "" + }, + "require": { + "php": ">=5.3.2", + "guzzle/common": "self.version", + "guzzle/parser": "self.version", + "guzzle/stream": "self.version" + }, + "time": "2012-11-18 05:28:55", + "type": "library", + "installation-source": "source", + "autoload": { + "psr-0": { + "Guzzle\\Http": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "HTTP libraries used by Guzzle", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "curl", + "http", + "http client", + "client", + "Guzzle" + ] + }, + { + "name": "symfony-cmf/routing", + "version": "dev-master", + "version_normalized": "9999999-dev", + "target-dir": "Symfony/Cmf/Component/Routing", + "source": { + "type": "git", + "url": "https://github.com/symfony-cmf/Routing", + "reference": "1.0.0-alpha3" + }, + "dist": { + "type": "zip", + "url": "https://github.com/symfony-cmf/Routing/archive/1.0.0-alpha3.zip", + "reference": "1.0.0-alpha3", + "shasum": "" + }, + "require": { + "php": ">=5.3.2", + "symfony/routing": ">=2.1,<2.3-dev", + "symfony/http-kernel": ">=2.1,<2.3-dev" + }, + "time": "2012-12-16 17:52:57", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "installation-source": "source", + "autoload": { + "psr-0": { + "Symfony\\Cmf\\Component\\Routing": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony CMF Community", + "homepage": "https://github.com/symfony-cmf/Routing/contributors" + } + ], + "description": "Extends the Symfony2 routing component for dynamic routes and chaining several routers", + "homepage": "http://cmf.symfony.com", + "keywords": [ + "database", + "routing" + ] + }, { "name": "symfony/class-loader", "version": "dev-master", @@ -236,12 +467,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/ClassLoader", - "reference": "329e3c07fd7222160c647013d4dc936a76743ff6" + "reference": "0730d0f8f99cfeafbc23271f1e87f54da15f1e06" }, "dist": { "type": "zip", - "url": "https://github.com/symfony/ClassLoader/archive/329e3c07fd7222160c647013d4dc936a76743ff6.zip", - "reference": "329e3c07fd7222160c647013d4dc936a76743ff6", + "url": "https://github.com/symfony/ClassLoader/archive/0730d0f8f99cfeafbc23271f1e87f54da15f1e06.zip", + "reference": "0730d0f8f99cfeafbc23271f1e87f54da15f1e06", "shasum": "" }, "require": { @@ -250,7 +481,7 @@ "require-dev": { "symfony/finder": "2.2.*" }, - "time": "2012-11-19 12:58:52", + "time": "2013-01-04 16:58:00", "type": "library", "extra": { "branch-alias": { @@ -288,12 +519,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/DependencyInjection", - "reference": "e2713da6f3713eba1bc26dfeeaa7aefde8914676" + "reference": "13b47742e1ef22aed78132e5e0930d28571142a4" }, "dist": { "type": "zip", - "url": "https://github.com/symfony/DependencyInjection/archive/e2713da6f3713eba1bc26dfeeaa7aefde8914676.zip", - "reference": "e2713da6f3713eba1bc26dfeeaa7aefde8914676", + "url": "https://github.com/symfony/DependencyInjection/archive/13b47742e1ef22aed78132e5e0930d28571142a4.zip", + "reference": "13b47742e1ef22aed78132e5e0930d28571142a4", "shasum": "" }, "require": { @@ -307,7 +538,7 @@ "symfony/yaml": "2.2.*", "symfony/config": "2.2.*" }, - "time": "2012-11-19 12:58:52", + "time": "2013-01-04 16:58:00", "type": "library", "extra": { "branch-alias": { @@ -338,25 +569,32 @@ "homepage": "http://symfony.com" }, { - "name": "symfony/http-foundation", + "name": "symfony/event-dispatcher", "version": "dev-master", "version_normalized": "9999999-dev", - "target-dir": "Symfony/Component/HttpFoundation", + "target-dir": "Symfony/Component/EventDispatcher", "source": { "type": "git", - "url": "https://github.com/symfony/HttpFoundation", - "reference": "067c310fe4d0691a24adc97f39500233a58e42cb" + "url": "https://github.com/symfony/EventDispatcher", + "reference": "0fcc9fa82fa3ea7ec2605af2e8137698fbaca3dc" }, "dist": { "type": "zip", - "url": "https://github.com/symfony/HttpFoundation/archive/067c310fe4d0691a24adc97f39500233a58e42cb.zip", - "reference": "067c310fe4d0691a24adc97f39500233a58e42cb", + "url": "https://github.com/symfony/EventDispatcher/archive/0fcc9fa82fa3ea7ec2605af2e8137698fbaca3dc.zip", + "reference": "0fcc9fa82fa3ea7ec2605af2e8137698fbaca3dc", "shasum": "" }, "require": { "php": ">=5.3.3" }, - "time": "2012-12-06 15:23:16", + "require-dev": { + "symfony/dependency-injection": "2.2.*" + }, + "suggest": { + "symfony/dependency-injection": "2.2.*", + "symfony/http-kernel": "2.2.*" + }, + "time": "2013-01-04 17:02:19", "type": "library", "extra": { "branch-alias": { @@ -366,11 +604,8 @@ "installation-source": "source", "autoload": { "psr-0": { - "Symfony\\Component\\HttpFoundation\\": "" - }, - "classmap": [ - "Symfony/Component/HttpFoundation/Resources/stubs" - ] + "Symfony\\Component\\EventDispatcher\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -386,36 +621,29 @@ "homepage": "http://symfony.com/contributors" } ], - "description": "Symfony HttpFoundation Component", + "description": "Symfony EventDispatcher Component", "homepage": "http://symfony.com" }, { - "name": "symfony/event-dispatcher", + "name": "symfony/http-foundation", "version": "dev-master", "version_normalized": "9999999-dev", - "target-dir": "Symfony/Component/EventDispatcher", + "target-dir": "Symfony/Component/HttpFoundation", "source": { "type": "git", - "url": "https://github.com/symfony/EventDispatcher", - "reference": "eb290a447c0af5bea0d3de5d95d498afd8c82f89" + "url": "https://github.com/symfony/HttpFoundation", + "reference": "5aa0119417f1fc8de7513d9432dd2f43f9d9e97b" }, "dist": { "type": "zip", - "url": "https://github.com/symfony/EventDispatcher/archive/eb290a447c0af5bea0d3de5d95d498afd8c82f89.zip", - "reference": "eb290a447c0af5bea0d3de5d95d498afd8c82f89", + "url": "https://github.com/symfony/HttpFoundation/archive/5aa0119417f1fc8de7513d9432dd2f43f9d9e97b.zip", + "reference": "5aa0119417f1fc8de7513d9432dd2f43f9d9e97b", "shasum": "" }, "require": { "php": ">=5.3.3" }, - "require-dev": { - "symfony/dependency-injection": "2.2.*" - }, - "suggest": { - "symfony/dependency-injection": "2.2.*", - "symfony/http-kernel": "2.2.*" - }, - "time": "2012-11-13 14:08:04", + "time": "2013-01-04 17:02:19", "type": "library", "extra": { "branch-alias": { @@ -425,8 +653,11 @@ "installation-source": "source", "autoload": { "psr-0": { - "Symfony\\Component\\EventDispatcher\\": "" - } + "Symfony\\Component\\HttpFoundation\\": "" + }, + "classmap": [ + "Symfony/Component/HttpFoundation/Resources/stubs" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -442,7 +673,7 @@ "homepage": "http://symfony.com/contributors" } ], - "description": "Symfony EventDispatcher Component", + "description": "Symfony HttpFoundation Component", "homepage": "http://symfony.com" }, { @@ -453,12 +684,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/HttpKernel", - "reference": "dbd6b331aab91deb9e97307eac666b77a0879e07" + "reference": "ce164c088666b80ffc116173065d504055414137" }, "dist": { "type": "zip", - "url": "https://github.com/symfony/HttpKernel/archive/dbd6b331aab91deb9e97307eac666b77a0879e07.zip", - "reference": "dbd6b331aab91deb9e97307eac666b77a0879e07", + "url": "https://github.com/symfony/HttpKernel/archive/ce164c088666b80ffc116173065d504055414137.zip", + "reference": "ce164c088666b80ffc116173065d504055414137", "shasum": "" }, "require": { @@ -485,7 +716,7 @@ "symfony/dependency-injection": "2.2.*", "symfony/finder": "2.2.*" }, - "time": "2012-12-06 13:04:11", + "time": "2013-01-04 16:58:00", "type": "library", "extra": { "branch-alias": { @@ -523,12 +754,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/Routing", - "reference": "17109bfef57e52b35d76db4d35b3b66b1d176701" + "reference": "87a66890450658ccac99702ac5e4f002ece9e23e" }, "dist": { "type": "zip", - "url": "https://github.com/symfony/Routing/archive/17109bfef57e52b35d76db4d35b3b66b1d176701.zip", - "reference": "17109bfef57e52b35d76db4d35b3b66b1d176701", + "url": "https://github.com/symfony/Routing/archive/87a66890450658ccac99702ac5e4f002ece9e23e.zip", + "reference": "87a66890450658ccac99702ac5e4f002ece9e23e", "shasum": "" }, "require": { @@ -545,7 +776,7 @@ "symfony/config": "2.2.*", "symfony/yaml": "2.2.*" }, - "time": "2012-12-05 15:37:03", + "time": "2012-12-28 13:21:48", "type": "library", "extra": { "branch-alias": { @@ -583,18 +814,18 @@ "source": { "type": "git", "url": "https://github.com/symfony/Serializer", - "reference": "60abc7e72a5198192c42fc07bb8c1e3082e7229e" + "reference": "ef3d92815bdb07281ee8cbd73b3e3f9e41bdc1a0" }, "dist": { "type": "zip", - "url": "https://github.com/symfony/Serializer/archive/60abc7e72a5198192c42fc07bb8c1e3082e7229e.zip", - "reference": "60abc7e72a5198192c42fc07bb8c1e3082e7229e", + "url": "https://github.com/symfony/Serializer/archive/ef3d92815bdb07281ee8cbd73b3e3f9e41bdc1a0.zip", + "reference": "ef3d92815bdb07281ee8cbd73b3e3f9e41bdc1a0", "shasum": "" }, "require": { "php": ">=5.3.3" }, - "time": "2012-11-17 17:07:16", + "time": "2012-12-19 07:09:49", "type": "library", "extra": { "branch-alias": { @@ -632,18 +863,18 @@ "source": { "type": "git", "url": "https://github.com/symfony/Yaml", - "reference": "bed4fddc24392513e01b32a78d600b1272ed9a6c" + "reference": "365b4df7802b9bb93084d2cc9a51fe88b488f956" }, "dist": { "type": "zip", - "url": "https://github.com/symfony/Yaml/archive/bed4fddc24392513e01b32a78d600b1272ed9a6c.zip", - "reference": "bed4fddc24392513e01b32a78d600b1272ed9a6c", + "url": "https://github.com/symfony/Yaml/archive/365b4df7802b9bb93084d2cc9a51fe88b488f956.zip", + "reference": "365b4df7802b9bb93084d2cc9a51fe88b488f956", "shasum": "" }, "require": { "php": ">=5.3.3" }, - "time": "2012-11-13 14:08:04", + "time": "2012-12-19 07:09:49", "type": "library", "extra": { "branch-alias": { @@ -672,236 +903,5 @@ ], "description": "Symfony Yaml Component", "homepage": "http://symfony.com" - }, - { - "name": "guzzle/common", - "version": "dev-master", - "version_normalized": "9999999-dev", - "target-dir": "Guzzle/Common", - "source": { - "type": "git", - "url": "git://github.com/guzzle/common.git", - "reference": "23162d56daa85b1ee6f1d73d9b5a5ecda2d70849" - }, - "dist": { - "type": "zip", - "url": "https://github.com/guzzle/common/archive/23162d56daa85b1ee6f1d73d9b5a5ecda2d70849.zip", - "reference": "23162d56daa85b1ee6f1d73d9b5a5ecda2d70849", - "shasum": "" - }, - "require": { - "php": ">=5.3.2", - "symfony/event-dispatcher": ">=2.1" - }, - "time": "2012-12-06 02:26:39", - "type": "library", - "installation-source": "source", - "autoload": { - "psr-0": { - "Guzzle\\Common": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Common libraries used by Guzzle", - "homepage": "http://guzzlephp.org/", - "keywords": [ - "event", - "exception", - "common", - "collection" - ] - }, - { - "name": "guzzle/stream", - "version": "dev-master", - "version_normalized": "9999999-dev", - "target-dir": "Guzzle/Stream", - "source": { - "type": "git", - "url": "https://github.com/guzzle/stream", - "reference": "v3.0.5" - }, - "dist": { - "type": "zip", - "url": "https://github.com/guzzle/stream/archive/v3.0.5.zip", - "reference": "v3.0.5", - "shasum": "" - }, - "require": { - "php": ">=5.3.2", - "guzzle/common": "self.version" - }, - "time": "2012-11-11 23:54:57", - "type": "library", - "installation-source": "source", - "autoload": { - "psr-0": { - "Guzzle\\Stream": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Guzzle stream wrapper component", - "homepage": "http://guzzlephp.org/", - "keywords": [ - "stream", - "Guzzle", - "component" - ] - }, - { - "name": "guzzle/parser", - "version": "dev-master", - "version_normalized": "9999999-dev", - "target-dir": "Guzzle/Parser", - "source": { - "type": "git", - "url": "git://github.com/guzzle/parser.git", - "reference": "v3.0.5" - }, - "dist": { - "type": "zip", - "url": "https://github.com/guzzle/parser/archive/v3.0.5.zip", - "reference": "v3.0.5", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "time": "2012-11-19 00:07:13", - "type": "library", - "installation-source": "source", - "autoload": { - "psr-0": { - "Guzzle\\Parser": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Interchangeable parsers used by Guzzle", - "homepage": "http://guzzlephp.org/", - "keywords": [ - "http", - "url", - "message", - "cookie", - "URI Template" - ] - }, - { - "name": "guzzle/http", - "version": "dev-master", - "version_normalized": "9999999-dev", - "target-dir": "Guzzle/Http", - "source": { - "type": "git", - "url": "git://github.com/guzzle/http.git", - "reference": "v3.0.5" - }, - "dist": { - "type": "zip", - "url": "https://github.com/guzzle/http/archive/v3.0.5.zip", - "reference": "v3.0.5", - "shasum": "" - }, - "require": { - "php": ">=5.3.2", - "guzzle/common": "self.version", - "guzzle/parser": "self.version", - "guzzle/stream": "self.version" - }, - "time": "2012-11-18 05:28:55", - "type": "library", - "installation-source": "source", - "autoload": { - "psr-0": { - "Guzzle\\Http": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "HTTP libraries used by Guzzle", - "homepage": "http://guzzlephp.org/", - "keywords": [ - "curl", - "http", - "http client", - "client", - "Guzzle" - ] - }, - { - "name": "symfony-cmf/routing", - "version": "dev-master", - "version_normalized": "9999999-dev", - "target-dir": "Symfony/Cmf/Component/Routing", - "source": { - "type": "git", - "url": "https://github.com/symfony-cmf/Routing", - "reference": "1.0.0-alpha3" - }, - "dist": { - "type": "zip", - "url": "https://github.com/symfony-cmf/Routing/archive/1.0.0-alpha3.zip", - "reference": "1.0.0-alpha3", - "shasum": "" - }, - "require": { - "php": ">=5.3.2", - "symfony/routing": ">=2.1,<2.3-dev", - "symfony/http-kernel": ">=2.1,<2.3-dev" - }, - "time": "2012-12-16 17:52:57", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "installation-source": "source", - "autoload": { - "psr-0": { - "Symfony\\Cmf\\Component\\Routing": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony CMF Community", - "homepage": "https://github.com/symfony-cmf/Routing/contributors" - } - ], - "description": "Extends the Symfony2 routing component for dynamic routes and chaining several routers", - "homepage": "http://cmf.symfony.com", - "keywords": [ - "database", - "routing" - ] } ] diff --git a/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ApcClassLoader.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ApcClassLoader.php index 0ce22f6b944e93ed350eb3874887055510658238..c4c156f7030a6ccd13fb0acb39b1388005abb3c8 100644 --- a/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ApcClassLoader.php +++ b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ApcClassLoader.php @@ -57,6 +57,9 @@ class ApcClassLoader * @param string $prefix The APC namespace prefix to use. * @param object $decorated A class loader object that implements the findFile() method. * + * @throws \RuntimeException + * @throws \InvalidArgumentException + * * @api */ public function __construct($prefix, $decorated) diff --git a/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php index 379fbe4a6d32ccf06c42f4de2bb4c7a58964c210..023f7ba1a62e5c1a16ffb27a7d31de9227bb1087 100644 --- a/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php +++ b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php @@ -69,6 +69,8 @@ class ApcUniversalClassLoader extends UniversalClassLoader * * @param string $prefix A prefix to create a namespace in APC * + * @throws \RuntimeException + * * @api */ public function __construct($prefix) diff --git a/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/DebugClassLoader.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/DebugClassLoader.php index dbfb5ab1e303c45af6e484c372461ad34cf07f23..911b51590265ba6131dd53b2d5b9f212d847c7b3 100644 --- a/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/DebugClassLoader.php +++ b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/DebugClassLoader.php @@ -75,6 +75,8 @@ public function unregister() * @param string $class The name of the class * * @return Boolean|null True, if loaded + * + * @throws \RuntimeException */ public function loadClass($class) { diff --git a/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/LICENSE b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/LICENSE index cdffe7aebc04acd5c2b9c3042a0923d8e8f31998..88a57f8d8da49126c6f7d225d567ad216ace4d83 100644 --- a/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/LICENSE +++ b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2012 Fabien Potencier +Copyright (c) 2004-2013 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 diff --git a/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/UniversalClassLoader.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/UniversalClassLoader.php index e3170ccee08848e99c2fd5a3c5f5838f9773e8a3..ee16e4809c89b961b475dbd98abb22fa07dc128d 100644 --- a/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/UniversalClassLoader.php +++ b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/UniversalClassLoader.php @@ -242,7 +242,7 @@ public function register($prepend = false) * Loads the given class or interface. * * @param string $class The name of the class - * + * * @return Boolean|null True, if loaded */ public function loadClass($class) diff --git a/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/XcacheClassLoader.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/XcacheClassLoader.php index 2decbce834141783d5acee67390ccb5daadd6ae7..31bb00684b6bb403b393c1afa270eb936a93c897 100644 --- a/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/XcacheClassLoader.php +++ b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/XcacheClassLoader.php @@ -51,6 +51,9 @@ class XcacheClassLoader * @param string $prefix A prefix to create a namespace in Xcache * @param object $classFinder An object that implements findFile() method. * + * @throws \RuntimeException + * @throws \InvalidArgumentException + * * @api */ public function __construct($prefix, $classFinder) diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/CHANGELOG.md b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/CHANGELOG.md index 8f5d6b32c8b8dbeeb13a952b6f2757fbc65aefd8..686bd5656f86691b4a954811591c4c0a2102231e 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/CHANGELOG.md +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/CHANGELOG.md @@ -1,6 +1,14 @@ CHANGELOG ========= +2.2.0 +----- + + * added an Extension base class with sensible defaults to be used in conjunction + with the Config component. + * added PrependExtensionInterface (to be able to allow extensions to prepend + application configuration settings for any Bundle) + 2.1.0 ----- @@ -12,4 +20,3 @@ CHANGELOG (this includes dumped containers) * [BC BREAK] fixed unescaping of class arguments, method ParameterBag::unescapeValue() was made public - diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php index a9beb5b9e261e558dfaa33c940a0e88347ccfc35..2bc04927da6f6a67f6cb3ddd4331fa5628548f4c 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php @@ -29,6 +29,12 @@ public function process(ContainerBuilder $container) $definitions = $container->getDefinitions(); $aliases = $container->getAliases(); + foreach ($container->getExtensions() as $extension) { + if ($extension instanceof PrependExtensionInterface) { + $extension->prepend($container); + } + } + foreach ($container->getExtensions() as $name => $extension) { if (!$config = $container->getExtensionConfig($name)) { // this extension was not called @@ -37,6 +43,7 @@ public function process(ContainerBuilder $container) $config = $container->getParameterBag()->resolveValue($config); $tmpContainer = new ContainerBuilder($container->getParameterBag()); + $tmpContainer->setResourceTracking($container->isTrackingResources()); $tmpContainer->addObjectResource($extension); $extension->load($config, $tmpContainer); diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/PrependExtensionInterface.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/PrependExtensionInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..bba1b6cd46d9af3a5a44371c3502e9b8c02fcc14 --- /dev/null +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/PrependExtensionInterface.php @@ -0,0 +1,24 @@ +<?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\DependencyInjection\Compiler; + +use Symfony\Component\DependencyInjection\ContainerBuilder; + +interface PrependExtensionInterface +{ + /** + * Allow an extension to prepend the extension configurations. + * + * @param ContainerBuilder $container + */ + public function prepend(ContainerBuilder $container); +} diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ResolveInvalidReferencesPass.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ResolveInvalidReferencesPass.php index 0674ad4fefe1fb4d705f1637f348cf479fd5e5fc..c69d078e8bcc5b07561f685a45c0b2aadfcb9fe5 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ResolveInvalidReferencesPass.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ResolveInvalidReferencesPass.php @@ -74,7 +74,7 @@ public function process(ContainerBuilder $container) * * @return array * - * @throws \RuntimeException When the config is invalid + * @throws RuntimeException When the config is invalid */ private function processArguments(array $arguments, $inMethodCall = false) { diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ResolveParameterPlaceHoldersPass.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ResolveParameterPlaceHoldersPass.php index 0d9ed164e6ad6bc9ccac3c809b7cfd3868fd38a6..6fc0a873a62bee7cc338eb6d9b44f419b0b54e02 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ResolveParameterPlaceHoldersPass.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ResolveParameterPlaceHoldersPass.php @@ -26,7 +26,7 @@ class ResolveParameterPlaceHoldersPass implements CompilerPassInterface * * @param ContainerBuilder $container * - * @throws ParameterNotFoundException When an invalid parameter is referenced + * @throws ParameterNotFoundException */ public function process(ContainerBuilder $container) { diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Container.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Container.php index 15e54209da76b2a5fc64ad085dcaab16786fd207..0c10109db171651699ca8cab26e7418cdb9aba49 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Container.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Container.php @@ -184,8 +184,8 @@ public function setParameter($name, $value) * @param object $service The service instance * @param string $scope The scope of the service * - * @throws \RuntimeException When trying to set a service in an inactive scope - * @throws \InvalidArgumentException When trying to set a service in the prototype scope + * @throws RuntimeException When trying to set a service in an inactive scope + * @throws InvalidArgumentException When trying to set a service in the prototype scope * * @api */ @@ -401,7 +401,7 @@ public function leaveScope($name) * * @param ScopeInterface $scope * - * @throws \InvalidArgumentException When the scope is invalid + * @throws InvalidArgumentException * * @api */ diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php index 30514cc55dfc6f62e0b27a2cf4e7389154c7be51..6f4390a6e56ca1aa7c4a42c0d8a123dc88d0777e 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php @@ -63,6 +63,31 @@ class ContainerBuilder extends Container implements TaggedContainerInterface */ private $compiler; + private $trackResources = true; + + /** + * Sets the track resources flag. + * + * If you are not using the loaders and therefore don't want + * to depend on the Config component, set this flag to false. + * + * @param Boolean $track true if you want to track resources, false otherwise + */ + public function setResourceTracking($track) + { + $this->trackResources = (Boolean) $track; + } + + /** + * Checks if resources are tracked. + * + * @return Boolean true if resources are tracked, false otherwise + */ + public function isTrackingResources() + { + return $this->trackResources; + } + /** * Registers an extension. * @@ -86,7 +111,7 @@ public function registerExtension(ExtensionInterface $extension) * * @return ExtensionInterface An extension instance * - * @throws \LogicException if the extension is not registered + * @throws LogicException if the extension is not registered * * @api */ @@ -152,6 +177,10 @@ public function getResources() */ public function addResource(ResourceInterface $resource) { + if (!$this->trackResources) { + return $this; + } + $this->resources[] = $resource; return $this; @@ -159,15 +188,19 @@ public function addResource(ResourceInterface $resource) /** * Sets the resources for this configuration. - * + * * @param ResourceInterface[] $resources An array of resources - * + * * @return ContainerBuilder The current instance - * + * * @api */ public function setResources(array $resources) { + if (!$this->trackResources) { + return $this; + } + $this->resources = $resources; return $this; @@ -184,6 +217,10 @@ public function setResources(array $resources) */ public function addObjectResource($object) { + if (!$this->trackResources) { + return $this; + } + $parent = new \ReflectionObject($object); do { $this->addResource(new FileResource($parent->getFileName())); @@ -311,7 +348,10 @@ public function getScopeChildren() public function set($id, $service, $scope = self::SCOPE_CONTAINER) { if ($this->isFrozen()) { - throw new BadMethodCallException('Setting service on a frozen container is not allowed'); + // setting a synthetic service on a frozen container is alright + if (!isset($this->definitions[$id]) || !$this->definitions[$id]->isSynthetic()) { + throw new BadMethodCallException('Setting service on a frozen container is not allowed'); + } } $id = strtolower($id); @@ -434,8 +474,10 @@ public function merge(ContainerBuilder $container) $this->addAliases($container->getAliases()); $this->getParameterBag()->add($container->getParameterBag()->all()); - foreach ($container->getResources() as $resource) { - $this->addResource($resource); + if ($this->trackResources) { + foreach ($container->getResources() as $resource) { + $this->addResource($resource); + } } foreach ($this->extensions as $name => $extension) { @@ -465,6 +507,21 @@ public function getExtensionConfig($name) return $this->extensionConfigs[$name]; } + /** + * Prepends a config array to the configs of the given extension. + * + * @param string $name The name of the extension + * @param array $config The config to set + */ + public function prependExtensionConfig($name, array $config) + { + if (!isset($this->extensionConfigs[$name])) { + $this->extensionConfigs[$name] = array(); + } + + array_unshift($this->extensionConfigs[$name], $config); + } + /** * Compiles the container. * @@ -487,8 +544,10 @@ public function compile() $this->compiler = new Compiler(); } - foreach ($this->compiler->getPassConfig()->getPasses() as $pass) { - $this->addObjectResource($pass); + if ($this->trackResources) { + foreach ($this->compiler->getPassConfig()->getPasses() as $pass) { + $this->addObjectResource($pass); + } } $this->compiler->compile($this); @@ -541,8 +600,8 @@ public function setAliases(array $aliases) * @param string $alias The alias to create * @param string|Alias $id The service to alias * - * @throws \InvalidArgumentException if the id is not a string or an Alias - * @throws \InvalidArgumentException if the alias is for itself + * @throws InvalidArgumentException if the id is not a string or an Alias + * @throws InvalidArgumentException if the alias is for itself * * @api */ diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Definition.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Definition.php index 3fb5938d9c85e0d68b9370a4c9c3a9cbf83dbb9b..359553a0bf46979f6b6774dc1205f79f7ad7df6d 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Definition.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Definition.php @@ -241,7 +241,7 @@ public function addArgument($argument) * * @return Definition The current instance * - * @throws \OutOfBoundsException When the replaced argument does not exist + * @throws OutOfBoundsException When the replaced argument does not exist * * @api */ @@ -275,7 +275,7 @@ public function getArguments() * * @return mixed The argument value * - * @throws \OutOfBoundsException When the argument does not exist + * @throws OutOfBoundsException When the argument does not exist * * @api */ diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/DefinitionDecorator.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/DefinitionDecorator.php index 3ac561a4426d275df7bbc91ff8e3843320a7b4c7..ad3c3c1dd03aa922b66a6b79b714fc2e44ffc13e 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/DefinitionDecorator.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/DefinitionDecorator.php @@ -159,7 +159,7 @@ public function setPublic($boolean) * * @return mixed The argument value * - * @throws \OutOfBoundsException When the argument does not exist + * @throws OutOfBoundsException When the argument does not exist * * @api */ diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index 36ad24a159889e37e82b2b6bba1cbcb92ab9300e..eb099d2d91d81331e9be7d229d412ce3651b71fe 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -187,7 +187,7 @@ private function addServiceInclude($id, $definition) * * @return string * - * @throws \RuntimeException When the factory definition is incomplete + * @throws RuntimeException When the factory definition is incomplete * @throws ServiceCircularReferenceException When a circular reference is detected */ private function addServiceInlinedDefinitions($id, $definition) @@ -816,6 +816,8 @@ protected function getDefaultParameters() * @param integer $indent * * @return string + * + * @throws InvalidArgumentException */ private function exportParameters($parameters, $path = '', $indent = 12) { @@ -987,6 +989,8 @@ private function hasReference($id, array $arguments) * @param Boolean $interpolate * * @return string + * + * @throws RuntimeException */ private function dumpValue($value, $interpolate = true) { diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Extension/ConfigurationExtensionInterface.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Extension/ConfigurationExtensionInterface.php index 1d96d240f4bd1061aaf13a76fc24c015f1c73d86..6fcd9018dc761bb2e7a54af5e592b104bb4e26e9 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Extension/ConfigurationExtensionInterface.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Extension/ConfigurationExtensionInterface.php @@ -12,6 +12,7 @@ namespace Symfony\Component\DependencyInjection\Extension; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\Config\Definition\ConfigurationInterface; /** * ConfigurationExtensionInterface is the interface implemented by container extension classes. diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Extension/Extension.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Extension/Extension.php new file mode 100644 index 0000000000000000000000000000000000000000..e5c51a7b58922d2079cbe92cae935f145d4f854d --- /dev/null +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Extension/Extension.php @@ -0,0 +1,107 @@ +<?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\DependencyInjection\Extension; + +use Symfony\Component\DependencyInjection\Container; +use Symfony\Component\Config\Resource\FileResource; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\Config\Definition\Processor; +use Symfony\Component\Config\Definition\ConfigurationInterface; + +/** + * Provides useful features shared by many extensions. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +abstract class Extension implements ExtensionInterface, ConfigurationExtensionInterface +{ + /** + * Returns the base path for the XSD files. + * + * @return string The XSD base path + */ + public function getXsdValidationBasePath() + { + return false; + } + + /** + * Returns the namespace to be used for this extension (XML namespace). + * + * @return string The XML namespace + */ + public function getNamespace() + { + return 'http://example.org/schema/dic/'.$this->getAlias(); + } + + /** + * Returns the recommended alias to use in XML. + * + * This alias is also the mandatory prefix to use when using YAML. + * + * This convention is to remove the "Extension" postfix from the class + * name and then lowercase and underscore the result. So: + * + * AcmeHelloExtension + * + * becomes + * + * acme_hello + * + * This can be overridden in a sub-class to specify the alias manually. + * + * @return string The alias + * + * @throws \BadMethodCallException When the extension name does not follow conventions + */ + public function getAlias() + { + $className = get_class($this); + if (substr($className, -9) != 'Extension') { + throw new \BadMethodCallException('This extension does not follow the naming convention; you must overwrite the getAlias() method.'); + } + $classBaseName = substr(strrchr($className, '\\'), 1, -9); + + return Container::underscore($classBaseName); + } + + final protected function processConfiguration(ConfigurationInterface $configuration, array $configs) + { + $processor = new Processor(); + + return $processor->processConfiguration($configuration, $configs); + } + + /** + * {@inheritDoc} + */ + public function getConfiguration(array $config, ContainerBuilder $container) + { + $reflected = new \ReflectionClass($this); + $namespace = $reflected->getNamespaceName(); + + $class = $namespace . '\\Configuration'; + if (class_exists($class)) { + $r = new \ReflectionClass($class); + $container->addResource(new FileResource($r->getFileName())); + + if (!method_exists($class, '__construct')) { + $configuration = new $class(); + + return $configuration; + } + } + + return null; + } +} diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/LICENSE b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/LICENSE index cdffe7aebc04acd5c2b9c3042a0923d8e8f31998..88a57f8d8da49126c6f7d225d567ad216ace4d83 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/LICENSE +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2012 Fabien Potencier +Copyright (c) 2004-2013 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 diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php index 6f2c8eba1ada660c4acb3735ac381453111d70be..6296f5be49bb4e52c92614bb35604506edddd532 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php @@ -12,6 +12,7 @@ namespace Symfony\Component\DependencyInjection\Loader; use Symfony\Component\Config\Resource\FileResource; +use Symfony\Component\Config\Util\XmlUtils; use Symfony\Component\DependencyInjection\DefinitionDecorator; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\Alias; @@ -202,33 +203,17 @@ private function parseDefinition($id, $service, $file) * * @return SimpleXMLElement * - * @throws \InvalidArgumentException When loading of XML file returns error + * @throws InvalidArgumentException When loading of XML file returns error */ protected function parseFile($file) { - $internalErrors = libxml_use_internal_errors(true); - $disableEntities = libxml_disable_entity_loader(true); - libxml_clear_errors(); - - $dom = new \DOMDocument(); - $dom->validateOnParse = true; - if (!$dom->loadXML(file_get_contents($file), LIBXML_NONET | (defined('LIBXML_COMPACT') ? LIBXML_COMPACT : 0))) { - libxml_disable_entity_loader($disableEntities); - - throw new InvalidArgumentException(implode("\n", $this->getXmlErrors($internalErrors))); - } - $dom->normalizeDocument(); - - libxml_use_internal_errors($internalErrors); - libxml_disable_entity_loader($disableEntities); - - foreach ($dom->childNodes as $child) { - if ($child->nodeType === XML_DOCUMENT_TYPE_NODE) { - throw new InvalidArgumentException('Document types are not allowed.'); - } + try { + $dom = XmlUtils::loadFile($file, array($this, 'validateSchema')); + } catch (\InvalidArgumentException $e) { + throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e); } - $this->validate($dom, $file); + $this->validateExtensions($dom, $file); return simplexml_import_dom($dom, 'Symfony\\Component\\DependencyInjection\\SimpleXMLElement'); } @@ -285,28 +270,16 @@ private function processAnonymousServices(SimpleXMLElement $xml, $file) } } - /** - * Validates an XML document. - * - * @param \DOMDocument $dom - * @param string $file - */ - private function validate(\DOMDocument $dom, $file) - { - $this->validateSchema($dom, $file); - $this->validateExtensions($dom, $file); - } - /** * Validates a documents XML schema. * * @param \DOMDocument $dom - * @param string $file * - * @throws RuntimeException When extension references a non-existent XSD file - * @throws InvalidArgumentException When xml doesn't validate its xsd schema + * @return Boolean + * + * @throws RuntimeException When extension references a non-existent XSD file */ - private function validateSchema(\DOMDocument $dom, $file) + public function validateSchema(\DOMDocument $dom) { $schemaLocations = array('http://symfony.com/schema/dic/services' => str_replace('\\', '/', __DIR__.'/schema/dic/services/services-1.0.xsd')); @@ -360,18 +333,13 @@ private function validateSchema(\DOMDocument $dom, $file) EOF ; - $current = libxml_use_internal_errors(true); - libxml_clear_errors(); - $valid = @$dom->schemaValidateSource($source); foreach ($tmpfiles as $tmpfile) { @unlink($tmpfile); } - if (!$valid) { - throw new InvalidArgumentException(implode("\n", $this->getXmlErrors($current))); - } - libxml_use_internal_errors($current); + + return $valid; } /** @@ -403,33 +371,6 @@ private function validateExtensions(\DOMDocument $dom, $file) } } - /** - * Returns an array of XML errors. - * - * @param Boolean $internalErrors - * - * @return array - */ - private function getXmlErrors($internalErrors) - { - $errors = array(); - foreach (libxml_get_errors() as $error) { - $errors[] = sprintf('[%s %s] %s (in %s - line %d, column %d)', - LIBXML_ERR_WARNING == $error->level ? 'WARNING' : 'ERROR', - $error->code, - trim($error->message), - $error->file ? $error->file : 'n/a', - $error->line, - $error->column - ); - } - - libxml_clear_errors(); - libxml_use_internal_errors($internalErrors); - - return $errors; - } - /** * Loads from an extension. * @@ -472,50 +413,6 @@ private function loadFromExtensions(SimpleXMLElement $xml) */ public static function convertDomElementToArray(\DomElement $element) { - $empty = true; - $config = array(); - foreach ($element->attributes as $name => $node) { - $config[$name] = SimpleXMLElement::phpize($node->value); - $empty = false; - } - - $nodeValue = false; - foreach ($element->childNodes as $node) { - if ($node instanceof \DOMText) { - if (trim($node->nodeValue)) { - $nodeValue = trim($node->nodeValue); - $empty = false; - } - } elseif (!$node instanceof \DOMComment) { - if ($node instanceof \DOMElement && '_services' === $node->nodeName) { - $value = new Reference($node->getAttribute('id')); - } else { - $value = static::convertDomElementToArray($node); - } - - $key = $node->localName; - if (isset($config[$key])) { - if (!is_array($config[$key]) || !is_int(key($config[$key]))) { - $config[$key] = array($config[$key]); - } - $config[$key][] = $value; - } else { - $config[$key] = $value; - } - - $empty = false; - } - } - - if (false !== $nodeValue) { - $value = SimpleXMLElement::phpize($nodeValue); - if (count($config)) { - $config['value'] = $value; - } else { - $config = $value; - } - } - - return !$empty ? $config : null; + return XmlUtils::convertDomElementToArray($element); } } diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/SimpleXMLElement.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/SimpleXMLElement.php index d154602fd330dd0a6ebb91703a6437e0c741668d..cc5e31198715158cc8d4c79afb33a9a9906e1333 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/SimpleXMLElement.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/SimpleXMLElement.php @@ -11,6 +11,8 @@ namespace Symfony\Component\DependencyInjection; +use Symfony\Component\Config\Util\XmlUtils; + /** * SimpleXMLElement class. * @@ -101,27 +103,6 @@ public function getArgumentsAsPhp($name, $lowercase = true) */ public static function phpize($value) { - $value = (string) $value; - $lowercaseValue = strtolower($value); - - switch (true) { - case 'null' === $lowercaseValue: - return null; - case ctype_digit($value): - $raw = $value; - $cast = intval($value); - - return '0' == $value[0] ? octdec($value) : (((string) $raw == (string) $cast) ? $cast : $raw); - case 'true' === $lowercaseValue: - return true; - case 'false' === $lowercaseValue: - return false; - case is_numeric($value): - return '0x' == $value[0].$value[1] ? hexdec($value) : floatval($value); - case preg_match('/^(-|\+)?[0-9,]+(\.[0-9]+)?$/', $value): - return floatval(str_replace(',', '', $value)); - default: - return $value; - } + return XmlUtils::phpize($value); } } diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php index c16e9e01764638a5aacce3b3f12e20a74ca755ba..1d4ea079c3aec4ace4737cef436be91755e12bc1 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php @@ -20,13 +20,6 @@ */ class IntegrationTest extends \PHPUnit_Framework_TestCase { - protected function setUp() - { - if (!class_exists('Symfony\Component\Config\Resource\FileResource')) { - $this->markTestSkipped('The "Config" component is not available'); - } - } - /** * This tests that the following dependencies are correctly processed: * @@ -37,6 +30,7 @@ protected function setUp() public function testProcessRemovesAndInlinesRecursively() { $container = new ContainerBuilder(); + $container->setResourceTracking(false); $a = $container ->register('a', '\stdClass') @@ -66,6 +60,7 @@ public function testProcessRemovesAndInlinesRecursively() public function testProcessInlinesReferencesToAliases() { $container = new ContainerBuilder(); + $container->setResourceTracking(false); $a = $container ->register('a', '\stdClass') @@ -91,6 +86,7 @@ public function testProcessInlinesReferencesToAliases() public function testProcessInlinesWhenThereAreMultipleReferencesButFromTheSameDefinition() { $container = new ContainerBuilder(); + $container->setResourceTracking(false); $container ->register('a', '\stdClass') diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php index c9e6b07847dc0e5fabfdcd4d0ddc258693a6ad06..4a6f17d093c35d2ae21ec8e99e25b0cc39083c02 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php @@ -210,11 +210,8 @@ public function testAddAliases() */ public function testAddGetCompilerPass() { - if (!class_exists('Symfony\Component\Config\Resource\FileResource')) { - $this->markTestSkipped('The "Config" component is not available'); - } - $builder = new ContainerBuilder(); + $builder->setResourceTracking(false); $builderCompilerPasses = $builder->getCompiler()->getPassConfig()->getPasses(); $builder->addCompilerPass($this->getMock('Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface')); $this->assertEquals(sizeof($builderCompilerPasses) + 1, sizeof($builder->getCompiler()->getPassConfig()->getPasses())); @@ -335,16 +332,14 @@ public function testResolveServices() */ public function testMerge() { - if (!class_exists('Symfony\Component\Config\Resource\FileResource')) { - $this->markTestSkipped('The "Config" component is not available'); - } - $container = new ContainerBuilder(new ParameterBag(array('bar' => 'foo'))); + $container->setResourceTracking(false); $config = new ContainerBuilder(new ParameterBag(array('foo' => 'bar'))); $container->merge($config); $this->assertEquals(array('bar' => 'foo', 'foo' => 'bar'), $container->getParameterBag()->all(), '->merge() merges current parameters with the loaded ones'); $container = new ContainerBuilder(new ParameterBag(array('bar' => 'foo'))); + $container->setResourceTracking(false); $config = new ContainerBuilder(new ParameterBag(array('foo' => '%bar%'))); $container->merge($config); ////// FIXME @@ -352,6 +347,7 @@ public function testMerge() $this->assertEquals(array('bar' => 'foo', 'foo' => 'foo'), $container->getParameterBag()->all(), '->merge() evaluates the values of the parameters towards already defined ones'); $container = new ContainerBuilder(new ParameterBag(array('bar' => 'foo'))); + $container->setResourceTracking(false); $config = new ContainerBuilder(new ParameterBag(array('foo' => '%bar%', 'baz' => '%foo%'))); $container->merge($config); ////// FIXME @@ -359,6 +355,7 @@ public function testMerge() $this->assertEquals(array('bar' => 'foo', 'foo' => 'foo', 'baz' => 'foo'), $container->getParameterBag()->all(), '->merge() evaluates the values of the parameters towards already defined ones'); $container = new ContainerBuilder(); + $container->setResourceTracking(false); $container->register('foo', 'FooClass'); $container->register('bar', 'BarClass'); $config = new ContainerBuilder(); @@ -372,6 +369,7 @@ public function testMerge() $this->assertEquals('foo', (string) $aliases['alias_for_foo']); $container = new ContainerBuilder(); + $container->setResourceTracking(false); $container->register('foo', 'FooClass'); $config->setDefinition('foo', new Definition('BazClass')); $container->merge($config); @@ -384,11 +382,8 @@ public function testMerge() */ public function testMergeLogicException() { - if (!class_exists('Symfony\Component\Config\Resource\FileResource')) { - $this->markTestSkipped('The "Config" component is not available'); - } - $container = new ContainerBuilder(); + $container->setResourceTracking(false); $container->compile(); $container->merge(new ContainerBuilder()); } @@ -456,11 +451,8 @@ public function testResources() */ public function testExtension() { - if (!class_exists('Symfony\Component\Config\Resource\FileResource')) { - $this->markTestSkipped('The "Config" component is not available'); - } - $container = new ContainerBuilder(); + $container->setResourceTracking(false); $container->registerExtension($extension = new \ProjectExtension()); $this->assertTrue($container->getExtension('project') === $extension, '->registerExtension() registers an extension'); @@ -471,30 +463,24 @@ public function testExtension() public function testRegisteredButNotLoadedExtension() { - if (!class_exists('Symfony\Component\Config\Resource\FileResource')) { - $this->markTestSkipped('The "Config" component is not available'); - } - $extension = $this->getMock('Symfony\\Component\\DependencyInjection\\Extension\\ExtensionInterface'); $extension->expects($this->once())->method('getAlias')->will($this->returnValue('project')); $extension->expects($this->never())->method('load'); $container = new ContainerBuilder(); + $container->setResourceTracking(false); $container->registerExtension($extension); $container->compile(); } public function testRegisteredAndLoadedExtension() { - if (!class_exists('Symfony\Component\Config\Resource\FileResource')) { - $this->markTestSkipped('The "Config" component is not available'); - } - $extension = $this->getMock('Symfony\\Component\\DependencyInjection\\Extension\\ExtensionInterface'); $extension->expects($this->exactly(2))->method('getAlias')->will($this->returnValue('project')); $extension->expects($this->once())->method('load')->with(array(array('foo' => 'bar'))); $container = new ContainerBuilder(); + $container->setResourceTracking(false); $container->registerExtension($extension); $container->loadFromExtension('project', array('foo' => 'bar')); $container->compile(); @@ -502,13 +488,10 @@ public function testRegisteredAndLoadedExtension() public function testPrivateServiceUser() { - if (!class_exists('Symfony\Component\Config\Resource\FileResource')) { - $this->markTestSkipped('The "Config" component is not available'); - } - $fooDefinition = new Definition('BarClass'); $fooUserDefinition = new Definition('BarUserClass', array(new Reference('bar'))); $container = new ContainerBuilder(); + $container->setResourceTracking(false); $fooDefinition->setPublic(false); @@ -525,6 +508,18 @@ public function testPrivateServiceUser() * @expectedException BadMethodCallException */ public function testThrowsExceptionWhenSetServiceOnAFrozenContainer() + { + $container = new ContainerBuilder(); + $container->setResourceTracking(false); + $container->setDefinition('a', new Definition('stdClass')); + $container->compile(); + $container->set('a', new \stdClass()); + } + + /** + * @expectedException BadMethodCallException + */ + public function testThrowsExceptionWhenAddServiceOnAFrozenContainer() { if (!class_exists('Symfony\Component\Config\Resource\FileResource')) { $this->markTestSkipped('The "Config" component is not available'); @@ -535,19 +530,53 @@ public function testThrowsExceptionWhenSetServiceOnAFrozenContainer() $container->set('a', new \stdClass()); } - /** - * @expectedException BadMethodCallException - */ - public function testThrowsExceptionWhenSetDefinitionOnAFrozenContainer() + public function testNoExceptionWhenSetSyntheticServiceOnAFrozenContainer() { if (!class_exists('Symfony\Component\Config\Resource\FileResource')) { $this->markTestSkipped('The "Config" component is not available'); } $container = new ContainerBuilder(); + $def = new Definition('stdClass'); + $def->setSynthetic(true); + $container->setDefinition('a', $def); + $container->compile(); + $container->set('a', $a = new \stdClass()); + $this->assertEquals($a, $container->get('a')); + } + + /** + * @expectedException BadMethodCallException + */ + public function testThrowsExceptionWhenSetDefinitionOnAFrozenContainer() + { + $container = new ContainerBuilder(); + $container->setResourceTracking(false); $container->compile(); $container->setDefinition('a', new Definition()); } + + /** + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::getExtensionConfig + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::prependExtensionConfig + */ + public function testExtensionConfig() + { + $container = new ContainerBuilder(); + + $configs = $container->getExtensionConfig('foo'); + $this->assertEmpty($configs); + + $first = array('foo' => 'bar'); + $container->prependExtensionConfig('foo', $first); + $configs = $container->getExtensionConfig('foo'); + $this->assertEquals(array($first), $configs); + + $second = array('ding' => 'dong'); + $container->prependExtensionConfig('foo', $second); + $configs = $container->getExtensionConfig('foo'); + $this->assertEquals(array($second, $first), $configs); + } } class FooClass {} diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php index ec82cc1e803b0e707e13f16e21ecd325985d6eb8..3464a6af3c66eb8fa24e3f0d768e9fb6af277a7a 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php @@ -80,18 +80,24 @@ public function testCrossCheck($fixture, $type) public function crossCheckLoadersDumpers() { - return array( + $tests = array( array('services1.xml', 'xml'), array('services2.xml', 'xml'), array('services6.xml', 'xml'), array('services8.xml', 'xml'), array('services9.xml', 'xml'), - - array('services1.yml', 'yaml'), - array('services2.yml', 'yaml'), - array('services6.yml', 'yaml'), - array('services8.yml', 'yaml'), - array('services9.yml', 'yaml'), ); + + if (class_exists('Symfony\Component\Yaml\Yaml')) { + $tests = array_merge($tests, array( + array('services1.yml', 'yaml'), + array('services2.yml', 'yaml'), + array('services6.yml', 'yaml'), + array('services8.yml', 'yaml'), + array('services9.yml', 'yaml'), + )); + } + + return $tests; } } diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php index d3b93fdee8cd08483371fd44fd4635d407a1c569..245c9775b1376b4bc9d7a5fa007010a9ec2d42d2 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php @@ -18,13 +18,6 @@ class GraphvizDumperTest extends \PHPUnit_Framework_TestCase { protected static $fixturesPath; - protected function setUp() - { - if (!class_exists('Symfony\Component\Config\Loader\Loader')) { - $this->markTestSkipped('The "Config" component is not available'); - } - } - public static function setUpBeforeClass() { self::$fixturesPath = __DIR__.'/../Fixtures/'; diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php index 859ca5001339e562e3c2cae886ffc9349259b6d9..2697852c9360d23c76e46f1579fc5fe6e0923406 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php @@ -21,13 +21,6 @@ class PhpDumperTest extends \PHPUnit_Framework_TestCase { protected static $fixturesPath; - protected function setUp() - { - if (!class_exists('Symfony\Component\Config\Loader\Loader')) { - $this->markTestSkipped('The "Config" component is not available'); - } - } - public static function setUpBeforeClass() { self::$fixturesPath = realpath(__DIR__.'/../Fixtures/'); @@ -47,6 +40,7 @@ public function testDump() public function testDumpFrozenContainerWithNoParameter() { $container = new ContainerBuilder(); + $container->setResourceTracking(false); $container->register('foo', 'stdClass'); $container->compile(); @@ -76,6 +70,7 @@ public function testDumpOptimizationString() )); $container = new ContainerBuilder(); + $container->setResourceTracking(false); $container->setDefinition('test', $definition); $container->setParameter('empty_value', ''); $container->setParameter('some_string', '-'); diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php index b2cddb593de7e237e8657e1816d95d2d8a699737..9ec3438db26bb01c6a722820ce5694bba03a2f36 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php @@ -18,13 +18,6 @@ class XmlDumperTest extends \PHPUnit_Framework_TestCase { protected static $fixturesPath; - protected function setUp() - { - if (!class_exists('Symfony\Component\Config\Loader\Loader')) { - $this->markTestSkipped('The "Config" component is not available'); - } - } - public static function setUpBeforeClass() { self::$fixturesPath = realpath(__DIR__.'/../Fixtures/'); diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php index 47cc4bea1e0c2bbc1a3acd04add636743918d814..ca7aec054e48174ff6eecbc6b8b5cd8be628bfc3 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php @@ -20,8 +20,8 @@ class YamlDumperTest extends \PHPUnit_Framework_TestCase protected function setUp() { - if (!class_exists('Symfony\Component\Config\Loader\Loader')) { - $this->markTestSkipped('The "Config" component is not available'); + if (!class_exists('Symfony\Component\Yaml\Yaml')) { + $this->markTestSkipped('The "Yaml" component is not available'); } } diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php index b589ed95ac036aeac1361914420abd9c9155397c..40ffd63af9b5cbaa0c5bd6fad5ff1e835c430f92 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php @@ -98,6 +98,10 @@ public function testLoadParameters() public function testLoadImports() { + if (!class_exists('Symfony\Component\Yaml\Yaml')) { + $this->markTestSkipped('The "Yaml" component is not available'); + } + $container = new ContainerBuilder(); $resolver = new LoaderResolver(array( new IniFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')), diff --git a/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php index 85ba2ad2c99c1f360ef0cff70e3f1962772f7817..9448ed43e932dbf9923e5311115f78e543a0ee4d 100644 --- a/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php +++ b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php @@ -60,6 +60,8 @@ public function __construct(ContainerInterface $container) * @param integer $priority The higher this value, the earlier an event listener * will be triggered in the chain. * Defaults to 0. + * + * @throws \InvalidArgumentException */ public function addListenerService($eventName, $callback, $priority = 0) { diff --git a/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/GenericEvent.php b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/GenericEvent.php index 2f1dd64f56055ca134005c56c6728eb361c7304c..3a5efcfecc262c3d96efe28427615422c5dd13e2 100644 --- a/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/GenericEvent.php +++ b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/GenericEvent.php @@ -35,7 +35,7 @@ class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate protected $arguments; /** - * Encapsulate an event with $subject, $args, and $data. + * Encapsulate an event with $subject and $args. * * @param mixed $subject The subject of the event, usually an object. * @param array $arguments Arguments to store in the event. @@ -144,8 +144,6 @@ public function offsetGet($key) * * @param string $key Array key to set. * @param mixed $value Value. - * - * @return void */ public function offsetSet($key, $value) { @@ -156,8 +154,6 @@ public function offsetSet($key, $value) * ArrayAccess for unset argument. * * @param string $key Array key. - * - * @return void */ public function offsetUnset($key) { diff --git a/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/LICENSE b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/LICENSE index cdffe7aebc04acd5c2b9c3042a0923d8e8f31998..88a57f8d8da49126c6f7d225d567ad216ace4d83 100644 --- a/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/LICENSE +++ b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2012 Fabien Potencier +Copyright (c) 2004-2013 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 diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/BinaryFileResponse.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/BinaryFileResponse.php index 080a4408552e4535a5119c9c182a37dee017318a..a5c77f0ab744633bc05be5b1058f0bacab3aacf4 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/BinaryFileResponse.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/BinaryFileResponse.php @@ -65,6 +65,13 @@ public static function create($file = null, $status = 200, $headers = array(), $ * Sets the file to stream. * * @param SplFileInfo|string $file The file to stream + * @param string $contentDisposition + * @param Boolean $autoEtag + * @param Boolean $autoLastModified + * + * @return BinaryFileResponse + * + * @throws FileException */ public function setFile($file, $contentDisposition = null, $autoEtag = false, $autoLastModified = true) { @@ -127,6 +134,8 @@ public function setAutoEtag() * @param string $disposition ResponseHeaderBag::DISPOSITION_INLINE or ResponseHeaderBag::DISPOSITION_ATTACHMENT * @param string $filename Optionally use this filename instead of the real name of the file * @param string $filenameFallback A fallback filename, containing only ASCII characters. Defaults to an automatically encoded filename + * + * @return BinaryFileResponse */ public function setContentDisposition($disposition, $filename = '', $filenameFallback = '') { @@ -201,6 +210,8 @@ public function prepare(Request $request) $this->headers->set('Content-Range', sprintf('bytes %s-%s/%s', $start, $end, $this->file->getSize())); } } + + return $this; } /** diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Cookie.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Cookie.php index fe3a4cff42b69daa34768f2b5361f40b277d6c95..fdc33e3679e30942e73721151efdc216ee335e46 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Cookie.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Cookie.php @@ -39,6 +39,8 @@ class Cookie * @param Boolean $secure Whether the cookie should only be transmitted over a secure HTTPS connection from the client * @param Boolean $httpOnly Whether the cookie will be made accessible only through the HTTP protocol * + * @throws \InvalidArgumentException + * * @api */ public function __construct($name, $value = null, $expire = 0, $path = '/', $domain = null, $secure = false, $httpOnly = true) diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/File.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/File.php index d3d20f583a6fb8b7ac2706ffbb7d07ae42f1c01e..729d870cfc5feaed76317078703a6b39531b417f 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/File.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/File.php @@ -106,6 +106,20 @@ public function getExtension() * @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)) { @@ -117,14 +131,7 @@ public function move($directory, $name = null) $target = $directory.DIRECTORY_SEPARATOR.(null === $name ? $this->getBasename() : $this->getName($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 new File($target); + return new File($target, false); } /** diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php index a8247ab46f947e7a5570b455c6fc7b46c975128e..59ddc077be0abbe4ee23ed1de1068793a79bd17c 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php @@ -11,7 +11,6 @@ namespace Symfony\Component\HttpFoundation\File\MimeType; -use Symfony\Component\HttpFoundation\File\Exception\FileException; use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException; @@ -99,7 +98,9 @@ public function register(MimeTypeGuesserInterface $guesser) * * @return string The mime type or NULL, if none could be guessed * - * @throws FileException If the file does not exist + * @throws \LogicException + * @throws FileNotFoundException + * @throws AccessDeniedException */ public function guess($path) { diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/UploadedFile.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/UploadedFile.php index 4bf920ef0f3253f26d8b42fc4d97f082836bf9ac..63c5386a11b9ad231dadaafe0398d88462005bdf 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/UploadedFile.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/UploadedFile.php @@ -202,8 +202,21 @@ public function isValid() */ public function move($directory, $name = null) { - if ($this->isValid() && ($this->test || is_uploaded_file($this->getPathname()))) { - return parent::move($directory, $name); + 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())); diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/HeaderBag.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/HeaderBag.php index f26899d007ba5a0ec08ac2a12278267ced685051..f3895f464e4774e98c1c189195430975b40e4725 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/HeaderBag.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/HeaderBag.php @@ -223,7 +223,7 @@ public function remove($key) * @param string $key The parameter key * @param \DateTime $default The default value * - * @return null|\DateTime The filtered value + * @return null|\DateTime The parsed DateTime or the default value if the header does not exist * * @throws \RuntimeException When the HTTP header is not parseable * @@ -317,7 +317,7 @@ protected function parseCacheControl($header) $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; diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/JsonResponse.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/JsonResponse.php index 29b4cc7b59a18a9c27e7e165301184ab21b4f262..c131575f016ff84e1b9e6a6d03f88c591c08ba27 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/JsonResponse.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/JsonResponse.php @@ -49,6 +49,8 @@ public static function create($data = array(), $status = 200, $headers = array() * @param string $callback * * @return JsonResponse + * + * @throws \InvalidArgumentException */ public function setCallback($callback = null) { diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/LICENSE b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/LICENSE index cdffe7aebc04acd5c2b9c3042a0923d8e8f31998..88a57f8d8da49126c6f7d225d567ad216ace4d83 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/LICENSE +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2012 Fabien Potencier +Copyright (c) 2004-2013 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 diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ParameterBag.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ParameterBag.php index 0273d933c044f904cff6c5fc2240152013d69338..c8720cdc12e2b3c9e79da36f3db907dfaaf03007 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ParameterBag.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ParameterBag.php @@ -96,6 +96,8 @@ public function add(array $parameters = array()) * * @return mixed * + * @throws \InvalidArgumentException + * * @api */ public function get($path, $default = null, $deep = false) diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RedirectResponse.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RedirectResponse.php index a9d98e6b3a9097f824a65025ad031833f0dbff39..54f57216b03a41f4120f913902fa0c044d4ccd18 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RedirectResponse.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RedirectResponse.php @@ -29,6 +29,8 @@ class RedirectResponse extends Response * @param integer $status The status code (302 by default) * @param array $headers The headers (Location is always set to the given url) * + * @throws \InvalidArgumentException + * * @see http://tools.ietf.org/html/rfc2616#section-10.3 * * @api @@ -72,6 +74,8 @@ public function getTargetUrl() * @param string $url The URL to redirect to * * @return RedirectResponse The current response. + * + * @throws \InvalidArgumentException */ public function setTargetUrl($url) { diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Request.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Request.php index a0f02a49a3fd1727c4a14bb48b4c1c9a94517817..3b5d1448a081d0e8b592eda965e238a29b0b1173 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Request.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Request.php @@ -30,10 +30,10 @@ */ class Request { - const HEADER_CLIENT_IP = 'client_ip'; - const HEADER_CLIENT_HOST = 'client_host'; + const HEADER_CLIENT_IP = 'client_ip'; + const HEADER_CLIENT_HOST = 'client_host'; const HEADER_CLIENT_PROTO = 'client_proto'; - const HEADER_CLIENT_PORT = 'client_port'; + const HEADER_CLIENT_PORT = 'client_port'; protected static $trustProxy = false; @@ -466,6 +466,8 @@ public function overrideGlobals() */ public static function trustProxyData() { + trigger_error('trustProxyData() is deprecated since version 2.0 and will be removed in 2.3. Use setTrustedProxies() instead.', E_USER_DEPRECATED); + self::$trustProxy = true; } @@ -498,6 +500,8 @@ public static function setTrustedProxies(array $proxies) * * @param string $key The header key * @param string $value The header name + * + * @throws \InvalidArgumentException */ public static function setTrustedHeaderName($key, $value) { @@ -989,6 +993,8 @@ public function isSecure() * * @return string * + * @throws \UnexpectedValueException when the host name is invalid + * * @api */ public function getHost() @@ -996,20 +1002,24 @@ public function getHost() if (self::$trustProxy && self::$trustedHeaders[self::HEADER_CLIENT_HOST] && $host = $this->headers->get(self::$trustedHeaders[self::HEADER_CLIENT_HOST])) { $elements = explode(',', $host); - $host = trim($elements[count($elements) - 1]); - } else { - if (!$host = $this->headers->get('HOST')) { - if (!$host = $this->server->get('SERVER_NAME')) { - $host = $this->server->get('SERVER_ADDR', ''); - } + $host = $elements[count($elements) - 1]; + } elseif (!$host = $this->headers->get('HOST')) { + if (!$host = $this->server->get('SERVER_NAME')) { + $host = $this->server->get('SERVER_ADDR', ''); } } - // Remove port number from host - $host = preg_replace('/:\d+$/', '', $host); - + // trim and remove port number from host // host is lowercase as per RFC 952/2181 - return trim(strtolower($host)); + $host = strtolower(preg_replace('/:\d+$/', '', trim($host))); + + // as the host can come from the user (HTTP_HOST and depending on the configuration, SERVER_NAME too can come from the user) + // check that it does not contain forbidden characters (see RFC 952 and RFC 2181) + if ($host && !preg_match('/^\[?(?:[a-zA-Z0-9-:\]_]+\.?)+$/', $host)) { + throw new \UnexpectedValueException('Invalid Host'); + } + + return $host; } /** @@ -1250,6 +1260,8 @@ public function isMethodSafe() * @param Boolean $asResource If true, a resource will be returned * * @return string|resource The request body content or a resource to read the body stream. + * + * @throws \LogicException */ public function getContent($asResource = false) { @@ -1414,6 +1426,8 @@ public function isXmlHttpRequest() */ public function splitHttpAcceptHeader($header) { + trigger_error('splitHttpAcceptHeader() is deprecated since version 2.2 and will be removed in 2.3.', E_USER_DEPRECATED); + $headers = array(); foreach (AcceptHeader::fromString($header)->all() as $item) { $key = $item->getValue(); diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RequestMatcher.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RequestMatcher.php index 536cc7b075f5bcd1aa9cd24e777ed9ab0a0cc39f..49b92f0e2cbb7064741237e761d170575cc460f4 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RequestMatcher.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RequestMatcher.php @@ -150,4 +150,3 @@ public function matches(Request $request) return true; } } - diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Response.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Response.php index ac56f9b2df56e29d4537e5941545829e13cfa04c..0c4e0e937201fb3f8a0f5493c7dbd32c41fd869c 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Response.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Response.php @@ -131,6 +131,8 @@ class Response * @param integer $status The response status code * @param array $headers An array of response headers * + * @throws \InvalidArgumentException When the HTTP status code is not valid + * * @api */ public function __construct($content = '', $status = 200, $headers = array()) @@ -245,6 +247,12 @@ public function prepare(Request $request) $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; } @@ -330,6 +338,8 @@ public function send() * * @return Response * + * @throws \UnexpectedValueException + * * @api */ public function setContent($content) @@ -425,7 +435,7 @@ public function setStatusCode($code, $text = null) /** * Retrieves the status code for the current web response. * - * @return string Status code + * @return integer Status code * * @api */ @@ -493,7 +503,7 @@ public function isCacheable() * * Fresh responses may be served from cache without any interaction with the * origin. A response is considered fresh when it includes a Cache-Control/max-age - * indicator or Expiration header and the calculated age is less than the freshness lifetime. + * indicator or Expires header and the calculated age is less than the freshness lifetime. * * @return Boolean true if the response is fresh, false otherwise * @@ -606,8 +616,8 @@ public function setDate(\DateTime $date) */ public function getAge() { - if ($age = $this->headers->get('Age')) { - return $age; + if (null !== $age = $this->headers->get('Age')) { + return (int) $age; } return max(time() - $this->getDate()->format('U'), 0); @@ -632,21 +642,26 @@ public function expire() /** * Returns the value of the Expires header as a DateTime instance. * - * @return \DateTime A DateTime instance + * @return \DateTime|null A DateTime instance or null if the header does not exist * * @api */ public function getExpires() { - return $this->headers->getDate('Expires'); + try { + return $this->headers->getDate('Expires'); + } catch (\RuntimeException $e) { + // according to RFC 2616 invalid date formats (e.g. "0" and "-1") must be treated as in the past + return \DateTime::createFromFormat(DATE_RFC2822, 'Sat, 01 Jan 00 00:00:00 +0000'); + } } /** * Sets the Expires HTTP header with a DateTime instance. * - * If passed a null value, it removes the header. + * Passing null as value will remove the header. * - * @param \DateTime $date A \DateTime instance + * @param \DateTime|null $date A \DateTime instance or null to remove the header * * @return Response * @@ -666,7 +681,7 @@ public function setExpires(\DateTime $date = null) } /** - * Sets the number of seconds after the time specified in the response's Date + * Returns the number of seconds after the time specified in the response's Date * header when the the response should no longer be considered fresh. * * First, it checks for a s-maxage directive, then a max-age directive, and then it falls @@ -678,12 +693,12 @@ public function setExpires(\DateTime $date = null) */ public function getMaxAge() { - if ($age = $this->headers->getCacheControlDirective('s-maxage')) { - return $age; + if ($this->headers->hasCacheControlDirective('s-maxage')) { + return (int) $this->headers->getCacheControlDirective('s-maxage'); } - if ($age = $this->headers->getCacheControlDirective('max-age')) { - return $age; + if ($this->headers->hasCacheControlDirective('max-age')) { + return (int) $this->headers->getCacheControlDirective('max-age'); } if (null !== $this->getExpires()) { @@ -744,7 +759,7 @@ public function setSharedMaxAge($value) */ public function getTtl() { - if ($maxAge = $this->getMaxAge()) { + if (null !== $maxAge = $this->getMaxAge()) { return $maxAge - $this->getAge(); } @@ -790,7 +805,9 @@ public function setClientTtl($seconds) /** * Returns the Last-Modified HTTP header as a DateTime instance. * - * @return \DateTime A DateTime instance + * @return \DateTime|null A DateTime instance or null if the header does not exist + * + * @throws \RuntimeException When the HTTP header is not parseable * * @api */ @@ -802,9 +819,9 @@ public function getLastModified() /** * Sets the Last-Modified HTTP header with a DateTime instance. * - * If passed a null value, it removes the header. + * Passing null as value will remove the header. * - * @param \DateTime $date A \DateTime instance + * @param \DateTime|null $date A \DateTime instance or null to remove the header * * @return Response * @@ -826,7 +843,7 @@ public function setLastModified(\DateTime $date = null) /** * Returns the literal value of the ETag HTTP header. * - * @return string The ETag HTTP header + * @return string|null The ETag HTTP header or null if it does not exist * * @api */ @@ -838,8 +855,8 @@ public function getEtag() /** * Sets the ETag value. * - * @param string $etag The ETag unique identifier - * @param Boolean $weak Whether you want a weak ETag or not + * @param string|null $etag The ETag unique identifier or null to remove the header + * @param Boolean $weak Whether you want a weak ETag or not * * @return Response * @@ -869,6 +886,8 @@ public function setEtag($etag = null, $weak = false) * * @return Response * + * @throws \InvalidArgumentException + * * @api */ public function setCache(array $options) @@ -946,7 +965,7 @@ public function setNotModified() */ public function hasVary() { - return (Boolean) $this->headers->get('Vary'); + return null !== $this->headers->get('Vary'); } /** diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Session.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Session.php index ee987c67e583eeb0d12a513fa03491d1ac6ebf6e..b0b3ff3d0bff0c7cdaf3c7172c6f51e0af91f9ae 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Session.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Session.php @@ -259,6 +259,8 @@ public function getFlashBag() */ public function getFlashes() { + trigger_error('getFlashes() is deprecated since version 2.1 and will be removed in 2.3. Use the FlashBag instead.', E_USER_DEPRECATED); + $all = $this->getBag($this->flashName)->all(); $return = array(); @@ -282,6 +284,8 @@ public function getFlashes() */ public function setFlashes($values) { + trigger_error('setFlashes() is deprecated since version 2.1 and will be removed in 2.3. Use the FlashBag instead.', E_USER_DEPRECATED); + foreach ($values as $name => $value) { $this->getBag($this->flashName)->set($name, $value); } @@ -297,6 +301,8 @@ public function setFlashes($values) */ public function getFlash($name, $default = null) { + trigger_error('getFlash() is deprecated since version 2.1 and will be removed in 2.3. Use the FlashBag instead.', E_USER_DEPRECATED); + $return = $this->getBag($this->flashName)->get($name); return empty($return) ? $default : reset($return); @@ -310,6 +316,8 @@ public function getFlash($name, $default = null) */ public function setFlash($name, $value) { + trigger_error('setFlash() is deprecated since version 2.1 and will be removed in 2.3. Use the FlashBag instead.', E_USER_DEPRECATED); + $this->getBag($this->flashName)->set($name, $value); } @@ -322,6 +330,8 @@ public function setFlash($name, $value) */ public function hasFlash($name) { + trigger_error('hasFlash() is deprecated since version 2.1 and will be removed in 2.3. Use the FlashBag instead.', E_USER_DEPRECATED); + return $this->getBag($this->flashName)->has($name); } @@ -332,6 +342,8 @@ public function hasFlash($name) */ public function removeFlash($name) { + trigger_error('removeFlash() is deprecated since version 2.1 and will be removed in 2.3. Use the FlashBag instead.', E_USER_DEPRECATED); + $this->getBag($this->flashName)->get($name); } @@ -342,6 +354,8 @@ public function removeFlash($name) */ public function clearFlashes() { + trigger_error('clearFlashes() is deprecated since version 2.1 and will be removed in 2.3. Use the FlashBag instead.', E_USER_DEPRECATED); + return $this->getBag($this->flashName)->clear(); } } diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php index 4a262aade3449eb45ebc0a5e6c3b9d2dfe8bb589..69ebae9542cc32233f291a76fdeb1093cd384fe0 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php @@ -43,13 +43,18 @@ class MongoDbSessionHandler implements \SessionHandlerInterface * * data_field: The field name for storing the session data [default: data] * * time_field: The field name for storing the timestamp [default: time] * - * @param \Mongo $mongo A "Mongo" instance - * @param array $options An associative array of field options + * @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 $mongo, array $options) + 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'); } @@ -150,7 +155,7 @@ public function read($sessionId) private function getCollection() { if (null === $this->collection) { - $this->collection = $this->mongo->selectDB($this->options['database'])->selectCollection($this->options['collection']); + $this->collection = $this->mongo->selectCollection($this->options['database'], $this->options['collection']); } return $this->collection; diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php index b18d071d9540f0245ceaa3a3fd5f28cfbb949429..a1fcf539f8fdab9a21b25a2d3b98a63855cf7e34 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php @@ -159,6 +159,9 @@ public function setName($name) */ 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; } diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php index 80aa44b06bc4ec572abcb0c8b997d470d170aafd..280630914a6ce5a1ce4bc297477c64fabceb5f33 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php @@ -97,6 +97,10 @@ public function regenerate($destroy = false, $lifetime = null) */ 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 diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php index 0d4cb8b6a999bd1a4251753330469f697f064a75..1f68f2496133c8d495dad46984bdf0f6e71735a4 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php @@ -99,6 +99,8 @@ public function getId() * Sets the session ID. * * @param string $id + * + * @throws \LogicException */ public function setId($id) { @@ -123,6 +125,8 @@ public function getName() * Sets the session name. * * @param string $name + * + * @throws \LogicException */ public function setName($name) { diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php index 26a741829b3b890b7693816fd254b72e49f9753a..711eaa29a3125f459697d72b030ab5e8cfe18aa6 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php @@ -110,6 +110,9 @@ public function regenerate($destroy = false, $lifetime = null); * 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. */ public function save(); diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/StreamedResponse.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/StreamedResponse.php index 53bdbe64805e6d844b80645e5f0cc76951a13fe6..ae579beaa954b9cbd1ee7c96b04373a98382994f 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/StreamedResponse.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/StreamedResponse.php @@ -62,6 +62,8 @@ public static function create($callback = null, $status = 200, $headers = array( * Sets the PHP callback associated with this Response. * * @param mixed $callback A valid PHP callback + * + * @throws \LogicException */ public function setCallback($callback) { diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php index ae12aa0476f1840bf6faa65d99fa3b9f8a71ecc2..94a075ac46124d501ea00940e9c260b2825f513a 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php @@ -102,7 +102,6 @@ public function testGetClientOriginalExtension() $this->assertEquals('gif', $file->getClientOriginalExtension()); } - /** * @expectedException Symfony\Component\HttpFoundation\File\Exception\FileException */ diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php index 20d3603038cad02c3655e450cb94d51d653aea9c..b1bfefbf87b76c56a1482d7fbec4270427d754f1 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php @@ -168,6 +168,13 @@ public function testCacheControlDirectiveParsing() $this->assertEquals('max-age=10, public, s-maxage=100', $bag->get('cache-control')); } + public function testCacheControlDirectiveParsingQuotedZero() + { + $bag = new HeaderBag(array('cache-control' => 'max-age="0"')); + $this->assertTrue($bag->hasCacheControlDirective('max-age')); + $this->assertEquals(0, $bag->getCacheControlDirective('max-age')); + } + public function testCacheControlDirectiveOverrideWithReplace() { $bag = new HeaderBag(array('cache-control' => 'private, max-age=100')); diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/RequestTest.php index cb572082556612b0a09c6f47de9a68fafb931a9d..a178b2fd8d15d7bac353a9848c80689101d4e190 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/RequestTest.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/RequestTest.php @@ -17,6 +17,15 @@ class RequestTest extends \PHPUnit_Framework_TestCase { + public function deprecationErrorHandler($errorNumber, $message, $file, $line, $context) + { + if ($errorNumber & E_USER_DEPRECATED) { + return true; + } + + return \PHPUnit_Util_ErrorHandler::handleError($errorNumber, $message, $file, $line); + } + /** * @covers Symfony\Component\HttpFoundation\Request::__construct */ @@ -609,9 +618,6 @@ public function testGetQueryStringReturnsNull() $this->assertNull($request->getQueryString(), '->getQueryString() returns null for empty query string'); } - /** - * @covers Symfony\Component\HttpFoundation\Request::getHost - */ public function testGetHost() { $request = new Request(); @@ -635,6 +641,16 @@ public function testGetHost() $this->stopTrustingProxyData(); } + /** + * @expectedException RuntimeException + */ + public function testGetHostWithFakeHttpHostValue() + { + $request = new Request(); + $request->initialize(array(), array(), array(), array(), array(), array('HTTP_HOST' => 'www.host.com?query=string')); + $request->getHost(); + } + /** * @covers Symfony\Component\HttpFoundation\Request::setMethod * @covers Symfony\Component\HttpFoundation\Request::getMethod @@ -706,7 +722,9 @@ public function testGetClientIp($expected, $proxy, $remoteAddr, $httpForwardedFo $request->initialize(array(), array(), array(), array(), array(), $server); if ($proxy) { + set_error_handler(array($this, "deprecationErrorHandler")); $this->startTrustingProxyData(); + restore_error_handler(); } $this->assertEquals($expected, $request->getClientIp($proxy)); @@ -823,6 +841,8 @@ public function testCreateFromGlobals($method) public function testOverrideGlobals() { + set_error_handler(array($this, "deprecationErrorHandler")); + $request = new Request(); $request->initialize(array('foo' => 'bar')); @@ -853,6 +873,8 @@ public function testOverrideGlobals() // restore initial $_SERVER array $_SERVER = $server; + + restore_error_handler(); } public function testGetScriptName() @@ -1100,7 +1122,9 @@ public function testSplitHttpAcceptHeader($acceptHeader, $expected) { $request = new Request(); + set_error_handler(array($this, "deprecationErrorHandler")); $this->assertEquals($expected, $request->splitHttpAcceptHeader($acceptHeader)); + restore_error_handler(); } public function splitHttpAcceptHeaderData() @@ -1268,11 +1292,13 @@ public function testTrustedProxies() $this->assertFalse($request->isSecure()); // trusted proxy via deprecated trustProxyData() + set_error_handler(array($this, "deprecationErrorHandler")); Request::trustProxyData(); $this->assertEquals('2.2.2.2', $request->getClientIp()); $this->assertEquals('real.example.com', $request->getHost()); $this->assertEquals(443, $request->getPort()); $this->assertTrue($request->isSecure()); + restore_error_handler(); // disabling proxy trusting Request::setTrustedProxies(array()); diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/ResponseTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/ResponseTest.php index c14dc4b83d51b3852d35cf4f16668fc153c6af32..6ca569c3eae47cd889ad23eacc7e15279bbae188 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/ResponseTest.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/ResponseTest.php @@ -164,6 +164,11 @@ public function testGetMaxAge() $response->headers->set('Expires', $this->createDateTimeOneHourLater()->format(DATE_RFC2822)); $this->assertEquals(3600, $response->getMaxAge(), '->getMaxAge() falls back to Expires when no max-age or s-maxage directive present'); + $response = new Response(); + $response->headers->set('Cache-Control', 'must-revalidate'); + $response->headers->set('Expires', -1); + $this->assertEquals('Sat, 01 Jan 00 00:00:00 +0000', $response->getExpires()->format(DATE_RFC822)); + $response = new Response(); $this->assertNull($response->getMaxAge(), '->getMaxAge() returns null if no freshness information available'); } @@ -214,6 +219,11 @@ public function testExpire() $response = new Response(); $response->expire(); $this->assertFalse($response->headers->has('Age'), '->expire() does nothing when the response does not include freshness information'); + + $response = new Response(); + $response->headers->set('Expires', -1); + $response->expire(); + $this->assertNull($response->headers->get('Age'), '->expire() does not set the Age when the response is expired'); } public function testGetTtl() @@ -227,7 +237,12 @@ public function testGetTtl() $response = new Response(); $response->headers->set('Expires', $this->createDateTimeOneHourAgo()->format(DATE_RFC2822)); - $this->assertLessThan(0, $response->getTtl(), '->getTtl() returns negative values when Expires is in part'); + $this->assertLessThan(0, $response->getTtl(), '->getTtl() returns negative values when Expires is in past'); + + $response = new Response(); + $response->headers->set('Expires', $response->getDate()->format(DATE_RFC2822)); + $response->headers->set('Age', 0); + $this->assertSame(0, $response->getTtl(), '->getTtl() correctly handles zero'); $response = new Response(); $response->headers->set('Cache-Control', 'max-age=60'); @@ -351,6 +366,23 @@ public function testPrepareRemovesContentForHeadRequests() $this->assertEquals('', $response->getContent()); } + public function testPrepareSetsPragmaOnHttp10Only() + { + $request = Request::create('/', 'GET'); + $request->server->set('SERVER_PROTOCOL', 'HTTP/1.0'); + + $response = new Response('foo'); + $response->prepare($request); + $this->assertEquals('no-cache', $response->headers->get('pragma')); + $this->assertEquals('-1', $response->headers->get('expires')); + + $request->server->set('SERVER_PROTOCOL', 'HTTP/1.1'); + $response = new Response('foo'); + $response->prepare($request); + $this->assertFalse($response->headers->has('pragma')); + $this->assertFalse($response->headers->has('expires')); + } + public function testSetCache() { $response = new Response(); diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php index 2568b3c7f356b70bc58355e9e7c1232bac22bbbd..2c5b70ec0fd9f8a66745319ed282ed5891c25165 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php @@ -47,6 +47,15 @@ protected function tearDown() $this->session = null; } + public function deprecationErrorHandler($errorNumber, $message, $file, $line, $context) + { + if ($errorNumber & E_USER_DEPRECATED) { + return true; + } + + return \PHPUnit_Util_ErrorHandler::handleError($errorNumber, $message, $file, $line); + } + public function testStart() { $this->assertEquals('', $this->session->getId()); @@ -174,6 +183,7 @@ public function testMigrateDestroy() public function testSave() { + $this->session->start(); $this->session->save(); } @@ -193,6 +203,8 @@ public function testGetFlashBag() public function testGetSetFlashes() { + set_error_handler(array($this, "deprecationErrorHandler")); + $array = array('notice' => 'hello', 'error' => 'none'); $this->assertEquals(array(), $this->session->getFlashes()); $this->session->setFlashes($array); @@ -203,10 +215,14 @@ public function testGetSetFlashes() // test that BC works by only retrieving the first added. $this->session->getFlashBag()->add('notice', 'foo2'); $this->assertEquals(array('notice' => 'foo'), $this->session->getFlashes()); + + restore_error_handler(); } public function testGetFlashesWithArray() { + set_error_handler(array($this, "deprecationErrorHandler")); + $array = array('notice' => 'hello', 'error' => 'none'); $this->assertEquals(array(), $this->session->getFlashes()); $this->session->setFlash('foo', $array); @@ -218,10 +234,14 @@ public function testGetFlashesWithArray() $this->session->setFlash('foo', $array); $this->assertEquals(array('foo' => 'hello'), $this->session->getFlashes()); $this->assertEquals(array(), $this->session->getFlashes()); + + restore_error_handler(); } public function testGetSetFlash() { + set_error_handler(array($this, "deprecationErrorHandler")); + $this->assertNull($this->session->getFlash('notice')); $this->assertEquals('default', $this->session->getFlash('notice', 'default')); $this->session->getFlashBag()->add('notice', 'foo'); @@ -230,27 +250,39 @@ public function testGetSetFlash() // test that BC works by only retrieving the first added. $this->assertEquals('foo', $this->session->getFlash('notice')); $this->assertNull($this->session->getFlash('notice')); + + restore_error_handler(); } public function testHasFlash() { + set_error_handler(array($this, "deprecationErrorHandler")); + $this->assertFalse($this->session->hasFlash('notice')); $this->session->setFlash('notice', 'foo'); $this->assertTrue($this->session->hasFlash('notice')); + + restore_error_handler(); } public function testRemoveFlash() { + set_error_handler(array($this, "deprecationErrorHandler")); + $this->session->setFlash('notice', 'foo'); $this->session->setFlash('error', 'bar'); $this->assertTrue($this->session->hasFlash('notice')); $this->session->removeFlash('error'); $this->assertTrue($this->session->hasFlash('notice')); $this->assertFalse($this->session->hasFlash('error')); + + restore_error_handler(); } public function testClearFlashes() { + set_error_handler(array($this, "deprecationErrorHandler")); + $this->assertFalse($this->session->hasFlash('notice')); $this->assertFalse($this->session->hasFlash('error')); $this->session->setFlash('notice', 'foo'); @@ -260,6 +292,8 @@ public function testClearFlashes() $this->session->clearFlashes(); $this->assertFalse($this->session->hasFlash('notice')); $this->assertFalse($this->session->hasFlash('error')); + + restore_error_handler(); } /** diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php index 409296ef1d49fa59dc6d11abdd2efcbe8cd3cfd2..1cfd1175cbe188bbd52f6c2c90ee412dca6b23d8 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php @@ -27,11 +27,13 @@ class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase protected function setUp() { - if (!class_exists('\Mongo')) { - $this->markTestSkipped('MongoDbSessionHandler requires the mongo extension.'); + if (!extension_loaded('mongo')) { + $this->markTestSkipped('MongoDbSessionHandler requires the PHP "mongo" extension.'); } - $this->mongo = $this->getMockBuilder('Mongo') + $mongoClass = (version_compare(phpversion('mongo'), '1.3.0', '<')) ? 'Mongo' : 'MongoClient'; + + $this->mongo = $this->getMockBuilder($mongoClass) ->disableOriginalConstructor() ->getMock(); @@ -46,6 +48,22 @@ protected function setUp() $this->storage = new MongoDbSessionHandler($this->mongo, $this->options); } + /** + * @expectedException InvalidArgumentException + */ + public function testConstructorShouldThrowExceptionForInvalidMongo() + { + new MongoDbSessionHandler(new \stdClass(), $this->options); + } + + /** + * @expectedException InvalidArgumentException + */ + public function testConstructorShouldThrowExceptionForMissingOptions() + { + new MongoDbSessionHandler($this->mongo, array()); + } + public function testOpenMethodAlwaysReturnTrue() { $this->assertTrue($this->storage->open('test', 'test'), 'The "open" method should always return true'); @@ -58,22 +76,13 @@ public function testCloseMethodAlwaysReturnTrue() public function testWrite() { - $database = $this->getMockBuilder('MongoDB') - ->disableOriginalConstructor() - ->getMock(); - $collection = $this->getMockBuilder('MongoCollection') ->disableOriginalConstructor() ->getMock(); $this->mongo->expects($this->once()) - ->method('selectDB') - ->with($this->options['database']) - ->will($this->returnValue($database)); - - $database->expects($this->once()) ->method('selectCollection') - ->with($this->options['collection']) + ->with($this->options['database'], $this->options['collection']) ->will($this->returnValue($collection)); $that = $this; @@ -96,22 +105,13 @@ public function testWrite() public function testReplaceSessionData() { - $database = $this->getMockBuilder('MongoDB') - ->disableOriginalConstructor() - ->getMock(); - $collection = $this->getMockBuilder('MongoCollection') ->disableOriginalConstructor() ->getMock(); $this->mongo->expects($this->once()) - ->method('selectDB') - ->with($this->options['database']) - ->will($this->returnValue($database)); - - $database->expects($this->once()) ->method('selectCollection') - ->with($this->options['collection']) + ->with($this->options['database'], $this->options['collection']) ->will($this->returnValue($collection)); $data = array(); @@ -130,22 +130,13 @@ public function testReplaceSessionData() public function testDestroy() { - $database = $this->getMockBuilder('MongoDB') - ->disableOriginalConstructor() - ->getMock(); - $collection = $this->getMockBuilder('MongoCollection') ->disableOriginalConstructor() ->getMock(); $this->mongo->expects($this->once()) - ->method('selectDB') - ->with($this->options['database']) - ->will($this->returnValue($database)); - - $database->expects($this->once()) ->method('selectCollection') - ->with($this->options['collection']) + ->with($this->options['database'], $this->options['collection']) ->will($this->returnValue($collection)); $collection->expects($this->once()) @@ -157,29 +148,20 @@ public function testDestroy() public function testGc() { - $database = $this->getMockBuilder('MongoDB') - ->disableOriginalConstructor() - ->getMock(); - $collection = $this->getMockBuilder('MongoCollection') ->disableOriginalConstructor() ->getMock(); $this->mongo->expects($this->once()) - ->method('selectDB') - ->with($this->options['database']) - ->will($this->returnValue($database)); - - $database->expects($this->once()) ->method('selectCollection') - ->with($this->options['collection']) + ->with($this->options['database'], $this->options['collection']) ->will($this->returnValue($collection)); $that = $this; $collection->expects($this->once()) ->method('remove') - ->will($this->returnCallback(function($criteria) use($that) { + ->will($this->returnCallback(function($criteria) use ($that) { $that->assertInstanceOf('MongoDate', $criteria[$that->options['time_field']]['$lt']); $that->assertGreaterThanOrEqual(time() - -1, $criteria[$that->options['time_field']]['$lt']->sec); })); diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php index 9f58f2d583f0f43331b8c9674ff05ee164444532..de2c4939f092d93bb97e90e2e33dfaf683841b89 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php @@ -54,6 +54,7 @@ public function test__ConstructSavePath($savePath, $expectedSavePath, $path) public function savePathDataProvider() { $base = sys_get_temp_dir(); + return array( array("$base/foo", "$base/foo", "$base/foo"), array("5;$base/foo", "5;$base/foo", "$base/foo"), diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php index c9b2a7480c6752ac561f9ce006d8e2a91535d3f9..2a6f6bb7e8fe56019f7e5fae1bd0f65d82a98530 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php @@ -95,4 +95,12 @@ public function testGetId() $this->storage->start(); $this->assertNotEquals('', $this->storage->getId()); } + + /** + * @expectedException RuntimeException + */ + public function testUnstartedSave() + { + $this->storage->save(); + } } diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockFileSessionStorageTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockFileSessionStorageTest.php index f18089d92a822b9721c2ad1f54fd11f2a6c125d4..d42c62a25ca07ad3c62ee7bf567a06884e73bfe0 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockFileSessionStorageTest.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockFileSessionStorageTest.php @@ -106,6 +106,15 @@ public function testMultipleInstances() $this->assertEquals('bar', $storage2->getBag('attributes')->get('foo'), 'values persist between instances'); } + /** + * @expectedException RuntimeException + */ + public function testSaveWithoutStart() + { + $storage1 = $this->getStorage(); + $storage1->save(); + } + private function getStorage() { $storage = new MockFileSessionStorage($this->sessionDir); diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/.gitignore b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/.gitignore index 44de97a36a6dff061b100cb131df52b07aeabde8..38c15605edbfd823e61afbdf31e7152fcd2b5f6f 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/.gitignore +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/.gitignore @@ -1,4 +1,5 @@ vendor/ composer.lock phpunit.xml - +Tests/ProjectContainer.php +Tests/classes.map \ No newline at end of file diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Bundle/Bundle.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Bundle/Bundle.php index 494feabe58eb019cc29a9d57776478e29899babc..c4ba0d1aab0c46283bfa81f817f9fbe0db2104a0 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Bundle/Bundle.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Bundle/Bundle.php @@ -16,6 +16,7 @@ use Symfony\Component\DependencyInjection\Container; use Symfony\Component\Console\Application; use Symfony\Component\Finder\Finder; +use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; /** * An implementation of BundleInterface that adds a few conventions @@ -64,6 +65,8 @@ public function build(ContainerBuilder $container) * * @return ExtensionInterface|null The container extension * + * @throws \LogicException + * * @api */ public function getContainerExtension() @@ -172,7 +175,7 @@ final public function getName() */ public function registerCommands(Application $application) { - if (!$dir = realpath($this->getPath().'/Command')) { + if (!is_dir($dir = $this->getPath().'/Command')) { return; } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Client.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Client.php index 2b1a2b0f4c9df31753ac8268440d91b8f30d3e65..71d05a57ca2ea69139b0ff70ac0436446416a606 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Client.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Client.php @@ -71,6 +71,8 @@ protected function doRequest($request) * Returns the script to execute when the request must be insulated. * * @param Request $request A Request instance + * + * @return string */ protected function getScript($request) { diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Controller/ControllerResolver.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Controller/ControllerResolver.php index cd3caf615847de5e9a7bf541ed49b029bd8b8413..0d308c9d834a69764c2d8ef43fbd687372a4f9ab 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Controller/ControllerResolver.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Controller/ControllerResolver.php @@ -91,6 +91,8 @@ public function getController(Request $request) * @param Request $request A Request instance * @param mixed $controller A PHP callable * + * @return array + * * @throws \RuntimeException When value for argument given is not provided * * @api @@ -142,6 +144,8 @@ protected function doGetArguments(Request $request, $controller, array $paramete * @param string $controller A Controller string * * @return mixed A PHP callable + * + * @throws \InvalidArgumentException */ protected function createController($controller) { diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php index 97797a48f23b8fc8b80e468e0962309adaee326e..cfaa0b7277b0bc2e5d462e20271c2944b6719e83 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php @@ -31,7 +31,7 @@ class ConfigDataCollector extends DataCollector * * @param KernelInterface $kernel A KernelInterface instance */ - public function setKernel(KernelInterface $kernel) + public function setKernel(KernelInterface $kernel = null) { $this->kernel = $kernel; } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php index 629b451f70db0368eb7e8f7908d1d787f789b639..f08720e8073bb9e877b838e526c3988ef06edda1 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php @@ -12,6 +12,7 @@ namespace Symfony\Component\HttpKernel\DataCollector; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\Debug\ErrorHandler; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Log\DebugLoggerInterface; @@ -114,7 +115,7 @@ private function computeDeprecationCount() { $count = 0; foreach ($this->logger->getLogs() as $log) { - if (isset($log['context']['type']) && 'deprecation' === $log['context']['type']) { + if (isset($log['context']['type']) && ErrorHandler::TYPE_DEPRECATION === $log['context']['type']) { $count++; } } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php index 6294845c722a2edd6ac17d6bf9f7f14ba4997af4..fd544b8204b7caf7d53b87026574dda84b415088 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php @@ -50,6 +50,10 @@ public function collect(Request $request, Response $response, \Exception $except $attributes = array(); foreach ($request->attributes->all() as $key => $value) { + if ('_route' == $key && is_object($value)) { + $value = $value->getPattern(); + } + $attributes[$key] = $this->varToString($value); } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Debug/ErrorHandler.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Debug/ErrorHandler.php index f81ea58bf737dc5665375e23d1904454e0e4697e..50eadfe0a5354dcdc95cf80c4c29959977e49ea0 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Debug/ErrorHandler.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Debug/ErrorHandler.php @@ -21,6 +21,8 @@ */ class ErrorHandler { + const TYPE_DEPRECATION = -100; + private $levels = array( E_WARNING => 'Warning', E_NOTICE => 'Notice', @@ -82,9 +84,18 @@ public function handle($level, $message, $file, $line, $context) return false; } - if ($level & E_USER_DEPRECATED || $level & E_DEPRECATED) { + if ($level & (E_USER_DEPRECATED | E_DEPRECATED)) { if (null !== self::$logger) { - self::$logger->warn($message, array('type' => 'deprecation', 'file' => $file, 'line' => $line)); + $deprecation = array( + 'type' => self::TYPE_DEPRECATION, + 'file' => $file, + 'line' => $line, + 'stack' => version_compare(PHP_VERSION, '5.4', '<') + ? array_slice(debug_backtrace(false), 0, 10) + : debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 10) + ); + + self::$logger->warn($message, $deprecation); } return true; diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Debug/ExceptionHandler.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Debug/ExceptionHandler.php index 79d7d66dcca119d9fbda117ca218a42fd22f41c3..cfa624387e6e52f3bf24bcf7864ce9d70aa83d45 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Debug/ExceptionHandler.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Debug/ExceptionHandler.php @@ -91,7 +91,6 @@ public function createResponse($exception) */ public function getContent(FlattenException $exception) { - $title = ''; switch ($exception->getStatusCode()) { case 404: $title = 'Sorry, the page you are looking for could not be found.'; @@ -103,13 +102,10 @@ public function getContent(FlattenException $exception) $content = ''; if ($this->debug) { try { - $message = nl2br($exception->getMessage()); - $class = $this->abbrClass($exception->getClass()); $count = count($exception->getAllPrevious()); - $content = ''; + $total = $count + 1; foreach ($exception->toArray() as $position => $e) { $ind = $count - $position + 1; - $total = $count + 1; $class = $this->abbrClass($e['class']); $message = nl2br($e['message']); $content .= sprintf(<<<EOF @@ -121,7 +117,7 @@ public function getContent(FlattenException $exception) EOF , $ind, $total, $class, $message); - foreach ($e['trace'] as $i => $trace) { + foreach ($e['trace'] as $trace) { $content .= ' <li>'; if ($trace['function']) { $content .= sprintf('at %s%s%s(%s)', $this->abbrClass($trace['class']), $trace['type'], $trace['function'], $this->formatArgs($trace['args'])); @@ -234,9 +230,6 @@ private function decorate($content, $css) img { border: 0; } #sf-resetcontent { width:970px; margin:0 auto; } $css - .xdebug-error { - display: none; - } </style> </head> <body> diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php index e4aab5ba4d003aacd4fa209b01be2477868e77e6..a8a27d9eab961b369bb8e99141f148d5aa97a31a 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php @@ -12,6 +12,7 @@ namespace Symfony\Component\HttpKernel\Debug; use Symfony\Component\Stopwatch\Stopwatch; +use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\Log\LoggerInterface; use Symfony\Component\HttpKernel\Profiler\Profile; use Symfony\Component\HttpKernel\Profiler\Profiler; @@ -177,6 +178,8 @@ public function getNotCalledListeners() * * @param string $method The method name * @param array $arguments The method arguments + * + * @return mixed */ public function __call($method, $arguments) { @@ -372,18 +375,18 @@ private function preDispatch($eventName, Event $event) } switch ($eventName) { - case 'kernel.request': + case KernelEvents::REQUEST: $this->stopwatch->openSection(); break; - case 'kernel.view': - case 'kernel.response': + case KernelEvents::VIEW: + case KernelEvents::RESPONSE: // stop only if a controller has been executed try { $this->stopwatch->stop('controller'); } catch (\LogicException $e) { } break; - case 'kernel.terminate': + case KernelEvents::TERMINATE: $token = $event->getResponse()->headers->get('X-Debug-Token'); $this->stopwatch->openSection($token); break; @@ -393,10 +396,10 @@ private function preDispatch($eventName, Event $event) private function postDispatch($eventName, Event $event) { switch ($eventName) { - case 'kernel.controller': + case KernelEvents::CONTROLLER: $this->stopwatch->start('controller', 'section'); break; - case 'kernel.response': + case KernelEvents::RESPONSE: $token = $event->getResponse()->headers->get('X-Debug-Token'); $this->stopwatch->stopSection($token); if (HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) { @@ -405,7 +408,7 @@ private function postDispatch($eventName, Event $event) $this->updateProfiles($token, true); } break; - case 'kernel.terminate': + case KernelEvents::TERMINATE: $token = $event->getResponse()->headers->get('X-Debug-Token'); $this->stopwatch->stopSection($token); // The children profiles have been updated by the previous 'kernel.response' diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DependencyInjection/Extension.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DependencyInjection/Extension.php index e03ed88b50e665d99af50d284278ddfcd16d06ea..2ca0f132840d6263bc42757779c477d568ae5d62 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DependencyInjection/Extension.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DependencyInjection/Extension.php @@ -11,20 +11,14 @@ namespace Symfony\Component\HttpKernel\DependencyInjection; -use Symfony\Component\Config\Definition\Processor; -use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\Config\Definition\ConfigurationInterface; -use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; -use Symfony\Component\DependencyInjection\Extension\ConfigurationExtensionInterface; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Container; +use Symfony\Component\DependencyInjection\Extension\Extension as BaseExtension; /** - * Provides useful features shared by many extensions. + * Allow adding classes to the class cache. * * @author Fabien Potencier <fabien@symfony.com> */ -abstract class Extension implements ExtensionInterface, ConfigurationExtensionInterface +abstract class Extension extends BaseExtension { private $classes = array(); @@ -47,85 +41,4 @@ public function addClassesToCompile(array $classes) { $this->classes = array_merge($this->classes, $classes); } - - /** - * Returns the base path for the XSD files. - * - * @return string The XSD base path - */ - public function getXsdValidationBasePath() - { - return false; - } - - /** - * Returns the namespace to be used for this extension (XML namespace). - * - * @return string The XML namespace - */ - public function getNamespace() - { - return 'http://example.org/schema/dic/'.$this->getAlias(); - } - - /** - * Returns the recommended alias to use in XML. - * - * This alias is also the mandatory prefix to use when using YAML. - * - * This convention is to remove the "Extension" postfix from the class - * name and then lowercase and underscore the result. So: - * - * AcmeHelloExtension - * - * becomes - * - * acme_hello - * - * This can be overridden in a sub-class to specify the alias manually. - * - * @return string The alias - * - * @throws \BadMethodCallException When the extension name does not follow conventions - */ - public function getAlias() - { - $className = get_class($this); - if (substr($className, -9) != 'Extension') { - throw new \BadMethodCallException('This extension does not follow the naming convention; you must overwrite the getAlias() method.'); - } - $classBaseName = substr(strrchr($className, '\\'), 1, -9); - - return Container::underscore($classBaseName); - } - - final protected function processConfiguration(ConfigurationInterface $configuration, array $configs, $normalizeKeys = true) - { - $processor = new Processor(); - - return $processor->processConfiguration($configuration, $configs, $normalizeKeys); - } - - /** - * {@inheritDoc} - */ - public function getConfiguration(array $config, ContainerBuilder $container) - { - $reflected = new \ReflectionClass($this); - $namespace = $reflected->getNamespaceName(); - - $class = $namespace . '\\Configuration'; - if (class_exists($class)) { - $r = new \ReflectionClass($class); - $container->addResource(new FileResource($r->getFileName())); - - if (!method_exists($class, '__construct')) { - $configuration = new $class(); - - return $configuration; - } - } - - return null; - } } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Event/FilterControllerEvent.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Event/FilterControllerEvent.php index cc47b7195c8bb7455aa14b4e9efae4689ce7299c..2b4860cf295b85ce58b28a7bb1687058523a347e 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Event/FilterControllerEvent.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Event/FilterControllerEvent.php @@ -59,6 +59,8 @@ public function getController() * * @param callable $controller * + * @throws \LogicException + * * @api */ public function setController($controller) diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php index 99c9fff3512186d7b725fd540f6700371edeedc0..8c49d022b0018a2201dd3320e48e3eac5574d88f 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php @@ -49,23 +49,12 @@ public function onKernelException(GetResponseForExceptionEvent $event) $exception = $event->getException(); $request = $event->getRequest(); - if (null !== $this->logger) { - $message = sprintf('%s: %s (uncaught exception) at %s line %s', get_class($exception), $exception->getMessage(), $exception->getFile(), $exception->getLine()); - if (!$exception instanceof HttpExceptionInterface || $exception->getStatusCode() >= 500) { - $this->logger->crit($message); - } else { - $this->logger->err($message); - } - } else { - error_log(sprintf('Uncaught PHP Exception %s: "%s" at %s line %s', get_class($exception), $exception->getMessage(), $exception->getFile(), $exception->getLine())); - } - - $logger = $this->logger instanceof DebugLoggerInterface ? $this->logger : null; + $this->logException($exception, sprintf('Uncaught PHP Exception %s: "%s" at %s line %s', get_class($exception), $exception->getMessage(), $exception->getFile(), $exception->getLine())); $attributes = array( '_controller' => $this->controller, 'exception' => FlattenException::create($exception), - 'logger' => $logger, + 'logger' => $this->logger instanceof DebugLoggerInterface ? $this->logger : null, 'format' => $request->getRequestFormat(), ); @@ -75,16 +64,7 @@ public function onKernelException(GetResponseForExceptionEvent $event) try { $response = $event->getKernel()->handle($request, HttpKernelInterface::SUB_REQUEST, true); } catch (\Exception $e) { - $message = sprintf('Exception thrown when handling an exception (%s: %s)', get_class($e), $e->getMessage()); - if (null !== $this->logger) { - if (!$exception instanceof HttpExceptionInterface || $exception->getStatusCode() >= 500) { - $this->logger->crit($message); - } else { - $this->logger->err($message); - } - } else { - error_log($message); - } + $this->logException($exception, sprintf('Exception thrown when handling an exception (%s: %s)', get_class($e), $e->getMessage()), false); // set handling to false otherwise it wont be able to handle further more $handling = false; @@ -104,4 +84,25 @@ public static function getSubscribedEvents() KernelEvents::EXCEPTION => array('onKernelException', -128), ); } + + /** + * Logs an exception. + * + * @param \Exception $exception The original \Exception instance + * @param string $message The error message to log + * @param Boolean $original False when the handling of the exception thrown another exception + */ + protected function logException(\Exception $exception, $message, $original = true) + { + $isCritical = !$exception instanceof HttpExceptionInterface || $exception->getStatusCode() >= 500; + if (null !== $this->logger) { + if ($isCritical) { + $this->logger->crit($message); + } else { + $this->logger->err($message); + } + } elseif (!$original || $isCritical) { + error_log($message); + } + } } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/RouterListener.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/RouterListener.php index 6cccd3707d1e4448860551dd648d389b5a128f79..208ffc17827deba4c42aae9725f5fec1f4e6c387 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/RouterListener.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/RouterListener.php @@ -41,6 +41,8 @@ class RouterListener implements EventSubscriberInterface * @param UrlMatcherInterface|RequestMatcherInterface $matcher The Url or Request matcher * @param RequestContext|null $context The RequestContext (can be null when $matcher implements RequestContextAwareInterface) * @param LoggerInterface|null $logger The logger + * + * @throws \InvalidArgumentException */ public function __construct($matcher, RequestContext $context = null, LoggerInterface $logger = null) { diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/BadRequestHttpException.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/BadRequestHttpException.php index 753839cd874b17dc933a2a9d55454223aafaa07a..33463452b001f95270284b85c7b29d46be95476d 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/BadRequestHttpException.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/BadRequestHttpException.php @@ -21,9 +21,9 @@ class BadRequestHttpException extends HttpException /** * Constructor. * - * @param string $message The internal exception message - * @param Exception $previous The previous exception - * @param integer $code The internal exception code + * @param string $message The internal exception message + * @param \Exception $previous The previous exception + * @param integer $code The internal exception code */ public function __construct($message = null, \Exception $previous = null, $code = 0) { diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/ConflictHttpException.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/ConflictHttpException.php index 95f1db093f8f3416411aae574266102758425e0d..e416b345a4cf38e64648e03d327af2b776a2bdb8 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/ConflictHttpException.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/ConflictHttpException.php @@ -21,9 +21,9 @@ class ConflictHttpException extends HttpException /** * Constructor. * - * @param string $message The internal exception message - * @param Exception $previous The previous exception - * @param integer $code The internal exception code + * @param string $message The internal exception message + * @param \Exception $previous The previous exception + * @param integer $code The internal exception code */ public function __construct($message = null, \Exception $previous = null, $code = 0) { diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/FlattenException.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/FlattenException.php index 367b549440d6a5791b0c35017d08f33ee93a18ce..66cafed8da5721f37dd1cd99b9551969f2195acd 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/FlattenException.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/FlattenException.php @@ -229,7 +229,7 @@ public function setTrace($trace, $file, $line) 'short_class' => $class, 'class' => isset($entry['class']) ? $entry['class'] : '', 'type' => isset($entry['type']) ? $entry['type'] : '', - 'function' => $entry['function'], + 'function' => isset($entry['function']) ? $entry['function'] : null, 'file' => isset($entry['file']) ? $entry['file'] : null, 'line' => isset($entry['line']) ? $entry['line'] : null, 'args' => isset($entry['args']) ? $this->flattenArgs($entry['args']) : array(), diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/GoneHttpException.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/GoneHttpException.php index 5099944e18e3927f6966c52f6ac01254fd223207..9fea1643bd09ae622492d83fc51925afa720b60d 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/GoneHttpException.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/GoneHttpException.php @@ -21,9 +21,9 @@ class GoneHttpException extends HttpException /** * Constructor. * - * @param string $message The internal exception message - * @param Exception $previous The previous exception - * @param integer $code The internal exception code + * @param string $message The internal exception message + * @param \Exception $previous The previous exception + * @param integer $code The internal exception code */ public function __construct($message = null, \Exception $previous = null, $code = 0) { diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/LengthRequiredHttpException.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/LengthRequiredHttpException.php index ab54b9a77a601725a43837ef9084f6202924d850..7aca014d71b0c9bce2c8bb9ebb2644abe62d0378 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/LengthRequiredHttpException.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/LengthRequiredHttpException.php @@ -21,9 +21,9 @@ class LengthRequiredHttpException extends HttpException /** * Constructor. * - * @param string $message The internal exception message - * @param Exception $previous The previous exception - * @param integer $code The internal exception code + * @param string $message The internal exception message + * @param \Exception $previous The previous exception + * @param integer $code The internal exception code */ public function __construct($message = null, \Exception $previous = null, $code = 0) { diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/NotAcceptableHttpException.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/NotAcceptableHttpException.php index 19fc4430aac0883e7d663875048adb1175a7d8e0..6ac448aa73245d56bbcc7a821b012db4e7e2c561 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/NotAcceptableHttpException.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/NotAcceptableHttpException.php @@ -21,9 +21,9 @@ class NotAcceptableHttpException extends HttpException /** * Constructor. * - * @param string $message The internal exception message - * @param Exception $previous The previous exception - * @param integer $code The internal exception code + * @param string $message The internal exception message + * @param \Exception $previous The previous exception + * @param integer $code The internal exception code */ public function __construct($message = null, \Exception $previous = null, $code = 0) { diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/PreconditionFailedHttpException.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/PreconditionFailedHttpException.php index 02d992d6c4cb5327b9f31eea99ba430ad802b01d..4126c881a3a3102ff030a0afe6a68fd21e230b00 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/PreconditionFailedHttpException.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/PreconditionFailedHttpException.php @@ -21,9 +21,9 @@ class PreconditionFailedHttpException extends HttpException /** * Constructor. * - * @param string $message The internal exception message - * @param Exception $previous The previous exception - * @param integer $code The internal exception code + * @param string $message The internal exception message + * @param \Exception $previous The previous exception + * @param integer $code The internal exception code */ public function __construct($message = null, \Exception $previous = null, $code = 0) { diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/PreconditionRequiredHttpException.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/PreconditionRequiredHttpException.php index e0ffe2d03fa291b89607ebb68a8e15ddff2e1202..75ba17702aecd01bfba67ac4256772f852bc4729 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/PreconditionRequiredHttpException.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/PreconditionRequiredHttpException.php @@ -22,9 +22,9 @@ class PreconditionRequiredHttpException extends HttpException /** * Constructor. * - * @param string $message The internal exception message - * @param Exception $previous The previous exception - * @param integer $code The internal exception code + * @param string $message The internal exception message + * @param \Exception $previous The previous exception + * @param integer $code The internal exception code */ public function __construct($message = null, \Exception $previous = null, $code = 0) { diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/ServiceUnavailableHttpException.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/ServiceUnavailableHttpException.php index 031b85d685e639d458f174a184611b1484d4528f..09bbb6ed319db731d7c8cd1ae373be410c06db75 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/ServiceUnavailableHttpException.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/ServiceUnavailableHttpException.php @@ -21,10 +21,10 @@ class ServiceUnavailableHttpException extends HttpException /** * Constructor. * - * @param int|string $retryAfter The number of seconds or HTTP-date after which the request may be retried - * @param string $message The internal exception message - * @param Exception $previous The previous exception - * @param integer $code The internal exception code + * @param int|string $retryAfter The number of seconds or HTTP-date after which the request may be retried + * @param string $message The internal exception message + * @param \Exception $previous The previous exception + * @param integer $code The internal exception code */ public function __construct($retryAfter = null, $message = null, \Exception $previous = null, $code = 0) { diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/TooManyRequestsHttpException.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/TooManyRequestsHttpException.php index 7a7c10f521a9597d0b510cb093a6bbd760d7f84b..b1232ef6cbb150d7675e5918279ee8cfbf42311d 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/TooManyRequestsHttpException.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/TooManyRequestsHttpException.php @@ -22,10 +22,10 @@ class TooManyRequestsHttpException extends HttpException /** * Constructor. * - * @param int|string $retryAfter The number of seconds or HTTP-date after which the request may be retried - * @param string $message The internal exception message - * @param Exception $previous The previous exception - * @param integer $code The internal exception code + * @param integer|string $retryAfter The number of seconds or HTTP-date after which the request may be retried + * @param string $message The internal exception message + * @param \Exception $previous The previous exception + * @param integer $code The internal exception code */ public function __construct($retryAfter = null, $message = null, \Exception $previous = null, $code = 0) { diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/UnauthorizedHttpException.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/UnauthorizedHttpException.php index d3b86c6ceb3404e3c956004d6bfbba73e578b9ba..2527d62f89061e0d513de57b0ecb75c908e8f048 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/UnauthorizedHttpException.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/UnauthorizedHttpException.php @@ -21,10 +21,10 @@ class UnauthorizedHttpException extends HttpException /** * Constructor. * - * @param string $challenge WWW-Authenticate challenge string - * @param string $message The internal exception message - * @param Exception $previous The previous exception - * @param integer $code The internal exception code + * @param string $challenge WWW-Authenticate challenge string + * @param string $message The internal exception message + * @param \Exception $previous The previous exception + * @param integer $code The internal exception code */ public function __construct($challenge, $message = null, \Exception $previous = null, $code = 0) { diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/UnsupportedMediaTypeHttpException.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/UnsupportedMediaTypeHttpException.php index d92c0f2f44be03e158c1907664b9ae740778e329..88bceecfee65b078b917cd08c7ff368366cba72c 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/UnsupportedMediaTypeHttpException.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/UnsupportedMediaTypeHttpException.php @@ -21,9 +21,9 @@ class UnsupportedMediaTypeHttpException extends HttpException /** * Constructor. * - * @param string $message The internal exception message - * @param Exception $previous The previous exception - * @param integer $code The internal exception code + * @param string $message The internal exception message + * @param \Exception $previous The previous exception + * @param integer $code The internal exception code */ public function __construct($message = null, \Exception $previous = null, $code = 0) { diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/Esi.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/Esi.php index e1a0e6a27194e8e3f5a3edd63d619c3c0963ee17..455b3dcce968b6b6c2a4b0acc2c1d314257eea74 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/Esi.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/Esi.php @@ -34,9 +34,9 @@ class Esi * Constructor. * * @param array $contentTypes An array of content-type that should be parsed for ESI information. - * (default: text/html, text/xml, and application/xml) + * (default: text/html, text/xml, application/xhtml+xml, and application/xml) */ - public function __construct(array $contentTypes = array('text/html', 'text/xml', 'application/xml')) + public function __construct(array $contentTypes = array('text/html', 'text/xml', 'application/xhtml+xml', 'application/xml')) { $this->contentTypes = $contentTypes; } @@ -117,6 +117,8 @@ public function needsEsiParsing(Response $response) * @param string $alt An alternate URI * @param Boolean $ignoreErrors Whether to ignore errors or not * @param string $comment A comment to add as an esi:include tag + * + * @return string */ public function renderIncludeTag($uri, $alt = null, $ignoreErrors = true, $comment = '') { @@ -138,6 +140,8 @@ public function renderIncludeTag($uri, $alt = null, $ignoreErrors = true, $comme * * @param Request $request A Request instance * @param Response $response A Response instance + * + * @return Response */ public function process(Request $request, Response $response) { @@ -182,6 +186,11 @@ public function process(Request $request, Response $response) * @param string $uri The main URI * @param string $alt An alternative URI * @param Boolean $ignoreErrors Whether to ignore errors or not + * + * @return string + * + * @throws \RuntimeException + * @throws \Exception */ public function handle(HttpCache $cache, $uri, $alt, $ignoreErrors) { @@ -212,6 +221,8 @@ public function handle(HttpCache $cache, $uri, $alt, $ignoreErrors) * @param array $attributes An array containing the attributes. * * @return string The response content for the include. + * + * @throws \RuntimeException */ private function handleEsiIncludeTag($attributes) { diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/HttpCache.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/HttpCache.php index 649f4ffe69ad701d420db26bee5f6b6deae5d1a2..4b5b0c1574cd4644fed21a86e59d4ac66945040a 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/HttpCache.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/HttpCache.php @@ -19,6 +19,7 @@ use Symfony\Component\HttpKernel\TerminableInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\HttpCache\Esi; /** * Cache provides HTTP caching. @@ -135,7 +136,7 @@ public function getLog() /** * Gets the Request instance associated with the master request. * - * @return Symfony\Component\HttpFoundation\Request A Request instance + * @return Request A Request instance */ public function getRequest() { @@ -145,7 +146,7 @@ public function getRequest() /** * Gets the Kernel instance * - * @return Symfony\Component\HttpKernel\HttpKernelInterface An HttpKernelInterface instance + * @return HttpKernelInterface An HttpKernelInterface instance */ public function getKernel() { @@ -156,7 +157,7 @@ public function getKernel() /** * Gets the Esi instance * - * @return Symfony\Component\HttpKernel\HttpCache\Esi An Esi instance + * @return Esi An Esi instance */ public function getEsi() { @@ -251,6 +252,8 @@ protected function pass(Request $request, $catch = false) * * @return Response A Response instance * + * @throws \Exception + * * @see RFC2616 13.10 */ protected function invalidate(Request $request, $catch = false) @@ -288,6 +291,8 @@ protected function invalidate(Request $request, $catch = false) * @param Boolean $catch whether to process exceptions * * @return Response A Response instance + * + * @throws \Exception */ protected function lookup(Request $request, $catch = false) { @@ -549,6 +554,8 @@ protected function lock(Request $request, Response $entry) * * @param Request $request A Request instance * @param Response $response A Response instance + * + * @throws \Exception */ protected function store(Request $request, Response $response) { diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/Store.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/Store.php index b0662db99d062b5f561d7632aa0439bc876eb385..7173f44ee3c76c5025d5db5db17cbc2d725793a5 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/Store.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/Store.php @@ -84,6 +84,7 @@ public function lock(Request $request) return true; } + return !file_exists($path) ?: $path; } @@ -156,6 +157,8 @@ public function lookup(Request $request) * @param Response $response A Response instance * * @return string The key under which the response is stored + * + * @throws \RuntimeException */ public function write(Request $request, Response $response) { @@ -218,6 +221,8 @@ protected function generateContentDigest(Response $response) * Invalidates all cache entries that match the request. * * @param Request $request A Request instance + * + * @throws \RuntimeException */ public function invalidate(Request $request) { @@ -335,6 +340,8 @@ private function load($key) * * @param string $key The store key * @param string $data The data to store + * + * @return Boolean */ private function save($key, $data) { @@ -414,6 +421,8 @@ private function persistResponse(Response $response) * * @param array $headers An array of HTTP headers for the Response * @param string $body The Response body + * + * @return Response */ private function restoreResponse($headers, $body = null) { diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php index 95167011b93551081ff1bd7dfee6f55977e6068a..7ebcfeef6cfa8d309d5d78d1946103aaf09aff12 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php @@ -179,6 +179,8 @@ private function filterResponse(Response $response, Request $request, $type) * @param integer $type The type of the request * * @return Response A Response instance + * + * @throws \Exception */ private function handleException(\Exception $e, $request, $type) { diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Kernel.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Kernel.php index 046d0c8a6aded3bc42d83c6bcab3a94c37334049..46440a34687177bb851e88a335a3bb692c34a1df 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Kernel.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Kernel.php @@ -85,6 +85,7 @@ public function __construct($environment, $debug) $this->rootDir = $this->getRootDir(); $this->name = $this->getName(); $this->classes = array(); + $this->bundles = array(); if ($this->debug) { $this->startTime = microtime(true); @@ -95,17 +96,18 @@ public function __construct($environment, $debug) public function init() { + ini_set('display_errors', 0); + if ($this->debug) { - ini_set('display_errors', 1); error_reporting(-1); DebugClassLoader::enable(); ErrorHandler::register($this->errorReportingLevel); if ('cli' !== php_sapi_name()) { ExceptionHandler::register(); + } else { + ini_set('display_errors', 1); } - } else { - ini_set('display_errors', 0); } } @@ -207,7 +209,7 @@ protected function getHttpKernel() /** * {@inheritdoc} - * + * * @api */ public function getBundles() @@ -618,6 +620,8 @@ protected function getEnvParameters() * Builds the service container. * * @return ContainerBuilder The compiled service container + * + * @throws \RuntimeException */ protected function buildContainer() { @@ -729,17 +733,26 @@ public static function stripComments($source) return $source; } + $rawChunk = ''; $output = ''; - foreach (token_get_all($source) as $token) { + $tokens = token_get_all($source); + for (reset($tokens); false !== $token = current($tokens); next($tokens)) { if (is_string($token)) { - $output .= $token; + $rawChunk .= $token; + } elseif (T_START_HEREDOC === $token[0]) { + $output .= preg_replace(array('/\s+$/Sm', '/\n+/S'), "\n", $rawChunk) . $token[1]; + do { + $token = next($tokens); + $output .= $token[1]; + } while ($token[0] !== T_END_HEREDOC); + $rawChunk = ''; } elseif (!in_array($token[0], array(T_COMMENT, T_DOC_COMMENT))) { - $output .= $token[1]; + $rawChunk .= $token[1]; } } // replace multiple new lines with a single newline - $output = preg_replace(array('/\s+$/Sm', '/\n+/S'), "\n", $output); + $output .= preg_replace(array('/\s+$/Sm', '/\n+/S'), "\n", $rawChunk); return $output; } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/LICENSE b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/LICENSE index cdffe7aebc04acd5c2b9c3042a0923d8e8f31998..88a57f8d8da49126c6f7d225d567ad216ace4d83 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/LICENSE +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2012 Fabien Potencier +Copyright (c) 2004-2013 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 diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/BaseMemcacheProfilerStorage.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/BaseMemcacheProfilerStorage.php index c4e259aa844958c10ad84238c1a8aab08555dba4..e3454f60f9a6421245b384976e411f230a19ef73 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/BaseMemcacheProfilerStorage.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/BaseMemcacheProfilerStorage.php @@ -40,7 +40,7 @@ public function __construct($dsn, $username = '', $password = '', $lifetime = 86 /** * {@inheritdoc} */ - public function find($ip, $url, $limit, $method) + public function find($ip, $url, $limit, $method, $start = null, $end = null) { $indexName = $this->getIndexName(); @@ -64,10 +64,20 @@ public function find($ip, $url, $limit, $method) list($itemToken, $itemIp, $itemMethod, $itemUrl, $itemTime, $itemParent) = explode("\t", $item, 6); + $itemTime = (int) $itemTime; + if ($ip && false === strpos($itemIp, $ip) || $url && false === strpos($itemUrl, $url) || $method && false === strpos($itemMethod, $method)) { continue; } + if (!empty($start) && $itemTime < $start) { + continue; + } + + if (!empty($end) && $itemTime > $end) { + continue; + } + $result[$itemToken] = array( 'token' => $itemToken, 'ip' => $itemIp, diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php index 4505ba218f3f94cd4f066346c5d8be0d21983ba8..41287c825a9cb7471fae5164e0494da8094231f1 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php @@ -30,6 +30,8 @@ class FileProfilerStorage implements ProfilerStorageInterface * Example : "file:/path/to/the/storage/folder" * * @param string $dsn The DSN + * + * @throws \RuntimeException */ public function __construct($dsn) { @@ -46,7 +48,7 @@ public function __construct($dsn) /** * {@inheritdoc} */ - public function find($ip, $url, $limit, $method) + public function find($ip, $url, $limit, $method, $start = null, $end = null) { $file = $this->getIndexFilename(); @@ -72,10 +74,20 @@ public function find($ip, $url, $limit, $method) list($csvToken, $csvIp, $csvMethod, $csvUrl, $csvTime, $csvParent) = str_getcsv($line); + $csvTime = (int) $csvTime; + if ($ip && false === strpos($csvIp, $ip) || $url && false === strpos($csvUrl, $url) || $method && false === strpos($csvMethod, $method)) { continue; } + if (!empty($start) && $csvTime < $start) { + continue; + } + + if (!empty($end) && $csvTime > $end) { + continue; + } + $result[$csvToken] = array( 'token' => $csvToken, 'ip' => $csvIp, @@ -177,6 +189,8 @@ public function write(Profile $profile) /** * Gets filename to store data, associated to the token. * + * @param string $token + * * @return string The profile filename */ protected function getFilename($token) diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/MemcacheProfilerStorage.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/MemcacheProfilerStorage.php index ebf3b5c2acc4ff60bdbeb9888a2af1f68595ea0b..b9ab9d118155ac646529c6979c2a89d1f5e6cf4c 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/MemcacheProfilerStorage.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/MemcacheProfilerStorage.php @@ -20,7 +20,6 @@ */ class MemcacheProfilerStorage extends BaseMemcacheProfilerStorage { - /** * @var Memcache */ @@ -30,6 +29,8 @@ class MemcacheProfilerStorage extends BaseMemcacheProfilerStorage * Internal convenience method that returns the instance of the Memcache * * @return Memcache + * + * @throws \RuntimeException */ protected function getMemcache() { @@ -106,5 +107,4 @@ protected function appendValue($key, $value, $expiration = 0) return $memcache->set($key, $content . $value, false, $expiration); } - } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/MemcachedProfilerStorage.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/MemcachedProfilerStorage.php index 34ca1cbcadd1363fdb05309d689150ea77bceeec..f7f68423589a4901e2005c45fa6692832616fbd6 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/MemcachedProfilerStorage.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/MemcachedProfilerStorage.php @@ -20,7 +20,6 @@ */ class MemcachedProfilerStorage extends BaseMemcacheProfilerStorage { - /** * @var Memcached */ @@ -30,6 +29,8 @@ class MemcachedProfilerStorage extends BaseMemcacheProfilerStorage * Internal convenience method that returns the instance of the Memcached * * @return Memcached + * + * @throws \RuntimeException */ protected function getMemcached() { @@ -101,5 +102,4 @@ protected function appendValue($key, $value, $expiration = 0) return $result; } - } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/MongoDbProfilerStorage.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/MongoDbProfilerStorage.php index 90db3dfbb137300612e47d127eda1c261257d54d..56f6865d9097460a455f7a1cebe2c21b3fd940a2 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/MongoDbProfilerStorage.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/MongoDbProfilerStorage.php @@ -34,9 +34,9 @@ public function __construct($dsn, $username = '', $password = '', $lifetime = 86 /** * {@inheritdoc} */ - public function find($ip, $url, $limit, $method) + public function find($ip, $url, $limit, $method, $start = null, $end = null) { - $cursor = $this->getMongo()->find($this->buildQuery($ip, $url, $method), array('_id', 'parent', 'ip', 'method', 'url', 'time'))->sort(array('time' => -1))->limit($limit); + $cursor = $this->getMongo()->find($this->buildQuery($ip, $url, $method, $start, $end), array('_id', 'parent', 'ip', 'method', 'url', 'time'))->sort(array('time' => -1))->limit($limit); $tokens = array(); foreach ($cursor as $profile) { @@ -85,24 +85,31 @@ public function write(Profile $profile) 'time' => $profile->getTime() ); - return $this->getMongo()->update(array('_id' => $profile->getToken()), array_filter($record, function ($v) { return !empty($v); }), array('upsert' => true)); + $result = $this->getMongo()->update(array('_id' => $profile->getToken()), array_filter($record, function ($v) { return !empty($v); }), array('upsert' => true)); + + return (boolean) (isset($result['ok']) ? $result['ok'] : $result); } /** * Internal convenience method that returns the instance of the MongoDB Collection * * @return \MongoCollection + * + * @throws \RuntimeException */ protected function getMongo() { if ($this->mongo === null) { if (preg_match('#^(mongodb://.*)/(.*)/(.*)$#', $this->dsn, $matches)) { - $mongo = new \Mongo($matches[1] . (!empty($matches[2]) ? '/' . $matches[2] : '')); + $server = $matches[1] . (!empty($matches[2]) ? '/' . $matches[2] : ''); $database = $matches[2]; $collection = $matches[3]; + + $mongoClass = (version_compare(phpversion('mongo'), '1.3.0', '<')) ? '\Mongo' : '\MongoClient'; + $mongo = new $mongoClass($server); $this->mongo = $mongo->selectCollection($database, $collection); } else { - throw new \RuntimeException(sprintf('Please check your configuration. You are trying to use MongoDB with an invalid dsn "%s". The expected format is "mongodb://user:pass@location/database/collection"', $this->dsn)); + throw new \RuntimeException(sprintf('Please check your configuration. You are trying to use MongoDB with an invalid dsn "%s". The expected format is "mongodb://[user:pass@]host/database/collection"', $this->dsn)); } } @@ -111,7 +118,7 @@ protected function getMongo() /** * @param array $data - * + * * @return Profile */ protected function createProfileFromData(array $data) @@ -132,7 +139,7 @@ protected function createProfileFromData(array $data) /** * @param string $token - * + * * @return Profile[] An array of Profile instances */ protected function readChildren($token) @@ -156,10 +163,12 @@ protected function cleanup() * @param string $ip * @param string $url * @param string $method - * + * @param int $start + * @param int $end + * * @return array */ - private function buildQuery($ip, $url, $method) + private function buildQuery($ip, $url, $method, $start, $end) { $query = array(); @@ -175,12 +184,24 @@ private function buildQuery($ip, $url, $method) $query['method'] = $method; } + if (!empty($start) || !empty($end)) { + $query['time'] = array(); + } + + if (!empty($start)) { + $query['time']['$gte'] = $start; + } + + if (!empty($end)) { + $query['time']['$lte'] = $end; + } + return $query; } /** * @param array $data - * + * * @return array */ private function getData(array $data) @@ -198,7 +219,7 @@ private function getData(array $data) /** * @param array $data - * + * * @return Profile */ private function getProfile(array $data) diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/MysqlProfilerStorage.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/MysqlProfilerStorage.php index 699b2f4f1c703c9b6446dbf7255de42b705c4464..0aee1b54b309d2e4e49af6ecc128f9bb69706022 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/MysqlProfilerStorage.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/MysqlProfilerStorage.php @@ -44,7 +44,7 @@ protected function initDb() /** * {@inheritdoc} */ - protected function buildCriteria($ip, $url, $limit, $method) + protected function buildCriteria($ip, $url, $start, $end, $limit, $method) { $criteria = array(); $args = array(); @@ -64,6 +64,16 @@ protected function buildCriteria($ip, $url, $limit, $method) $args[':method'] = $method; } + if (!empty($start)) { + $criteria[] = 'time >= :start'; + $args[':start'] = $start; + } + + if (!empty($end)) { + $criteria[] = 'time <= :end'; + $args[':end'] = $end; + } + return array($criteria, $args); } } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/PdoProfilerStorage.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/PdoProfilerStorage.php index 36dcab8ecc69dea14b26ba066b54f3f70ad8d3ed..3f9e03da8019917785b07ac8ed6b468d356af3da 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/PdoProfilerStorage.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/PdoProfilerStorage.php @@ -44,9 +44,17 @@ public function __construct($dsn, $username = '', $password = '', $lifetime = 86 /** * {@inheritdoc} */ - public function find($ip, $url, $limit, $method) + public function find($ip, $url, $limit, $method, $start = null, $end = null) { - list($criteria, $args) = $this->buildCriteria($ip, $url, $limit, $method); + if (null === $start) { + $start = 0; + } + + if (null === $end) { + $end = time(); + } + + list($criteria, $args) = $this->buildCriteria($ip, $url, $start, $end, $limit, $method); $criteria = $criteria ? 'WHERE '.implode(' AND ', $criteria) : ''; @@ -122,12 +130,14 @@ public function purge() * * @param string $ip The IP * @param string $url The URL + * @param string $start The start period to search from + * @param string $end The end period to search to * @param string $limit The maximum number of tokens to return * @param string $method The request method * * @return array An array with (criteria, args) */ - abstract protected function buildCriteria($ip, $url, $limit, $method); + abstract protected function buildCriteria($ip, $url, $start, $end, $limit, $method); /** * Initializes the database @@ -241,7 +251,7 @@ protected function readChildren($token, $parent) * * @param string $token The profile token * - * @return Boolean + * @return string */ protected function has($token) { diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/Profile.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/Profile.php index e00ba71d36823925d3a7b061cb7729abb5165924..b3fa5514d3874e49b4140d42444c78e3d1d5657f 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/Profile.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/Profile.php @@ -114,7 +114,7 @@ public function getIp() /** * Sets the IP. - * + * * @param string $ip */ public function setIp($ip) @@ -159,6 +159,10 @@ public function setUrl($url) */ public function getTime() { + if (null === $this->time) { + return 0; + } + return $this->time; } @@ -179,7 +183,7 @@ public function getChildren() /** * Sets children profiler. - * + * * @param Profile[] $children An array of Profile */ public function setChildren(array $children) @@ -221,7 +225,7 @@ public function getCollector($name) /** * Gets the Collectors associated with this profile. - * + * * @return DataCollectorInterface[] */ public function getCollectors() @@ -231,7 +235,7 @@ public function getCollectors() /** * Sets the Collectors associated with this profile. - * + * * @param DataCollectorInterface[] $collectors */ public function setCollectors(array $collectors) diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/Profiler.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/Profiler.php index aa336a8b04bd42785b23efa7e9e2f3cd8a9cc02c..ea93a24aea1862c65795a0075f76ea7a7dd6896a 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/Profiler.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/Profiler.php @@ -163,12 +163,30 @@ public function import($data) * @param string $url The URL * @param string $limit The maximum number of tokens to return * @param string $method The request method + * @param string $start The start date to search from + * @param string $end The end date to search to * * @return array An array of tokens + * + * @see http://fr2.php.net/manual/en/datetime.formats.php for the supported date/time formats */ - public function find($ip, $url, $limit, $method) + public function find($ip, $url, $limit, $method, $start, $end) { - return $this->storage->find($ip, $url, $limit, $method); + if ('' != $start && null !== $start) { + $start = new \DateTime($start); + $start = $start->getTimestamp(); + } else { + $start = null; + } + + if ('' != $end && null !== $end) { + $end = new \DateTime($end); + $end = $end->getTimestamp(); + } else { + $end = null; + } + + return $this->storage->find($ip, $url, $limit, $method, $start, $end); } /** diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/ProfilerStorageInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/ProfilerStorageInterface.php index f92d90d87d4183c4f1f3bffa5c43801c8ac2830b..3bb0d68ffdee30b5af315a14d8e5f1b618d0d373 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/ProfilerStorageInterface.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/ProfilerStorageInterface.php @@ -21,14 +21,16 @@ interface ProfilerStorageInterface /** * Finds profiler tokens for the given criteria. * - * @param string $ip The IP - * @param string $url The URL - * @param string $limit The maximum number of tokens to return - * @param string $method The request method + * @param string $ip The IP + * @param string $url The URL + * @param string $limit The maximum number of tokens to return + * @param string $method The request method + * @param int|null $start The start date to search from + * @param int|null $end The end date to search to * * @return array An array of tokens */ - public function find($ip, $url, $limit, $method); + public function find($ip, $url, $limit, $method, $start = null, $end = null); /** * Reads data associated with the given token. diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/RedisProfilerStorage.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/RedisProfilerStorage.php index 51c9f9c344c78f10e33c9251c7fa679aa6d98d2b..5c143129c08698f7f900c77f21921574ff75c9f1 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/RedisProfilerStorage.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/RedisProfilerStorage.php @@ -52,7 +52,7 @@ public function __construct($dsn, $username = '', $password = '', $lifetime = 86 /** * {@inheritdoc} */ - public function find($ip, $url, $limit, $method) + public function find($ip, $url, $limit, $method, $start = null, $end = null) { $indexName = $this->getIndexName(); @@ -74,10 +74,20 @@ public function find($ip, $url, $limit, $method) list($itemToken, $itemIp, $itemMethod, $itemUrl, $itemTime, $itemParent) = explode("\t", $item, 6); + $itemTime = (int) $itemTime; + if ($ip && false === strpos($itemIp, $ip) || $url && false === strpos($itemUrl, $url) || $method && false === strpos($itemMethod, $method)) { continue; } + if (!empty($start) && $itemTime < $start) { + continue; + } + + if (!empty($end) && $itemTime > $end) { + continue; + } + $result[$itemToken] = array( 'token' => $itemToken, 'ip' => $itemIp, @@ -197,6 +207,8 @@ public function write(Profile $profile) * Internal convenience method that returns the instance of Redis. * * @return Redis + * + * @throws \RuntimeException */ protected function getRedis() { diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/SqliteProfilerStorage.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/SqliteProfilerStorage.php index f59bbc934de340c3be7c76a1f832fdcdd78f92c8..0c25bc950c3aef565ba9750ec2225464583468ab 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/SqliteProfilerStorage.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/SqliteProfilerStorage.php @@ -97,7 +97,7 @@ protected function fetch($db, $query, array $args = array()) /** * {@inheritdoc} */ - protected function buildCriteria($ip, $url, $limit, $method) + protected function buildCriteria($ip, $url, $start, $end, $limit, $method) { $criteria = array(); $args = array(); @@ -117,6 +117,16 @@ protected function buildCriteria($ip, $url, $limit, $method) $args[':method'] = $method; } + if (!empty($start)) { + $criteria[] = 'time >= :start'; + $args[':start'] = $start; + } + + if (!empty($end)) { + $criteria[] = 'time <= :end'; + $args[':end'] = $end; + } + return array($criteria, $args); } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/DataCollector/LoggerDataCollectorTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/DataCollector/LoggerDataCollectorTest.php index c4ec7634a48617809bb7b746453a463951eb4da4..ea82d9d3157339eb7df2078ec6b210ef813deb46 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/DataCollector/LoggerDataCollectorTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/DataCollector/LoggerDataCollectorTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\HttpKernel\Tests\DataCollector; use Symfony\Component\HttpKernel\DataCollector\LoggerDataCollector; +use Symfony\Component\HttpKernel\Debug\ErrorHandler; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -66,8 +67,8 @@ public function getCollectTestData() array( 1, array( - array('message' => 'foo', 'context' => array('type' => 'deprecation')), - array('message' => 'foo2', 'context' => array('type' => 'deprecation')) + array('message' => 'foo', 'context' => array('type' => ErrorHandler::TYPE_DEPRECATION)), + array('message' => 'foo2', 'context' => array('type' => ErrorHandler::TYPE_DEPRECATION)) ), null, 2 diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/ErrorHandlerTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/ErrorHandlerTest.php index 491a0a71067e09d54bec67d69839f92da1f254eb..fdd02eaaf5959109c456466ce3ae4921c2b17d65 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/ErrorHandlerTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/ErrorHandlerTest.php @@ -68,10 +68,25 @@ public function testHandle() restore_error_handler(); $logger = $this->getMock('Symfony\Component\HttpKernel\Log\LoggerInterface'); - $logger->expects($this->once())->method('warn')->with( - $this->equalTo('foo'), - $this->equalTo(array('type' => 'deprecation', 'file' => 'foo.php', 'line' => '12')) - ); + + $that = $this; + $warnArgCheck = function($message, $context) use ($that) { + $that->assertEquals('foo', $message); + $that->assertArrayHasKey('file', $context); + $that->assertEquals($context['file'], 'foo.php'); + $that->assertArrayHasKey('line', $context); + $that->assertEquals($context['line'], 12); + $that->assertArrayHasKey('type', $context); + $that->assertEquals($context['type'], ErrorHandler::TYPE_DEPRECATION); + $that->assertArrayHasKey('stack', $context); + $that->assertInternalType('array', $context['stack']); + }; + + $logger + ->expects($this->once()) + ->method('warn') + ->will($this->returnCallback($warnArgCheck)) + ; $handler = ErrorHandler::register(E_USER_DEPRECATED); $handler->setLogger($logger); diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/TraceableEventDispatcherTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/TraceableEventDispatcherTest.php index 88318cc2e98815340a6ad9db53a21b6e14a2a6d0..07faa8a688eb3e88631464d454764d62afa21f7e 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/TraceableEventDispatcherTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/TraceableEventDispatcherTest.php @@ -194,7 +194,7 @@ protected function getHttpKernel($dispatcher, $controller) class EventSubscriber implements EventSubscriberInterface { - static public function getSubscribedEvents() + public static function getSubscribedEvents() { return array('foo' => 'call'); } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php index e5e6124768388fc973b8e93275e763f3072610bf..a10ae9b6fbd3114eb5e9242eeab0e7b3ee2a24e5 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php @@ -111,7 +111,6 @@ public function provider() array($event, $event2) ); } - } class TestLogger extends Logger implements DebugLoggerInterface diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/KernelTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/KernelTest.php index 46361f6f5ab678aa90a23130dd102bda1d3e078f..d4295f5ab85b839b1f4847fe76aeaa1aabd5f1b0 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/KernelTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/KernelTest.php @@ -223,9 +223,28 @@ public function testStripComments() return; } - $source = <<<EOF + $source = <<<'EOF' <?php +$string = 'string should not be modified'; + + +$heredoc = <<<HD + + +Heredoc should not be modified + + +HD; + +$nowdoc = <<<'ND' + + +Nowdoc should not be modified + + +ND; + /** * some class comments to strip */ @@ -240,8 +259,25 @@ public function doStuff() } } EOF; - $expected = <<<EOF + $expected = <<<'EOF' <?php +$string = 'string should not be modified'; +$heredoc = +<<<HD + + +Heredoc should not be modified + + +HD; +$nowdoc = +<<<'ND' + + +Nowdoc should not be modified + + +ND; class TestClass { public function doStuff() diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/AbstractProfilerStorageTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/AbstractProfilerStorageTest.php index 62f24ce87a405b961f0de6d35c7bec506389759a..7be88267a5854447fc196b07eeb0d50f202b2e07 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/AbstractProfilerStorageTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/AbstractProfilerStorageTest.php @@ -156,6 +156,8 @@ public function testRetrieveByUrl() public function testStoreTime() { $dt = new \DateTime('now'); + $start = $dt->getTimestamp(); + for ($i = 0; $i < 3; $i++) { $dt->modify('+1 minute'); $profile = new Profile('time_'.$i); @@ -165,11 +167,15 @@ public function testStoreTime() $profile->setMethod('GET'); $this->getStorage()->write($profile); } - $records = $this->getStorage()->find('', '', 3, 'GET'); + + $records = $this->getStorage()->find('', '', 3, 'GET', $start, time() + 3 * 60); $this->assertCount(3, $records, '->find() returns all previously added records'); $this->assertEquals($records[0]['token'], 'time_2', '->find() returns records ordered by time in descendant order'); $this->assertEquals($records[1]['token'], 'time_1', '->find() returns records ordered by time in descendant order'); $this->assertEquals($records[2]['token'], 'time_0', '->find() returns records ordered by time in descendant order'); + + $records = $this->getStorage()->find('', '', 3, 'GET', $start, time() + 2 * 60); + $this->assertCount(2, $records, '->find() should return only first two of the previously added records'); } public function testRetrieveByEmptyUrlAndIp() diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/MongoDbProfilerStorageTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/MongoDbProfilerStorageTest.php index b2d148d4c3cbb78591642570b49b07297c7807f5..b63b84c0fbc29159523b8f3c4ac08c0d72cbc137 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/MongoDbProfilerStorageTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/MongoDbProfilerStorageTest.php @@ -40,7 +40,7 @@ public function getData() public function collect(Request $request, Response $response, \Exception $exception = null) { } - + public function getName() { return 'test_data_collector'; @@ -126,4 +126,3 @@ protected function setUp() } } } - diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Annotation/Route.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Annotation/Route.php index e593f97ff6dc68a9c8c64a635cdfbeb23bd4a029..d8f4b5ae934df561a821ecacb426090e66fbe355 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Annotation/Route.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Annotation/Route.php @@ -31,6 +31,8 @@ class Route * Constructor. * * @param array $data An array of key/value parameters. + * + * @throws \BadMethodCallException */ public function __construct(array $data) { diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/CHANGELOG.md b/core/vendor/symfony/routing/Symfony/Component/Routing/CHANGELOG.md index e7fec1b0b320c0e8813d97f6fa5369e9bf1ec126..af5f7533065f6c40d3f6330ffe0fc4bdae818473 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/CHANGELOG.md +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/CHANGELOG.md @@ -35,8 +35,32 @@ CHANGELOG $rootCollection->addCollection($childCollection); ``` - * The methods `RouteCollection::getParent()` and `RouteCollection::getRoot()` + * [DEPRECATION] The methods `RouteCollection::getParent()` and `RouteCollection::getRoot()` have been deprecated and will be removed in Symfony 2.3. + * [BC BREAK] Misusing the `RouteCollection::addPrefix` method to add defaults, requirements + or options without adding a prefix is not supported anymore. So if you called `addPrefix` + with an empty prefix or `/` only (both have no relevance), like + `addPrefix('', $defaultsArray, $requirementsArray, $optionsArray)` + you need to use the new dedicated methods `addDefaults($defaultsArray)`, + `addRequirements($requirementsArray)` or `addOptions($optionsArray)` instead. + * [DEPRECATION] The `$options` parameter to `RouteCollection::addPrefix()` has been deprecated + because adding options has nothing to do with adding a path prefix. If you want to add options + to all child routes of a RouteCollection, you can use `addOptions()`. + * [DEPRECATION] The method `RouteCollection::getPrefix()` has been deprecated + because it suggested that all routes in the collection would have this prefix, which is + not necessarily true. On top of that, since there is no tree structure anymore, this method + is also useless. Don't worry about performance, prefix optimization for matching is still done + in the dumper, which was also improved in 2.2.0 to find even more grouping possibilities. + * [DEPRECATION] `RouteCollection::addCollection(RouteCollection $collection)` should now only be + used with a single parameter. The other params `$prefix`, `$default`, `$requirements` and `$options` + will still work, but have been deprecated. The `addPrefix` method should be used for this + use-case instead. + Before: `$parentCollection->addCollection($collection, '/prefix', array(...), array(...))` + After: + ``` + $collection->addPrefix('/prefix', array(...), array(...)); + $parentCollection->addCollection($collection); + ``` * added support for the method default argument values when defining a @Route * Adjacent placeholders without separator work now, e.g. `/{x}{y}{z}.{_format}`. * Characters that function as separator between placeholders are now whitelisted @@ -46,7 +70,7 @@ CHANGELOG it disallows the slash (`/`) and the next char. Using the previous char added no value and was problematic because the route `/index.{_format}` would be matched by `/index.ht/ml`. - * The default requirement now uses possesive quantifiers when possible which + * The default requirement now uses possessive quantifiers when possible which improves matching performance by up to 20% because it prevents backtracking when it's not needed. * The ConfigurableRequirementsInterface can now also be used to disable the requirements diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Generator/UrlGenerator.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Generator/UrlGenerator.php index 2c510a5e3273929d4d118ea72de154ccdaf8667b..aa0a3ee8f28e2ecc1343ab32913174ba653acde2 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Generator/UrlGenerator.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Generator/UrlGenerator.php @@ -29,7 +29,7 @@ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInterface { /** - * @var RouteCollection + * @var RouteCollection */ protected $routes; diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Loader/AnnotationFileLoader.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Loader/AnnotationFileLoader.php index edfe8803f1134041612841ec8623a73716437b72..33776fdc8648d92a6f9fe9b18ce6a576b83bd0ba 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Loader/AnnotationFileLoader.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Loader/AnnotationFileLoader.php @@ -32,6 +32,8 @@ class AnnotationFileLoader extends FileLoader * @param FileLocatorInterface $locator A FileLocator instance * @param AnnotationClassLoader $loader An AnnotationClassLoader instance * @param string|array $paths A path or an array of paths where to look for resources + * + * @throws \RuntimeException */ public function __construct(FileLocatorInterface $locator, AnnotationClassLoader $loader, $paths = array()) { diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Loader/ClosureLoader.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Loader/ClosureLoader.php index 0ec442d87df0cb46031357fbcdeabef78270dcef..8212c2916d9bd760f3fd2d5cc1f45cfa4b613e94 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Loader/ClosureLoader.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Loader/ClosureLoader.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Routing\Loader; use Symfony\Component\Config\Loader\Loader; +use Symfony\Component\Routing\RouteCollection; /** * ClosureLoader loads routes from a PHP closure. @@ -30,6 +31,8 @@ class ClosureLoader extends Loader * @param \Closure $closure A Closure * @param string|null $type The resource type * + * @return RouteCollection A RouteCollection instance + * * @api */ public function load($closure, $type = null) diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Loader/PhpFileLoader.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Loader/PhpFileLoader.php index b93dd255b92d8e0b182832d6da2983014b60ec42..98b7efbf479a04a55e79aafa8d1cb648d9c3f50c 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Loader/PhpFileLoader.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Loader/PhpFileLoader.php @@ -11,8 +11,9 @@ namespace Symfony\Component\Routing\Loader; -use Symfony\Component\Config\Resource\FileResource; use Symfony\Component\Config\Loader\FileLoader; +use Symfony\Component\Config\Resource\FileResource; +use Symfony\Component\Routing\RouteCollection; /** * PhpFileLoader loads routes from a PHP file. @@ -31,6 +32,8 @@ class PhpFileLoader extends FileLoader * @param string $file A PHP file path * @param string|null $type The resource type * + * @return RouteCollection A RouteCollection instance + * * @api */ public function load($file, $type = null) diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Loader/XmlFileLoader.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Loader/XmlFileLoader.php index 1b3eb0c15fde5c03a9913ec59479e2e1d9f6ccf5..00a6012719c184c93e807340d4540ed5a22dcc36 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Loader/XmlFileLoader.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Loader/XmlFileLoader.php @@ -15,16 +15,21 @@ use Symfony\Component\Routing\Route; use Symfony\Component\Config\Resource\FileResource; use Symfony\Component\Config\Loader\FileLoader; +use Symfony\Component\Config\Util\XmlUtils; /** * XmlFileLoader loads XML routing files. * * @author Fabien Potencier <fabien@symfony.com> + * @author Tobias Schultze <http://tobion.de> * * @api */ class XmlFileLoader extends FileLoader { + const NAMESPACE_URI = 'http://symfony.com/schema/routing'; + const SCHEME_PATH = '/schema/routing/routing-1.0.xsd'; + /** * Loads an XML file. * @@ -33,7 +38,8 @@ class XmlFileLoader extends FileLoader * * @return RouteCollection A RouteCollection instance * - * @throws \InvalidArgumentException When a tag can't be parsed + * @throws \InvalidArgumentException When the file cannot be loaded or when the XML cannot be + * parsed because it does not validate against the scheme. * * @api */ @@ -61,54 +67,28 @@ public function load($file, $type = null) /** * Parses a node from a loaded XML file. * - * @param RouteCollection $collection the collection to associate with the node - * @param \DOMElement $node the node to parse - * @param string $path the path of the XML file being processed - * @param string $file + * @param RouteCollection $collection Collection to associate with the node + * @param \DOMElement $node Element to parse + * @param string $path Full path of the XML file being processed + * @param string $file Loaded file name * - * @throws \InvalidArgumentException When a tag can't be parsed + * @throws \InvalidArgumentException When the XML is invalid */ protected function parseNode(RouteCollection $collection, \DOMElement $node, $path, $file) { - switch ($node->tagName) { + if (self::NAMESPACE_URI !== $node->namespaceURI) { + return; + } + + switch ($node->localName) { case 'route': $this->parseRoute($collection, $node, $path); break; case 'import': - $resource = $node->getAttribute('resource'); - $type = $node->getAttribute('type'); - $prefix = $node->getAttribute('prefix'); - $hostnamePattern = $node->getAttribute('hostname-pattern'); - - $defaults = array(); - $requirements = array(); - $options = array(); - - foreach ($node->childNodes as $n) { - if (!$n instanceof \DOMElement) { - continue; - } - - switch ($n->tagName) { - case 'default': - $defaults[$n->getAttribute('key')] = trim($n->nodeValue); - break; - case 'requirement': - $requirements[$n->getAttribute('key')] = trim($n->nodeValue); - break; - case 'option': - $options[$n->getAttribute('key')] = trim($n->nodeValue); - break; - default: - throw new \InvalidArgumentException(sprintf('Unable to parse tag "%s"', $n->tagName)); - } - } - - $this->setCurrentDir(dirname($path)); - $collection->addCollection($this->import($resource, ('' !== $type ? $type : null), false, $file), $prefix, $defaults, $requirements, $options, $hostnamePattern); + $this->parseImport($collection, $node, $path, $file); break; default: - throw new \InvalidArgumentException(sprintf('Unable to parse tag "%s"', $node->tagName)); + throw new \InvalidArgumentException(sprintf('Unknown tag "%s" used in file "%s". Expected "route" or "import".', $node->localName, $path)); } } @@ -125,123 +105,109 @@ public function supports($resource, $type = null) /** * Parses a route and adds it to the RouteCollection. * - * @param RouteCollection $collection A RouteCollection instance - * @param \DOMElement $definition Route definition - * @param string $file An XML file path + * @param RouteCollection $collection RouteCollection instance + * @param \DOMElement $node Element to parse that represents a Route + * @param string $path Full path of the XML file being processed * - * @throws \InvalidArgumentException When the definition cannot be parsed + * @throws \InvalidArgumentException When the XML is invalid */ - protected function parseRoute(RouteCollection $collection, \DOMElement $definition, $file) + protected function parseRoute(RouteCollection $collection, \DOMElement $node, $path) { - $defaults = array(); - $requirements = array(); - $options = array(); - - foreach ($definition->childNodes as $node) { - if (!$node instanceof \DOMElement) { - continue; - } - - switch ($node->tagName) { - case 'default': - $defaults[$node->getAttribute('key')] = trim((string) $node->nodeValue); - break; - case 'option': - $options[$node->getAttribute('key')] = trim((string) $node->nodeValue); - break; - case 'requirement': - $requirements[$node->getAttribute('key')] = trim((string) $node->nodeValue); - break; - default: - throw new \InvalidArgumentException(sprintf('Unable to parse tag "%s"', $node->tagName)); - } + if ('' === ($id = $node->getAttribute('id')) || !$node->hasAttribute('pattern')) { + throw new \InvalidArgumentException(sprintf('The <route> element in file "%s" must have an "id" and a "pattern" attribute.', $path)); } - $route = new Route($definition->getAttribute('pattern'), $defaults, $requirements, $options, $definition->getAttribute('hostname-pattern')); + list($defaults, $requirements, $options) = $this->parseConfigs($node, $path); - $collection->add($definition->getAttribute('id'), $route); + $route = new Route($node->getAttribute('pattern'), $defaults, $requirements, $options, $node->getAttribute('hostname-pattern')); + $collection->add($id, $route); } /** - * Loads an XML file. + * Parses an import and adds the routes in the resource to the RouteCollection. * - * @param string $file An XML file path - * - * @return \DOMDocument + * @param RouteCollection $collection RouteCollection instance + * @param \DOMElement $node Element to parse that represents a Route + * @param string $path Full path of the XML file being processed + * @param string $file Loaded file name * - * @throws \InvalidArgumentException When loading of XML file returns error + * @throws \InvalidArgumentException When the XML is invalid */ - protected function loadFile($file) + protected function parseImport(RouteCollection $collection, \DOMElement $node, $path, $file) { - $internalErrors = libxml_use_internal_errors(true); - $disableEntities = libxml_disable_entity_loader(true); - libxml_clear_errors(); + if ('' === $resource = $node->getAttribute('resource')) { + throw new \InvalidArgumentException(sprintf('The <import> element in file "%s" must have a "resource" attribute.', $path)); + } - $dom = new \DOMDocument(); - $dom->validateOnParse = true; - if (!$dom->loadXML(file_get_contents($file), LIBXML_NONET | (defined('LIBXML_COMPACT') ? LIBXML_COMPACT : 0))) { - libxml_disable_entity_loader($disableEntities); + $type = $node->getAttribute('type'); + $prefix = $node->getAttribute('prefix'); + $hostnamePattern = $node->hasAttribute('hostname-pattern') ? $node->getAttribute('hostname-pattern') : null; - throw new \InvalidArgumentException(implode("\n", $this->getXmlErrors($internalErrors))); - } - $dom->normalizeDocument(); + list($defaults, $requirements, $options) = $this->parseConfigs($node, $path); - libxml_use_internal_errors($internalErrors); - libxml_disable_entity_loader($disableEntities); + $this->setCurrentDir(dirname($path)); - foreach ($dom->childNodes as $child) { - if ($child->nodeType === XML_DOCUMENT_TYPE_NODE) { - throw new \InvalidArgumentException('Document types are not allowed.'); - } + $subCollection = $this->import($resource, ('' !== $type ? $type : null), false, $file); + /* @var $subCollection RouteCollection */ + $subCollection->addPrefix($prefix); + if (null !== $hostnamePattern) { + $subCollection->setHostnamePattern($hostnamePattern); } + $subCollection->addDefaults($defaults); + $subCollection->addRequirements($requirements); + $subCollection->addOptions($options); - $this->validate($dom); - - return $dom; + $collection->addCollection($subCollection); } /** - * Validates a loaded XML file. + * Loads an XML file. * - * @param \DOMDocument $dom A loaded XML file + * @param string $file An XML file path * - * @throws \InvalidArgumentException When XML doesn't validate its XSD schema + * @return \DOMDocument + * + * @throws \InvalidArgumentException When loading of XML file fails because of syntax errors + * or when the XML structure is not as expected by the scheme - + * see validate() */ - protected function validate(\DOMDocument $dom) + protected function loadFile($file) { - $location = __DIR__.'/schema/routing/routing-1.0.xsd'; - - $current = libxml_use_internal_errors(true); - libxml_clear_errors(); - - if (!$dom->schemaValidate($location)) { - throw new \InvalidArgumentException(implode("\n", $this->getXmlErrors($current))); - } - libxml_use_internal_errors($current); + return XmlUtils::loadFile($file, __DIR__ . static::SCHEME_PATH); } /** - * Retrieves libxml errors and clears them. + * Parses the config elements (default, requirement, option). * - * @return array An array of libxml error strings + * @param \DOMElement $node Element to parse that contains the configs + * @param string $path Full path of the XML file being processed + * + * @return array An array with the defaults as first item, requirements as second and options as third. + * + * @throws \InvalidArgumentException When the XML is invalid */ - private function getXmlErrors($internalErrors) + private function parseConfigs(\DOMElement $node, $path) { - $errors = array(); - foreach (libxml_get_errors() as $error) { - $errors[] = sprintf('[%s %s] %s (in %s - line %d, column %d)', - LIBXML_ERR_WARNING == $error->level ? 'WARNING' : 'ERROR', - $error->code, - trim($error->message), - $error->file ? $error->file : 'n/a', - $error->line, - $error->column - ); - } + $defaults = array(); + $requirements = array(); + $options = array(); - libxml_clear_errors(); - libxml_use_internal_errors($internalErrors); + foreach ($node->getElementsByTagNameNS(self::NAMESPACE_URI, '*') as $n) { + switch ($n->localName) { + case 'default': + $defaults[$n->getAttribute('key')] = trim($n->textContent); + break; + case 'requirement': + $requirements[$n->getAttribute('key')] = trim($n->textContent); + break; + case 'option': + $options[$n->getAttribute('key')] = trim($n->textContent); + break; + default: + throw new \InvalidArgumentException(sprintf('Unknown tag "%s" used in file "%s". Expected "default", "requirement" or "option".', $n->localName, $path)); + } + } - return $errors; + return array($defaults, $requirements, $options); } } diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Loader/YamlFileLoader.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Loader/YamlFileLoader.php index 4a530fbb6a7985183f98d235d85be99f42662216..4d91cd5cd3bcb0257969893172e9fd544c02e9ff 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Loader/YamlFileLoader.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Loader/YamlFileLoader.php @@ -21,13 +21,14 @@ * YamlFileLoader loads Yaml routing files. * * @author Fabien Potencier <fabien@symfony.com> + * @author Tobias Schultze <http://tobion.de> * * @api */ class YamlFileLoader extends FileLoader { private static $availableKeys = array( - 'type', 'resource', 'prefix', 'pattern', 'options', 'defaults', 'requirements', 'hostname_pattern', + 'resource', 'type', 'prefix', 'pattern', 'hostname_pattern', 'defaults', 'requirements', 'options', ); /** @@ -38,7 +39,7 @@ class YamlFileLoader extends FileLoader * * @return RouteCollection A RouteCollection instance * - * @throws \InvalidArgumentException When route can't be parsed + * @throws \InvalidArgumentException When a route can't be parsed because YAML is invalid * * @api */ @@ -53,27 +54,19 @@ public function load($file, $type = null) // empty file if (null === $config) { - $config = array(); + return $collection; } // not an array if (!is_array($config)) { - throw new \InvalidArgumentException(sprintf('The file "%s" must contain a YAML array.', $file)); + throw new \InvalidArgumentException(sprintf('The file "%s" must contain a YAML array.', $path)); } foreach ($config as $name => $config) { - $config = $this->normalizeRouteConfig($config); + $this->validate($config, $name, $path); if (isset($config['resource'])) { - $type = isset($config['type']) ? $config['type'] : null; - $prefix = isset($config['prefix']) ? $config['prefix'] : null; - $defaults = isset($config['defaults']) ? $config['defaults'] : array(); - $requirements = isset($config['requirements']) ? $config['requirements'] : array(); - $options = isset($config['options']) ? $config['options'] : array(); - $hostnamePattern = isset($config['hostname_pattern']) ? $config['hostname_pattern'] : ''; - - $this->setCurrentDir(dirname($path)); - $collection->addCollection($this->import($config['resource'], $type, false, $file), $prefix, $defaults, $requirements, $options, $hostnamePattern); + $this->parseImport($collection, $config, $path, $file); } else { $this->parseRoute($collection, $name, $config, $path); } @@ -98,46 +91,90 @@ public function supports($resource, $type = null) * @param RouteCollection $collection A RouteCollection instance * @param string $name Route name * @param array $config Route definition - * @param string $file A Yaml file path - * - * @throws \InvalidArgumentException When config pattern is not defined for the given route + * @param string $path Full path of the YAML file being processed */ - protected function parseRoute(RouteCollection $collection, $name, $config, $file) + protected function parseRoute(RouteCollection $collection, $name, array $config, $path) { $defaults = isset($config['defaults']) ? $config['defaults'] : array(); $requirements = isset($config['requirements']) ? $config['requirements'] : array(); $options = isset($config['options']) ? $config['options'] : array(); $hostnamePattern = isset($config['hostname_pattern']) ? $config['hostname_pattern'] : null; - if (!isset($config['pattern'])) { - throw new \InvalidArgumentException(sprintf('You must define a "pattern" for the "%s" route.', $name)); - } - $route = new Route($config['pattern'], $defaults, $requirements, $options, $hostnamePattern); $collection->add($name, $route); } /** - * Normalize route configuration. + * Parses an import and adds the routes in the resource to the RouteCollection. * - * @param array $config A resource config + * @param RouteCollection $collection A RouteCollection instance + * @param array $config Route definition + * @param string $path Full path of the YAML file being processed + * @param string $file Loaded file name + */ + protected function parseImport(RouteCollection $collection, array $config, $path, $file) + { + $type = isset($config['type']) ? $config['type'] : null; + $prefix = isset($config['prefix']) ? $config['prefix'] : ''; + $defaults = isset($config['defaults']) ? $config['defaults'] : array(); + $requirements = isset($config['requirements']) ? $config['requirements'] : array(); + $options = isset($config['options']) ? $config['options'] : array(); + $hostnamePattern = isset($config['hostname_pattern']) ? $config['hostname_pattern'] : null; + + $this->setCurrentDir(dirname($path)); + + $subCollection = $this->import($config['resource'], $type, false, $file); + /* @var $subCollection RouteCollection */ + $subCollection->addPrefix($prefix); + if (null !== $hostnamePattern) { + $subCollection->setHostnamePattern($hostnamePattern); + } + $subCollection->addDefaults($defaults); + $subCollection->addRequirements($requirements); + $subCollection->addOptions($options); + + $collection->addCollection($subCollection); + } + + /** + * Validates the route configuration. * - * @return array + * @param array $config A resource config + * @param string $name The config key + * @param string $path The loaded file path * - * @throws \InvalidArgumentException if one of the provided config keys is not supported + * @throws \InvalidArgumentException If one of the provided config keys is not supported, + * something is missing or the combination is nonsense */ - private function normalizeRouteConfig(array $config) + protected function validate($config, $name, $path) { - foreach ($config as $key => $value) { - if (!in_array($key, self::$availableKeys)) { - throw new \InvalidArgumentException(sprintf( - 'Yaml routing loader does not support given key: "%s". Expected one of the (%s).', - $key, implode(', ', self::$availableKeys) - )); - } + if (!is_array($config)) { + throw new \InvalidArgumentException(sprintf('The definition of "%s" in "%s" must be a YAML array.', $name, $path)); + } + if ($extraKeys = array_diff(array_keys($config), self::$availableKeys)) { + throw new \InvalidArgumentException(sprintf( + 'The routing file "%s" contains unsupported keys for "%s": "%s". Expected one of: "%s".', + $path, $name, implode('", "', $extraKeys), implode('", "', self::$availableKeys) + )); + } + if (isset($config['resource']) && isset($config['pattern'])) { + throw new \InvalidArgumentException(sprintf( + 'The routing file "%s" must not specify both the "resource" key and the "pattern" key for "%s". Choose between an import and a route definition.', + $path, $name + )); + } + if (!isset($config['resource']) && isset($config['type'])) { + throw new \InvalidArgumentException(sprintf( + 'The "type" key for the route definition "%s" in "%s" is unsupported. It is only available for imports in combination with the "resource" key.', + $name, $path + )); + } + if (!isset($config['resource']) && !isset($config['pattern'])) { + throw new \InvalidArgumentException(sprintf( + 'You must define a "pattern" for the route "%s" in file "%s".', + $name, $path + )); } - - return $config; } } diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Loader/schema/routing/routing-1.0.xsd b/core/vendor/symfony/routing/Symfony/Component/Routing/Loader/schema/routing/routing-1.0.xsd index 5346237edb56eb44dfe45e140052d1c4d96336b5..3143b3ac72a92c3d89bcc7030ec57743080705b1 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Loader/schema/routing/routing-1.0.xsd +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Loader/schema/routing/routing-1.0.xsd @@ -36,14 +36,14 @@ <xsd:group ref="configs" minOccurs="0" maxOccurs="unbounded" /> <xsd:attribute name="id" type="xsd:string" use="required" /> - <xsd:attribute name="pattern" type="xsd:string" default="/" /> + <xsd:attribute name="pattern" type="xsd:string" use="required" /> <xsd:attribute name="hostname-pattern" type="xsd:string" /> </xsd:complexType> <xsd:complexType name="import"> <xsd:group ref="configs" minOccurs="0" maxOccurs="unbounded" /> - <xsd:attribute name="resource" type="xsd:string" /> + <xsd:attribute name="resource" type="xsd:string" use="required" /> <xsd:attribute name="type" type="xsd:string" /> <xsd:attribute name="prefix" type="xsd:string" /> <xsd:attribute name="hostname-pattern" type="xsd:string" /> @@ -52,7 +52,7 @@ <xsd:complexType name="element"> <xsd:simpleContent> <xsd:extension base="xsd:string"> - <xsd:attribute name="key" type="xsd:string" /> + <xsd:attribute name="key" type="xsd:string" use="required" /> </xsd:extension> </xsd:simpleContent> </xsd:complexType> diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/ApacheUrlMatcher.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/ApacheUrlMatcher.php index e513f04e3b447fc3ad582c5a7508ec600b8f9fde..76612e6184ae3355727b36c3750f22fe82876b6e 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/ApacheUrlMatcher.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/ApacheUrlMatcher.php @@ -83,6 +83,7 @@ public function match($pathinfo) if (null !== $route) { $parameters['_route'] = $route; + return $this->mergeDefaults($parameters, $defaults); } elseif (0 < count($allow)) { throw new MethodNotAllowedException($allow); diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/DumperPrefixCollection.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/DumperPrefixCollection.php index 2480991ae3ebeec97405849b67bcde9bc15826d1..26382b0b4fd2ece311f3b2d7112d72e07ffe5f2e 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/DumperPrefixCollection.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/DumperPrefixCollection.php @@ -49,6 +49,8 @@ public function setPrefix($prefix) * @param DumperRoute $route The route * * @return DumperPrefixCollection The node the route was added to + * + * @throws \LogicException */ public function addPrefixRoute(DumperRoute $route) { diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php index 2c86761b63e240b61f2446d2b50a227bd23fc8f6..8fb232ea09ffa34e242852f34a0f4f1f4557e6af 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php @@ -100,7 +100,7 @@ public function match(\$pathinfo) } /** - * Generates PHP code recursively to match a RouteCollection with all child routes and child collections. + * Generates PHP code to match a RouteCollection with all its routes. * * @param RouteCollection $routes A RouteCollection instance * @param Boolean $supportsRedirections Whether redirections are supported by the base class @@ -143,9 +143,9 @@ private function compileRoutes(RouteCollection $routes, $supportsRedirections) /** * Generates PHP code recursively to match a tree of routes * - * @param DumperPrefixCollection $routes A DumperPrefixCollection instance + * @param DumperPrefixCollection $collection A DumperPrefixCollection instance * @param Boolean $supportsRedirections Whether redirections are supported by the base class - * @parma string $prefix Prefix of the parent collection + * @param string $parentPrefix Prefix of the parent collection * * @return string PHP code */ @@ -188,6 +188,8 @@ private function compilePrefixRoutes(DumperPrefixCollection $collection, $suppor * @param string|null $parentPrefix The prefix of the parent collection used to optimize the code * * @return string PHP code + * + * @throws \LogicException */ private function compileRoute(Route $route, $name, $supportsRedirections, $parentPrefix = null) { @@ -323,9 +325,9 @@ private function compileRoute(Route $route, $name, $supportsRedirections, $paren /** * Groups consecutive routes having the same hostname regex. * - * The results is a collection of collections of routes having the same hostname regex. + * The result is a collection of collections of routes having the same hostname regex. * - * @param DumperCollection $routes Flat collection of DumperRoutes + * @param RouteCollection $routes A flat RouteCollection * * @return DumperCollection A collection with routes grouped by hostname regex in sub-collections */ @@ -354,7 +356,7 @@ private function groupRoutesByHostnameRegex(RouteCollection $routes) * Organizes the routes into a prefix tree. * * Routes order is preserved such that traversing the tree will traverse the - * routes in the origin order + * routes in the origin order. * * @param DumperCollection $collection A collection of routes * diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Route.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Route.php index 38fc3f494a95bfc3773743c9fc96b3a30bde05c3..241c8ef36eadf325b6a1c7f90d48d8d770983353 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Route.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Route.php @@ -76,11 +76,6 @@ public function __construct($pattern, array $defaults = array(), array $requirem $this->setHostnamePattern($hostnamePattern); } - public function __clone() - { - $this->compiled = null; - } - public function serialize() { return serialize(array( @@ -145,6 +140,8 @@ public function getHostnamePattern() * Sets the hostname pattern. * * @param string $pattern The pattern + * + * @return Route The current Route instance */ public function setHostnamePattern($pattern) { @@ -392,7 +389,7 @@ public function getRequirement($key) /** * Checks if a requirement is set for the given key. * - * @param string $name A variable name + * @param string $key A variable name * * @return Boolean true if a requirement is specified, false otherwise */ diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/RouteCollection.php b/core/vendor/symfony/routing/Symfony/Component/Routing/RouteCollection.php index 4716eae381ff1e176f488dd537a711a76f6e0faa..4df6f7d145edf2a5860540c003387a435ec6913d 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/RouteCollection.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/RouteCollection.php @@ -39,6 +39,7 @@ class RouteCollection implements \IteratorAggregate, \Countable /** * @var string + * @deprecated since version 2.2, will be removed in 2.3 */ private $prefix = ''; @@ -86,7 +87,7 @@ public function getRoot() /** * Gets the current RouteCollection as an Iterator that includes all routes. - * + * * It implements \IteratorAggregate. * * @see all() @@ -169,15 +170,10 @@ public function remove($name) * routes of the added collection. * * @param RouteCollection $collection A RouteCollection instance - * @param string $prefix An optional prefix to add before each pattern of the route collection - * @param array $defaults An array of default values - * @param array $requirements An array of requirements - * @param array $options An array of options - * @param string $hostnamePattern Hostname pattern * * @api */ - public function addCollection(RouteCollection $collection, $prefix = '', $defaults = array(), $requirements = array(), $options = array(), $hostnamePattern = '') + public function addCollection(RouteCollection $collection) { // This is to keep BC for getParent() and getRoot(). It does not prevent // infinite loops by recursive referencing. But we don't need that logic @@ -185,12 +181,24 @@ public function addCollection(RouteCollection $collection, $prefix = '', $defaul // the accepted range. $collection->parent = $this; - // the sub-collection must have the prefix of the parent (current instance) prepended because it does not - // necessarily already have it applied (depending on the order RouteCollections are added to each other) - $collection->addPrefix($this->getPrefix() . $prefix, $defaults, $requirements, $options); - - if ('' !== $hostnamePattern) { - $collection->setHostnamePattern($hostnamePattern); + // this is to keep BC + $numargs = func_num_args(); + if ($numargs > 1) { + $collection->addPrefix($this->prefix . func_get_arg(1)); + if ($numargs > 2) { + $collection->addDefaults(func_get_arg(2)); + if ($numargs > 3) { + $collection->addRequirements(func_get_arg(3)); + if ($numargs > 4) { + $collection->addOptions(func_get_arg(4)); + } + } + } + } else { + // the sub-collection must have the prefix of the parent (current instance) prepended because it does not + // necessarily already have it applied (depending on the order RouteCollections are added to each other) + // this will be removed when the BC layer for getPrefix() is removed + $collection->addPrefix($this->prefix); } // we need to remove all routes with the same names first because just replacing them @@ -204,32 +212,30 @@ public function addCollection(RouteCollection $collection, $prefix = '', $defaul } /** - * Adds a prefix to all routes in the current set. + * Adds a prefix to the path of all child routes. * * @param string $prefix An optional prefix to add before each pattern of the route collection * @param array $defaults An array of default values * @param array $requirements An array of requirements - * @param array $options An array of options * * @api */ - public function addPrefix($prefix, $defaults = array(), $requirements = array(), $options = array()) + public function addPrefix($prefix, array $defaults = array(), array $requirements = array()) { $prefix = trim(trim($prefix), '/'); - if ('' === $prefix && empty($defaults) && empty($requirements) && empty($options)) { + if ('' === $prefix) { return; } // a prefix must start with a single slash and must not end with a slash - if ('' !== $prefix) { - $this->prefix = '/' . $prefix . $this->prefix; - } + $this->prefix = '/' . $prefix . $this->prefix; + + // this is to keep BC + $options = func_num_args() > 3 ? func_get_arg(3) : array(); foreach ($this->routes as $route) { - if ('' !== $prefix) { - $route->setPattern('/' . $prefix . $route->getPattern()); - } + $route->setPattern('/' . $prefix . $route->getPattern()); $route->addDefaults($defaults); $route->addRequirements($requirements); $route->addOptions($options); @@ -240,6 +246,8 @@ public function addPrefix($prefix, $defaults = array(), $requirements = array(), * Returns the prefix that may contain placeholders. * * @return string The prefix + * + * @deprecated since version 2.2, will be removed in 2.3 */ public function getPrefix() { @@ -249,12 +257,64 @@ public function getPrefix() /** * Sets the hostname pattern on all routes. * - * @param string $pattern The pattern + * @param string $pattern The pattern + * @param array $defaults An array of default values + * @param array $requirements An array of requirements */ - public function setHostnamePattern($pattern) + public function setHostnamePattern($pattern, array $defaults = array(), array $requirements = array()) { foreach ($this->routes as $route) { $route->setHostnamePattern($pattern); + $route->addDefaults($defaults); + $route->addRequirements($requirements); + } + } + + /** + * Adds defaults to all routes. + * + * An existing default value under the same name in a route will be overridden. + * + * @param array $defaults An array of default values + */ + public function addDefaults(array $defaults) + { + if ($defaults) { + foreach ($this->routes as $route) { + $route->addDefaults($defaults); + } + } + } + + /** + * Adds requirements to all routes. + * + * An existing requirement under the same name in a route will be overridden. + * + * @param array $requirements An array of requirements + */ + public function addRequirements(array $requirements) + { + if ($requirements) { + foreach ($this->routes as $route) { + $route->addRequirements($requirements); + } + } + } + + /** + * Adds options to all routes. + * + * An existing option value under the same name in a route will be overridden. + * + * @param array $options An array of options + */ + public function addOptions(array $options) + { + if ($options) { + foreach ($this->routes as $route) { + $route->addOptions($options); + } } } diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/RouteCompiler.php b/core/vendor/symfony/routing/Symfony/Component/Routing/RouteCompiler.php index 4b1927166611ce45e5840bd346a70120ffbb84fc..991ce0985ba209c19c8104d41cf4f664711ca350 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/RouteCompiler.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/RouteCompiler.php @@ -131,7 +131,7 @@ private function compilePattern(Route $route, $pattern, $isHostname) if (('' !== $nextSeparator && !preg_match('#^\{\w+\}#', $followingPattern)) || '' === $followingPattern) { // When we have a separator, which is disallowed for the variable, we can optimize the regex with a possessive // quantifier. This prevents useless backtracking of PCRE and improves performance by 20% for matching those patterns. - // Given the above example, there is no point in backtracking into {page} (that forbids the dot) when a dot must follow + // Given the above example, there is no point in backtracking into {page} (that forbids the dot) when a dot must follow // after it. This optimization cannot be applied when the next char is no real separator or when the next variable is // directly adjacent, e.g. '/{x}{y}'. $regexp .= '+'; diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/missing_id.xml b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/missing_id.xml new file mode 100644 index 0000000000000000000000000000000000000000..52719be167eec10982171bda7d458eaee17f6370 --- /dev/null +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/missing_id.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<routes xmlns="http://symfony.com/schema/routing" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> + + <route pattern="/test"></route> +</routes> diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/missing_path.xml b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/missing_path.xml new file mode 100644 index 0000000000000000000000000000000000000000..ef5bc088dd003522eaa50dfa8edb0c1d9b0a9792 --- /dev/null +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/missing_path.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<routes xmlns="http://symfony.com/schema/routing" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> + + <route id="myroute"></route> +</routes> diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/namespaceprefix.xml b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/namespaceprefix.xml new file mode 100644 index 0000000000000000000000000000000000000000..efc4da9b37bc290b885c4ff77467892e49b7b775 --- /dev/null +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/namespaceprefix.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<r:routes xmlns:r="http://symfony.com/schema/routing" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> + + <r:route id="blog_show" pattern="/blog/{slug}" hostname-pattern="{_locale}.example.com"> + <r:default key="_controller">MyBundle:Blog:show</r:default> + <requirement xmlns="http://symfony.com/schema/routing" key="slug">\w+</requirement> + <r2:requirement xmlns:r2="http://symfony.com/schema/routing" key="_locale">en|fr|de</r2:requirement> + <r:option key="compiler_class">RouteCompiler</r:option> + </r:route> +</r:routes> diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/nonesense_resource_plus_path.yml b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/nonesense_resource_plus_path.yml new file mode 100644 index 0000000000000000000000000000000000000000..eba64e56bbf5c5ddde010c27c84f498b52a6357f --- /dev/null +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/nonesense_resource_plus_path.yml @@ -0,0 +1,3 @@ +blog_show: + resource: validpattern.yml + pattern: /test diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/nonesense_type_without_resource.yml b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/nonesense_type_without_resource.yml new file mode 100644 index 0000000000000000000000000000000000000000..3b4c76898bfddf2f528bc0d447c1513c89212840 --- /dev/null +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/nonesense_type_without_resource.yml @@ -0,0 +1,3 @@ +blog_show: + pattern: /blog/{slug} + type: custom diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/nonvalid2.yml b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/nonvalid2.yml new file mode 100644 index 0000000000000000000000000000000000000000..cfa9992bbc95e2f6c4400f535366e41d6ab10987 --- /dev/null +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/nonvalid2.yml @@ -0,0 +1 @@ +route: string diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php index 002d7449b8cd872e7d2195045cb829ad1b8a2945..9f5597541b4baef529185c4c39219fd90b07de98 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php @@ -11,8 +11,6 @@ namespace Symfony\Component\Routing\Tests\Loader; -use Symfony\Component\Routing\Loader\AnnotationClassLoader; - class AnnotationClassLoaderTest extends AbstractAnnotationLoaderTest { protected $loader; @@ -42,7 +40,6 @@ public function testLoadAbstractClass() } /** - * @covers Symfony\Component\Routing\Loader\AnnotationClassLoader::supports * @dataProvider provideTestSupportsChecksResource */ public function testSupportsChecksResource($resource, $expectedSupports) @@ -63,9 +60,6 @@ public function provideTestSupportsChecksResource() ); } - /** - * @covers Symfony\Component\Routing\Loader\AnnotationClassLoader::supports - */ public function testSupportsChecksTypeIfSpecified() { $this->assertTrue($this->loader->supports('class', 'annotation'), '->supports() checks the resource type if specified'); @@ -104,7 +98,7 @@ public function testLoad($className, $routeDatas = array(), $methodArgs = array( $this->reader ->expects($this->once()) ->method('getMethodAnnotations') - ->will($this->returnValue(array($this->getAnnotedRoute($routeDatas)))) + ->will($this->returnValue(array($this->getAnnotatedRoute($routeDatas)))) ; $routeCollection = $this->loader->load($className); $route = $routeCollection->get($routeDatas['name']); @@ -115,7 +109,7 @@ public function testLoad($className, $routeDatas = array(), $methodArgs = array( $this->assertSame(array_replace($routeDatas['defaults'], $methodArgs), $route->getDefaults(), '->load preserves defaults annotation'); } - private function getAnnotedRoute($datas) + private function getAnnotatedRoute($datas) { return new \Symfony\Component\Routing\Annotation\Route($datas); } diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/AnnotationDirectoryLoaderTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/AnnotationDirectoryLoaderTest.php index a8ac7331201f40a4a4d345389329405692cf455e..29126ba4f209114557db1231614663773b4ad97e 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/AnnotationDirectoryLoaderTest.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/AnnotationDirectoryLoaderTest.php @@ -40,9 +40,6 @@ public function testLoad() $this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses'); } - /** - * @covers Symfony\Component\Routing\Loader\AnnotationDirectoryLoader::supports - */ public function testSupports() { $fixturesDir = __DIR__.'/../Fixtures'; diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php index 02d0576dbbd1aa1e76332f0d42bd97ba87b33389..f0a8a0e32953994bc937a4107b98bb8d229f668c 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php @@ -34,9 +34,6 @@ public function testLoad() $this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses/FooClass.php'); } - /** - * @covers Symfony\Component\Routing\Loader\AnnotationFileLoader::supports - */ public function testSupports() { $fixture = __DIR__.'/../Fixtures/annotated.php'; diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/ClosureLoaderTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/ClosureLoaderTest.php index d9e3ff50d71ecc0b7f66c538bc5557e7c7a855bb..64d1b086ef692a49fcee25ed09149ea3d5954cef 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/ClosureLoaderTest.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/ClosureLoaderTest.php @@ -24,9 +24,6 @@ protected function setUp() } } - /** - * @covers Symfony\Component\Routing\Loader\ClosureLoader::supports - */ public function testSupports() { $loader = new ClosureLoader(); @@ -40,9 +37,6 @@ public function testSupports() $this->assertFalse($loader->supports($closure, 'foo'), '->supports() checks the resource type if specified'); } - /** - * @covers Symfony\Component\Routing\Loader\ClosureLoader::load - */ public function testLoad() { $loader = new ClosureLoader(); diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/PhpFileLoaderTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/PhpFileLoaderTest.php index 0ea7b32e1712e2c81c6464b234d42817f7b37334..3ff425d98139cd1639fd1ecc794b2c47f3d1d2c1 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/PhpFileLoaderTest.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/PhpFileLoaderTest.php @@ -13,7 +13,6 @@ use Symfony\Component\Config\FileLocator; use Symfony\Component\Routing\Loader\PhpFileLoader; -use Symfony\Component\Routing\Route; class PhpFileLoaderTest extends \PHPUnit_Framework_TestCase { @@ -24,9 +23,6 @@ protected function setUp() } } - /** - * @covers Symfony\Component\Routing\Loader\PhpFileLoader::supports - */ public function testSupports() { $loader = new PhpFileLoader($this->getMock('Symfony\Component\Config\FileLocator')); diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php index 235a9d13af4c4ed66d6d78111e45c3ba5af1ba01..17e33ef29720e9c6c7bf36b560f51f15f0845458 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php @@ -13,7 +13,6 @@ use Symfony\Component\Config\FileLocator; use Symfony\Component\Routing\Loader\XmlFileLoader; -use Symfony\Component\Routing\Route; use Symfony\Component\Routing\Tests\Fixtures\CustomXmlFileLoader; class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase @@ -25,9 +24,6 @@ protected function setUp() } } - /** - * @covers Symfony\Component\Routing\Loader\XmlFileLoader::supports - */ public function testSupports() { $loader = new XmlFileLoader($this->getMock('Symfony\Component\Config\FileLocator')); @@ -56,6 +52,21 @@ public function testLoadWithRoute() $this->assertEquals('RouteCompiler', $route->getOption('compiler_class')); } + public function testLoadWithNamespacePrefix() + { + $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); + $routeCollection = $loader->load('namespaceprefix.xml'); + + $this->assertCount(1, $routeCollection, 'One route is loaded'); + $route = $routeCollection->get('blog_show'); + $this->assertEquals('/blog/{slug}', $route->getPattern()); + $this->assertEquals('MyBundle:Blog:show', $route->getDefault('_controller')); + $this->assertEquals('\w+', $route->getRequirement('slug')); + $this->assertEquals('en|fr|de', $route->getRequirement('_locale')); + $this->assertEquals('{_locale}.example.com', $route->getHostnamePattern()); + $this->assertEquals('RouteCompiler', $route->getOption('compiler_class')); + } + public function testLoadWithImport() { $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); @@ -94,7 +105,7 @@ public function testLoadThrowsExceptionWithInvalidFileEvenWithoutSchemaValidatio public function getPathsToInvalidFiles() { - return array(array('nonvalidnode.xml'), array('nonvalidroute.xml'), array('nonvalid.xml')); + return array(array('nonvalidnode.xml'), array('nonvalidroute.xml'), array('nonvalid.xml'), array('missing_id.xml'), array('missing_path.xml')); } /** diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/YamlFileLoaderTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/YamlFileLoaderTest.php index e2e0f98eeb1e6e95510603b0ec98efd48b9a2fdd..f99e789486ad002866b127db935c56f9f70e6604 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/YamlFileLoaderTest.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/YamlFileLoaderTest.php @@ -13,7 +13,6 @@ use Symfony\Component\Config\FileLocator; use Symfony\Component\Routing\Loader\YamlFileLoader; -use Symfony\Component\Routing\Route; use Symfony\Component\Config\Resource\FileResource; class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase @@ -29,9 +28,6 @@ protected function setUp() } } - /** - * @covers Symfony\Component\Routing\Loader\YamlFileLoader::supports - */ public function testSupports() { $loader = new YamlFileLoader($this->getMock('Symfony\Component\Config\FileLocator')); @@ -54,29 +50,17 @@ public function testLoadDoesNothingIfEmpty() /** * @expectedException \InvalidArgumentException + * @dataProvider getPathsToInvalidFiles */ - public function testLoadThrowsExceptionIfNotAnArray() - { - $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); - $loader->load('nonvalid.yml'); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testLoadThrowsExceptionIfArrayHasUnsupportedKeys() + public function testLoadThrowsExceptionWithInvalidFile($filePath) { $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); - $loader->load('nonvalidkeys.yml'); + $loader->load($filePath); } - /** - * @expectedException \InvalidArgumentException - */ - public function testLoadThrowsExceptionWhenIncomplete() + public function getPathsToInvalidFiles() { - $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); - $loader->load('incomplete.yml'); + return array(array('nonvalid.yml'), array('nonvalid2.yml'), array('incomplete.yml'), array('nonvalidkeys.yml'), array('nonesense_resource_plus_path.yml'), array('nonesense_type_without_resource.yml')); } public function testLoadSpecialRouteName() @@ -121,13 +105,4 @@ public function testLoadWithResource() $this->assertEquals('bar', $routes['blog_show']->getOption('foo')); $this->assertEquals('{locale}.example.com', $routes['blog_show']->getHostnamePattern()); } - - /** - * @expectedException \InvalidArgumentException - */ - public function testParseRouteThrowsExceptionWithMissingPattern() - { - $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); - $loader->load('incomplete.yml'); - } } diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php index 64ef2d339b9af00753326af234405c027f6422b2..18e11ebcfb6df4d3239d046f2c48960a7d487da0 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php @@ -338,6 +338,22 @@ public function testDecodeOnce() $this->assertEquals(array('foo' => 'bar%23', '_route' => 'foo'), $matcher->match('/foo/bar%2523')); } + public function testCannotRelyOnPrefix() + { + $coll = new RouteCollection(); + + $subColl = new RouteCollection(); + $subColl->add('bar', new Route('/bar')); + $subColl->addPrefix('/prefix'); + // overwrite the pattern, so the prefix is not valid anymore for this route in the collection + $subColl->get('bar')->setPattern('/new'); + + $coll->addCollection($subColl); + + $matcher = new UrlMatcher($coll, new RequestContext()); + $this->assertEquals(array('_route' => 'bar'), $matcher->match('/new')); + } + public function testWithHostname() { $coll = new RouteCollection(); diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/RouteCompilerTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/RouteCompilerTest.php index 93321051a259e27fc3e657249176b13ab727a397..42d8976455f5ccda4969116c6aca4494b3cb5b1a 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/RouteCompilerTest.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/RouteCompilerTest.php @@ -225,7 +225,7 @@ public function provideCompileWithHostnameData() ), ), array( - 'Route with variable at begining of hostname', + 'Route with variable at beginning of hostname', array('/hello', array(), array(), array(), '{locale}.example.{tld}'), '/hello', '#^/hello$#s', array('locale', 'tld'), array(), array( array('text', '/hello'), diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/RouteTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/RouteTest.php index 1a11d7440e66639b8f068c9b5ae04224e9977736..c89ad5d830cb0fb7f32378bdb5e46b6ddb4d9da8 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/RouteTest.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/RouteTest.php @@ -36,7 +36,7 @@ public function testPattern() $this->assertEquals('/bar', $route->getPattern(), '->setPattern() adds a / at the beginning of the pattern if needed'); $this->assertEquals($route, $route->setPattern(''), '->setPattern() implements a fluent interface'); $route->setPattern('//path'); - $this->assertEquals('/path', $route->getPattern(), '->setPattern() does not allow two slahes "//" at the beginning of the pattern as it would be confused with a network path when generating the path from the route'); + $this->assertEquals('/path', $route->getPattern(), '->setPattern() does not allow two slashes "//" at the beginning of the pattern as it would be confused with a network path when generating the path from the route'); } public function testOptions() diff --git a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/JsonDecode.php b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/JsonDecode.php index 3cbbd03302a51417c6acb626a8b24af9898ef176..7ed8039eed878be04f7e04ecb907414b7a2225c6 100644 --- a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/JsonDecode.php +++ b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/JsonDecode.php @@ -44,6 +44,7 @@ public function getLastError() * Decodes a JSON string into PHP data * * @param string $data JSON + * @param string $format * * @return mixed */ diff --git a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/JsonEncode.php b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/JsonEncode.php index 8c5a34ba806c2d7a6c5070eebe9df04366518154..280b8a9733386b336c32230e1129d6407cc7d227 100644 --- a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/JsonEncode.php +++ b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/JsonEncode.php @@ -41,7 +41,8 @@ public function getLastError() /** * Encodes PHP data to a JSON string * - * @param mixed $data + * @param mixed $data + * @param string $format * * @return string */ diff --git a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/XmlEncoder.php b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/XmlEncoder.php index 6c0e2b5b383952856bf84e6cce93af385964720b..11de50af08aa0ad9022d5e2c81899290deef9246 100644 --- a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/XmlEncoder.php +++ b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/XmlEncoder.php @@ -243,11 +243,15 @@ private function parseXml($node) if ($key === 'item') { if (isset($value['@key'])) { - $data[(string) $value['@key']] = $value['#']; + if (isset($value['#'])) { + $data[(string) $value['@key']] = $value['#']; + } else { + $data[(string) $value['@key']] = $value; + } } else { $data['item'][] = $value; } - } elseif (array_key_exists($key, $data)) { + } elseif (array_key_exists($key, $data) || $key == "entry") { if ((false === is_array($data[$key])) || (false === isset($data[$key][0]))) { $data[$key] = array($data[$key]); } @@ -267,6 +271,8 @@ private function parseXml($node) * @param array|object $data data * * @return Boolean + * + * @throws UnexpectedValueException */ private function buildXml($parentNode, $data) { diff --git a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Serializer.php b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Serializer.php index 5bdeeada28d768d097ecb7b137a7d748fcd23952..cad6963b164f36063ea6cfd2c79dffa22343a5d5 100644 --- a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Serializer.php +++ b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Serializer.php @@ -222,6 +222,9 @@ final public function decode($data, $format) * @param string $format format name, present to give the option to normalizers to act differently based on formats * * @return array|scalar + * + * @throws LogicException + * @throws UnexpectedValueException */ private function normalizeObject($object, $format = null) { @@ -253,6 +256,9 @@ private function normalizeObject($object, $format = null) * @param string $format format name, present to give the option to normalizers to act differently based on formats * * @return object + * + * @throws LogicException + * @throws UnexpectedValueException */ private function denormalizeObject($data, $class, $format = null) { diff --git a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php index 4986f791c901abc6384b1e6063edbe59b03d9aa0..23cb0217a6be25a238bfb378c603f359c5531cd7 100644 --- a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php +++ b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php @@ -251,6 +251,39 @@ public function testDecodeArray() $this->assertEquals($expected, $this->encoder->decode($source, 'xml')); } + public function testDecodeWithoutItemHash() + { + $obj = new ScalarDummy; + $obj->xmlFoo = array( + 'foo-bar' => array( + '@key' => "value", + 'item' => array("@key" => 'key', "key-val" => 'val') + ), + 'Foo' => array( + 'Bar' => "Test", + '@Type' => 'test' + ), + 'föo_bär' => 'a', + "Bar" => array(1,2,3), + 'a' => 'b', + ); + $expected = array( + 'foo-bar' => array( + '@key' => "value", + 'key' => array('@key' => 'key', "key-val" => 'val') + ), + 'Foo' => array( + 'Bar' => "Test", + '@Type' => 'test' + ), + 'föo_bär' => 'a', + "Bar" => array(1,2,3), + 'a' => 'b', + ); + $xml = $this->encoder->encode($obj, 'xml'); + $this->assertEquals($expected, $this->encoder->decode($xml, 'xml')); + } + public function testPreventsComplexExternalEntities() { $oldCwd = getcwd(); diff --git a/core/vendor/symfony/yaml/Symfony/Component/Yaml/Dumper.php b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Dumper.php index 220cb39742569d67fcaf8d30165c8c59c4acf9dc..7193127411dfc872e709077f4bdfe0d02cc2a07d 100644 --- a/core/vendor/symfony/yaml/Symfony/Component/Yaml/Dumper.php +++ b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Dumper.php @@ -28,7 +28,7 @@ class Dumper /** * Sets the indentation. * - * @param integer $num The amount of spaces to use for intendation of nested nodes. + * @param integer $num The amount of spaces to use for indentation of nested nodes. */ public function setIndentation($num) { diff --git a/core/vendor/symfony/yaml/Symfony/Component/Yaml/Inline.php b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Inline.php index df8928577c3c8d8c49234d90ceabf57d9c0eb7fe..4ece8472b57164ff84796a123e1bf6b7bb8093f8 100644 --- a/core/vendor/symfony/yaml/Symfony/Component/Yaml/Inline.php +++ b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Inline.php @@ -28,6 +28,8 @@ class Inline * @param string $value A YAML string * * @return array A PHP array representing the YAML string + * + * @throws ParseException */ public static function parse($value) { @@ -400,9 +402,11 @@ private static function evaluateScalar($scalar) } /** - * Gets a regex that matches an unix timestamp + * Gets a regex that matches a YAML date. * * @return string The regular expression + * + * @see http://www.yaml.org/spec/1.2/spec.html#id2761573 */ private static function getTimestampRegex() { diff --git a/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/InlineTest.php b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/InlineTest.php index 2684fa557eb8197a9ba78ac6477175884d2082ab..9733426a3e4cc03d6da85b197f0baa4396cd15e5 100644 --- a/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/InlineTest.php +++ b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/InlineTest.php @@ -127,6 +127,8 @@ protected function getTestsForParse() '2007-10-30' => mktime(0, 0, 0, 10, 30, 2007), '2007-10-30T02:59:43Z' => gmmktime(2, 59, 43, 10, 30, 2007), '2007-10-30 02:59:43 Z' => gmmktime(2, 59, 43, 10, 30, 2007), + '1960-10-30 02:59:43 Z' => gmmktime(2, 59, 43, 10, 30, 1960), + '1730-10-30T02:59:43Z' => gmmktime(2, 59, 43, 10, 30, 1730), '"a \\"string\\" with \'quoted strings inside\'"' => 'a "string" with \'quoted strings inside\'', "'a \"string\" with ''quoted strings inside'''" => 'a "string" with \'quoted strings inside\'',