diff --git a/core/composer.json b/core/composer.json index 6d930cc2927d14b1f4cd98af836e2e0d6d9d5f22..7935ddb1afc3e1e358926ee811cef3cfa59f7f5b 100644 --- a/core/composer.json +++ b/core/composer.json @@ -8,7 +8,7 @@ "symfony/routing": "2.1.*", "symfony/yaml": "2.1.*", "twig/twig": "1.8.*", - "doctrine/common": "2.2.*" + "doctrine/common": "2.3.*" }, "minimum-stability": "beta" } diff --git a/core/composer.lock b/core/composer.lock index e803ae3c8345c072b8b4563130d895332a7677fc..5469ca84e37eed04f7bf27609bba3433a2dec4f3 100644 --- a/core/composer.lock +++ b/core/composer.lock @@ -1,37 +1,37 @@ { - "hash": "2ea132b64c01235b70e9fb16c528ea0e", + "hash": "be2e79923e2be0777a9f60ec185168a8", "packages": [ { "package": "doctrine/common", - "version": "2.2.2" + "version": "2.3.0-RC1" }, { "package": "symfony/class-loader", - "version": "v2.1.0-BETA1" + "version": "v2.1.0-RC1" }, { "package": "symfony/dependency-injection", - "version": "v2.1.0-BETA1" + "version": "v2.1.0-RC1" }, { "package": "symfony/event-dispatcher", - "version": "v2.1.0-BETA1" + "version": "v2.1.0-RC1" }, { "package": "symfony/http-foundation", - "version": "v2.1.0-BETA1" + "version": "v2.1.0-RC1" }, { "package": "symfony/http-kernel", - "version": "v2.1.0-BETA1" + "version": "v2.1.0-RC1" }, { "package": "symfony/routing", - "version": "v2.1.0-BETA1" + "version": "v2.1.0-RC1" }, { "package": "symfony/yaml", - "version": "v2.1.0-BETA1" + "version": "v2.1.0-RC1" }, { "package": "twig/twig", diff --git a/core/includes/common.inc b/core/includes/common.inc index e4e00d646ff51a83fbaf56c9a4a05ddfbc1f093f..dd7a8e2a56c74841b4b5e1eb8e864d78c186e6b6 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -4962,9 +4962,14 @@ function _drupal_bootstrap_full($skip = FALSE) { * Page compression requires the PHP zlib extension * (http://php.net/manual/ref.zlib.php). * + * @param $body + * The response body. + * @return + * The cached object or NULL if the page cache was not set. + * * @see drupal_page_header() */ -function drupal_page_set_cache() { +function drupal_page_set_cache($body) { global $base_root; if (drupal_page_is_cacheable()) { @@ -4972,7 +4977,7 @@ function drupal_page_set_cache() { 'cid' => $base_root . request_uri(), 'data' => array( 'path' => current_path(), - 'body' => ob_get_clean(), + 'body' => $body, 'title' => drupal_get_title(), 'headers' => array(), ), diff --git a/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php index 6e23845750a3b0c96daf5f72dcec41b203d11856..bd5446346d41d4a9634b54f2e5ac55d4769907cc 100644 --- a/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php @@ -66,8 +66,18 @@ public function onRespond(FilterResponseEvent $event) { // @todo Revisit whether or not this is still appropriate now that the // Response object does its own cache control procesisng and we intend to // use partial page caching more extensively. - $response->headers->set('Expires', 'Sun, 19 Nov 1978 05:00:00 GMT'); - $response->headers->set('Cache-Control', 'no-cache, must-revalidate, post-check=0, pre-check=0'); + // Commit the user session, if needed. + drupal_session_commit(); + if (config('system.performance')->get('cache') && ($cache = drupal_page_set_cache($response->getContent()))) { + drupal_serve_page_from_cache($cache); + // drupal_serve_page_from_cache() already printed the response. + $response->setContent(''); + $response->headers->remove('cache-control'); + } + else { + $response->headers->set('Expires', 'Sun, 19 Nov 1978 05:00:00 GMT'); + $response->headers->set('Cache-Control', 'no-cache, must-revalidate, post-check=0, pre-check=0'); + } } /** diff --git a/core/lib/Drupal/Core/EventSubscriber/RequestCloseSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/RequestCloseSubscriber.php index bae06fe715aea5fe79e1be3cb073f3506fe65d66..6ca39db49c6c4e16cd9df23bf4a9c4ba31f06199 100644 --- a/core/lib/Drupal/Core/EventSubscriber/RequestCloseSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/RequestCloseSubscriber.php @@ -28,32 +28,7 @@ class RequestCloseSubscriber implements EventSubscriberInterface { * The Event to process. */ public function onTerminate(PostResponseEvent $event) { - global $user; - module_invoke_all('exit'); - - // Commit the user session, if needed. - drupal_session_commit(); - $response = $event->getResponse(); - $config = config('system.performance'); - - if ($config->get('cache') && ($cache = drupal_page_set_cache())) { - drupal_serve_page_from_cache($cache); - } - else { - // This listener will be run in all cases, including when sending an HTTP - // redirect code. In this particular case, PHP output buffer has not been - // initialized yet and won't be, calling the ob_end_flush() method would - // throw PHP warnings. - // See http://www.php.net/manual/en/function.ob-end-flush.php#42979 - while (ob_get_level() > 0) { - // Using ob_end_flush() instead of ob_flush() will close the output - // buffer. This means that potential later errors won't get to the user - // and the HTTPd might release the connection sooner. - ob_end_flush(); - } - } - _registry_check_code(REGISTRY_WRITE_LOOKUP_CACHE); drupal_cache_system_paths(); module_implements_write_cache(); diff --git a/core/modules/system/lib/Drupal/system/Tests/Bootstrap/PageCacheTest.php b/core/modules/system/lib/Drupal/system/Tests/Bootstrap/PageCacheTest.php index af6bf6cd7c00ba4f9c6c504a43c7bc409fe01fd5..4a0cfb76a5096bb742448e27d8eee211cb870d0c 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Bootstrap/PageCacheTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Bootstrap/PageCacheTest.php @@ -41,6 +41,8 @@ function testConditionalRequests() { // Fill the cache. $this->drupalGet(''); + // Verify the page is not printed twice when the cache is cold. + $this->assertNoPattern('#<html.*<html#'); $this->drupalHead(''); $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', t('Page was cached.')); @@ -57,6 +59,8 @@ function testConditionalRequests() { $this->assertResponse(304, t('Conditional request with obsolete If-Modified-Since date returned 304 Not Modified.')); $this->drupalGet('', array(), array('If-Modified-Since: ' . $last_modified)); + // Verify the page is not printed twice when the cache is warm. + $this->assertNoPattern('#<html.*<html#'); $this->assertResponse(200, t('Conditional request without If-None-Match returned 200 OK.')); $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', t('Page was cached.')); diff --git a/core/modules/system/lib/Drupal/system/Tests/Theme/FastTest.php b/core/modules/system/lib/Drupal/system/Tests/Theme/FastTest.php index c4a71ff6ac1bc7c3f459631e4457d932988cf6ee..3a65e999784b15ddf1fad19d1979b87ecb41dc71 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Theme/FastTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Theme/FastTest.php @@ -32,6 +32,7 @@ function setUp() { function testUserAutocomplete() { $this->drupalLogin($this->account); $this->drupalGet('user/autocomplete/' . $this->account->name); - $this->assertText('registry not initialized', t('The registry was not initialized')); + $this->assertRaw($this->account->name); + $this->assertNoText('registry initialized', t('The registry was not initialized')); } } diff --git a/core/modules/system/tests/modules/theme_test/theme_test.module b/core/modules/system/tests/modules/theme_test/theme_test.module index 59ff62950eaeca59d7b8437b350c0693eee0faaf..6187361517cf108793e3b7937e49de1cfe71a87e 100644 --- a/core/modules/system/tests/modules/theme_test/theme_test.module +++ b/core/modules/system/tests/modules/theme_test/theme_test.module @@ -76,17 +76,10 @@ function theme_test_init() { // still capable of returning output and theming the page as a whole. $GLOBALS['theme_test_output'] = theme('more_link', array('url' => 'user', 'title' => 'Themed output generated in hook_init()')); } -} - -/** - * Implements hook_exit(). - */ -function theme_test_exit() { - if (arg(0) == 'user') { + if (arg(0) == 'user' && arg(1) == 'autocomplete') { // Register a fake registry loading callback. If it gets called by // theme_get_registry(), the registry has not been initialized yet. _theme_registry_callback('_theme_test_load_registry', array()); - print theme_get_registry() ? 'registry initialized' : 'registry not initialized'; } } @@ -94,6 +87,7 @@ function theme_test_exit() { * Fake registry loading callback. */ function _theme_test_load_registry() { + print 'registry initialized'; return array(); } diff --git a/core/vendor/composer/autoload_namespaces.php b/core/vendor/composer/autoload_namespaces.php index e7a0e60ac997817fe798da97b1cd38a1876ec4c4..f3cf2d6ae3d9442498fc85d4b20c8a0478f0d782 100644 --- a/core/vendor/composer/autoload_namespaces.php +++ b/core/vendor/composer/autoload_namespaces.php @@ -14,5 +14,6 @@ 'Symfony\\Component\\EventDispatcher' => $vendorDir . '/symfony/event-dispatcher/', 'Symfony\\Component\\DependencyInjection' => $vendorDir . '/symfony/dependency-injection/', 'Symfony\\Component\\ClassLoader' => $vendorDir . '/symfony/class-loader/', + 'SessionHandlerInterface' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Resources/stubs', 'Doctrine\\Common' => $vendorDir . '/doctrine/common/lib/', ); diff --git a/core/vendor/composer/installed.json b/core/vendor/composer/installed.json index 2e358270e21ca20f3409766b256716e9c02ad5dc..51054e45c3232bf0488069a3b306624176e9e8ca 100644 --- a/core/vendor/composer/installed.json +++ b/core/vendor/composer/installed.json @@ -3,7 +3,7 @@ "name": "twig/twig", "version": "v1.8.3", "version_normalized": "1.8.3.0", - "time": "2012-06-18 01:48:16", + "time": "2012-06-18 15:48:16", "source": { "type": "git", "url": "git://github.com/fabpot/Twig.git", @@ -54,29 +54,34 @@ } }, { - "name": "symfony/dependency-injection", - "version": "v2.1.0-BETA1", - "version_normalized": "2.1.0.0-beta1", - "target-dir": "Symfony/Component/DependencyInjection", - "time": "2012-06-12 18:59:42", + "name": "symfony/class-loader", + "version": "v2.1.0-RC1", + "version_normalized": "2.1.0.0-RC1", + "target-dir": "Symfony/Component/ClassLoader", + "time": "2012-07-15 17:13:51", "source": { "type": "git", - "url": "https://github.com/symfony/DependencyInjection", - "reference": "v2.1.0-BETA1" + "url": "https://github.com/symfony/ClassLoader", + "reference": "v2.1.0-RC1" }, "dist": { "type": "zip", - "url": "https://github.com/symfony/DependencyInjection/zipball/v2.1.0-BETA1", - "reference": "v2.1.0-BETA1", + "url": "https://github.com/symfony/ClassLoader/zipball/v2.1.0-RC1", + "reference": "v2.1.0-RC1", "shasum": "" }, "require": { - "php": ">=5.3.2" + "php": ">=5.3.3" }, - "suggest": { - "symfony/yaml": "v2.1.0-BETA1" + "require-dev": { + "symfony/finder": "2.1.*" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, "installation-source": "dist", "license": [ "MIT" @@ -95,35 +100,48 @@ "role": null } ], - "description": "Symfony DependencyInjection Component", + "description": "Symfony ClassLoader Component", "homepage": "http://symfony.com", "autoload": { "psr-0": { - "Symfony\\Component\\DependencyInjection": "" + "Symfony\\Component\\ClassLoader": "" } } }, { - "name": "symfony/event-dispatcher", - "version": "v2.1.0-BETA1", - "version_normalized": "2.1.0.0-beta1", - "target-dir": "Symfony/Component/EventDispatcher", - "time": "2012-05-15 23:56:32", + "name": "symfony/dependency-injection", + "version": "v2.1.0-RC1", + "version_normalized": "2.1.0.0-RC1", + "target-dir": "Symfony/Component/DependencyInjection", + "time": "2012-08-03 19:44:30", "source": { "type": "git", - "url": "https://github.com/symfony/EventDispatcher", - "reference": "v2.1.0-BETA1" + "url": "https://github.com/symfony/DependencyInjection", + "reference": "v2.1.0-RC1" }, "dist": { "type": "zip", - "url": "https://github.com/symfony/EventDispatcher/zipball/v2.1.0-BETA1", - "reference": "v2.1.0-BETA1", + "url": "https://github.com/symfony/DependencyInjection/zipball/v2.1.0-RC1", + "reference": "v2.1.0-RC1", "shasum": "" }, "require": { - "php": ">=5.3.2" + "php": ">=5.3.3" + }, + "require-dev": { + "symfony/yaml": "2.1.*", + "symfony/config": "2.1.*" + }, + "suggest": { + "symfony/yaml": "v2.1.0-RC1", + "symfony/config": "v2.1.0-RC1" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, "installation-source": "dist", "license": [ "MIT" @@ -142,35 +160,40 @@ "role": null } ], - "description": "Symfony EventDispatcher Component", + "description": "Symfony DependencyInjection Component", "homepage": "http://symfony.com", "autoload": { "psr-0": { - "Symfony\\Component\\EventDispatcher": "" + "Symfony\\Component\\DependencyInjection": "" } } }, { "name": "symfony/http-foundation", - "version": "v2.1.0-BETA1", - "version_normalized": "2.1.0.0-beta1", + "version": "v2.1.0-RC1", + "version_normalized": "2.1.0.0-RC1", "target-dir": "Symfony/Component/HttpFoundation", - "time": "2012-06-12 13:10:53", + "time": "2012-08-04 16:18:38", "source": { "type": "git", "url": "https://github.com/symfony/HttpFoundation", - "reference": "v2.1.0-BETA1" + "reference": "v2.1.0-RC1" }, "dist": { "type": "zip", - "url": "https://github.com/symfony/HttpFoundation/zipball/v2.1.0-BETA1", - "reference": "v2.1.0-BETA1", + "url": "https://github.com/symfony/HttpFoundation/zipball/v2.1.0-RC1", + "reference": "v2.1.0-RC1", "shasum": "" }, "require": { - "php": ">=5.3.2" + "php": ">=5.3.3" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, "installation-source": "dist", "license": [ "MIT" @@ -193,41 +216,44 @@ "homepage": "http://symfony.com", "autoload": { "psr-0": { - "Symfony\\Component\\HttpFoundation": "" + "Symfony\\Component\\HttpFoundation": "", + "SessionHandlerInterface": "Symfony/Component/HttpFoundation/Resources/stubs" } } }, { - "name": "symfony/http-kernel", - "version": "v2.1.0-BETA1", - "version_normalized": "2.1.0.0-beta1", - "target-dir": "Symfony/Component/HttpKernel", - "time": "2012-06-12 18:59:42", + "name": "symfony/event-dispatcher", + "version": "v2.1.0-RC1", + "version_normalized": "2.1.0.0-RC1", + "target-dir": "Symfony/Component/EventDispatcher", + "time": "2012-07-20 06:18:14", "source": { "type": "git", - "url": "https://github.com/symfony/HttpKernel", - "reference": "v2.1.0-BETA1" + "url": "https://github.com/symfony/EventDispatcher", + "reference": "v2.1.0-RC1" }, "dist": { "type": "zip", - "url": "https://github.com/symfony/HttpKernel/zipball/v2.1.0-BETA1", - "reference": "v2.1.0-BETA1", + "url": "https://github.com/symfony/EventDispatcher/zipball/v2.1.0-RC1", + "reference": "v2.1.0-RC1", "shasum": "" }, "require": { - "php": ">=5.3.2", - "symfony/event-dispatcher": "self.version", - "symfony/http-foundation": "self.version" + "php": ">=5.3.3" + }, + "require-dev": { + "symfony/dependency-injection": "2.1.*" }, "suggest": { - "symfony/browser-kit": "v2.1.0-BETA1", - "symfony/class-loader": "v2.1.0-BETA1", - "symfony/config": "v2.1.0-BETA1", - "symfony/console": "v2.1.0-BETA1", - "symfony/dependency-injection": "v2.1.0-BETA1", - "symfony/finder": "v2.1.0-BETA1" + "symfony/dependency-injection": "v2.1.0-RC1", + "symfony/http-kernel": "v2.1.0-RC1" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, "installation-source": "dist", "license": [ "MIT" @@ -246,39 +272,60 @@ "role": null } ], - "description": "Symfony HttpKernel Component", + "description": "Symfony EventDispatcher Component", "homepage": "http://symfony.com", "autoload": { "psr-0": { - "Symfony\\Component\\HttpKernel": "" + "Symfony\\Component\\EventDispatcher": "" } } }, { - "name": "symfony/routing", - "version": "v2.1.0-BETA1", - "version_normalized": "2.1.0.0-beta1", - "target-dir": "Symfony/Component/Routing", - "time": "2012-06-12 18:59:42", + "name": "symfony/http-kernel", + "version": "v2.1.0-RC1", + "version_normalized": "2.1.0.0-RC1", + "target-dir": "Symfony/Component/HttpKernel", + "time": "2012-08-04 16:32:21", "source": { "type": "git", - "url": "https://github.com/symfony/Routing", - "reference": "v2.1.0-BETA1" + "url": "https://github.com/symfony/HttpKernel", + "reference": "v2.1.0-RC1" }, "dist": { "type": "zip", - "url": "https://github.com/symfony/Routing/zipball/v2.1.0-BETA1", - "reference": "v2.1.0-BETA1", + "url": "https://github.com/symfony/HttpKernel/zipball/v2.1.0-RC1", + "reference": "v2.1.0-RC1", "shasum": "" }, "require": { - "php": ">=5.3.2" + "php": ">=5.3.3", + "symfony/event-dispatcher": "2.1.*", + "symfony/http-foundation": "2.1.*" + }, + "require-dev": { + "symfony/browser-kit": "2.1.*", + "symfony/class-loader": "2.1.*", + "symfony/config": "2.1.*", + "symfony/console": "2.1.*", + "symfony/dependency-injection": "2.1.*", + "symfony/finder": "2.1.*", + "symfony/process": "2.1.*", + "symfony/routing": "2.1.*" }, "suggest": { - "symfony/config": "v2.1.0-BETA1", - "symfony/yaml": "v2.1.0-BETA1" + "symfony/browser-kit": "v2.1.0-RC1", + "symfony/class-loader": "v2.1.0-RC1", + "symfony/config": "v2.1.0-RC1", + "symfony/console": "v2.1.0-RC1", + "symfony/dependency-injection": "v2.1.0-RC1", + "symfony/finder": "v2.1.0-RC1" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, "installation-source": "dist", "license": [ "MIT" @@ -297,35 +344,51 @@ "role": null } ], - "description": "Symfony Routing Component", + "description": "Symfony HttpKernel Component", "homepage": "http://symfony.com", "autoload": { "psr-0": { - "Symfony\\Component\\Routing": "" + "Symfony\\Component\\HttpKernel": "" } } }, { - "name": "symfony/yaml", - "version": "v2.1.0-BETA1", - "version_normalized": "2.1.0.0-beta1", - "target-dir": "Symfony/Component/Yaml", - "time": "2012-06-09 22:04:17", + "name": "symfony/routing", + "version": "v2.1.0-RC1", + "version_normalized": "2.1.0.0-RC1", + "target-dir": "Symfony/Component/Routing", + "time": "2012-07-31 21:14:37", "source": { "type": "git", - "url": "https://github.com/symfony/Yaml", - "reference": "v2.1.0-BETA1" + "url": "https://github.com/symfony/Routing", + "reference": "v2.1.0-RC1" }, "dist": { "type": "zip", - "url": "https://github.com/symfony/Yaml/zipball/v2.1.0-BETA1", - "reference": "v2.1.0-BETA1", + "url": "https://github.com/symfony/Routing/zipball/v2.1.0-RC1", + "reference": "v2.1.0-RC1", "shasum": "" }, "require": { - "php": ">=5.3.2" + "php": ">=5.3.3" + }, + "require-dev": { + "symfony/config": "2.1.*", + "symfony/yaml": "2.1.*", + "symfony/http-kernel": "2.1.*", + "doctrine/common": ">=2.2,<2.4-dev" + }, + "suggest": { + "symfony/config": "v2.1.0-RC1", + "symfony/yaml": "v2.1.0-RC1", + "doctrine/common": ">=2.2,<2.4-dev" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, "installation-source": "dist", "license": [ "MIT" @@ -344,35 +407,40 @@ "role": null } ], - "description": "Symfony Yaml Component", + "description": "Symfony Routing Component", "homepage": "http://symfony.com", "autoload": { "psr-0": { - "Symfony\\Component\\Yaml": "" + "Symfony\\Component\\Routing": "" } } }, { - "name": "symfony/class-loader", - "version": "v2.1.0-BETA1", - "version_normalized": "2.1.0.0-beta1", - "target-dir": "Symfony/Component/ClassLoader", - "time": "2012-04-23 12:37:21", + "name": "symfony/yaml", + "version": "v2.1.0-RC1", + "version_normalized": "2.1.0.0-RC1", + "target-dir": "Symfony/Component/Yaml", + "time": "2012-07-15 17:13:51", "source": { "type": "git", - "url": "https://github.com/symfony/ClassLoader", - "reference": "v2.1.0-BETA1" + "url": "https://github.com/symfony/Yaml", + "reference": "v2.1.0-RC1" }, "dist": { "type": "zip", - "url": "https://github.com/symfony/ClassLoader/zipball/v2.1.0-BETA1", - "reference": "v2.1.0-BETA1", + "url": "https://github.com/symfony/Yaml/zipball/v2.1.0-RC1", + "reference": "v2.1.0-RC1", "shasum": "" }, "require": { - "php": ">=5.3.2" + "php": ">=5.3.3" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, "installation-source": "dist", "license": [ "MIT" @@ -391,37 +459,42 @@ "role": null } ], - "description": "Symfony ClassLoader Component", + "description": "Symfony Yaml Component", "homepage": "http://symfony.com", "autoload": { "psr-0": { - "Symfony\\Component\\ClassLoader": "" + "Symfony\\Component\\Yaml": "" } } }, { "name": "doctrine/common", - "version": "2.2.2", - "version_normalized": "2.2.2.0", - "time": "2012-04-13 07:46:44", + "version": "2.3.0-RC1", + "version_normalized": "2.3.0.0-RC1", + "time": "2012-07-29 10:44:28", "source": { "type": "git", "url": "https://github.com/doctrine/common", - "reference": "2.2.2" + "reference": "2.3.0-RC1" }, "dist": { "type": "zip", - "url": "https://github.com/doctrine/common/zipball/2.2.2", - "reference": "2.2.2", + "url": "https://github.com/doctrine/common/zipball/2.3.0-RC1", + "reference": "2.3.0-RC1", "shasum": "" }, "require": { "php": ">=5.3.2" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3.x-dev" + } + }, "installation-source": "dist", "license": [ - "LGPL" + "MIT" ], "authors": [ { diff --git a/core/vendor/doctrine/common/.travis.yml b/core/vendor/doctrine/common/.travis.yml index 4464d4f7900b6e3b1f55ff09a94bc68fe0282315..fc0505634391ada3bddae3ea065e5ae7a5ea6b33 100644 --- a/core/vendor/doctrine/common/.travis.yml +++ b/core/vendor/doctrine/common/.travis.yml @@ -1,5 +1,10 @@ language: php +env: + - OPCODE_CACHE=apc + php: - 5.3 - 5.4 + +before_script: php ./bin/travis-setup.php $OPCODE_CACHE \ No newline at end of file diff --git a/core/vendor/doctrine/common/LICENSE b/core/vendor/doctrine/common/LICENSE index 1c03f74b99009a408313d614d47e4074ac7ce4be..4a91f0bf2803d308cce8010164548a811127bc27 100644 --- a/core/vendor/doctrine/common/LICENSE +++ b/core/vendor/doctrine/common/LICENSE @@ -1,504 +1,19 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - <one line to give the library's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - <signature of Ty Coon>, 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - +Copyright (c) 2006-2012 Doctrine Project + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/core/vendor/doctrine/common/bin/travis-setup.php b/core/vendor/doctrine/common/bin/travis-setup.php new file mode 100644 index 0000000000000000000000000000000000000000..e9c355ae7c8cccccc5dac4198a1b16d5c71ae3c4 --- /dev/null +++ b/core/vendor/doctrine/common/bin/travis-setup.php @@ -0,0 +1,141 @@ +<?php +/* + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This software consists of voluntary contributions made by many individuals + * and is licensed under the LGPL. For more information, see + * <http://www.doctrine-project.org>. + */ + +/** + * Install PHP extensions required for testing by Travis CI. + * + * @author Victor Berchet <victor@suumit.com> + * @since 2.2 + */ +$installer = new PhpExtensions(); + +if (isset($argv[1]) && 'APC' === strtoupper($argv[1])) { + $installer->install('apc'); +} else { + $installer->install('xcache'); +} + +$installer->install('memcache'); +$installer->install('memcached'); + +class PhpExtensions +{ + protected $extensions; + protected $phpVersion; + protected $iniPath; + + public function __construct() + { + $this->phpVersion = phpversion(); + $this->iniPath = php_ini_loaded_file(); + $this->extensions = array( + 'memcache' => array( + 'url' => 'http://pecl.php.net/get/memcache-2.2.6.tgz', + 'php_version' => array(), + 'cfg' => array('--enable-memcache'), + 'ini' => array('extension=memcache.so'), + ), + 'memcached' => array( + 'url' => 'http://pecl.php.net/get/memcached-1.0.2.tgz', + 'php_version' => array( + // memcached 1.0.2 does not build on PHP 5.4 + array('<', '5.4'), + ), + 'cfg' => array(), + 'ini' => array('extension=memcached.so'), + ), + 'apc' => array( + 'url' => 'http://pecl.php.net/get/APC-3.1.9.tgz', + 'php_version' => array( + // apc 3.1.9 causes a segfault on PHP 5.4 + array('<', '5.4'), + ), + 'cfg' => array(), + 'ini' => array( + 'extension=apc.so', + 'apc.enabled=1', + 'apc.enable_cli=1' + ), + ), + 'xcache' => array( + 'url' => 'http://xcache.lighttpd.net/pub/Releases/1.2.2/xcache-1.2.2.tar.gz', + 'php_version' => array( + // xcache does not build with Travis CI (as of 2012-01-09) + array('<', '5'), + ), + 'cfg' => array('--enable-xcache'), + 'ini' => array( + 'extension=xcache.so', + 'xcache.cacher=false', + 'xcache.admin.enable_auth=0', + 'xcache.var_size=1M', + ), + ), + ); + } + + public function install($name) + { + if (array_key_exists($name, $this->extensions)) { + $extension = $this->extensions[$name]; + + + echo "== extension: $name ==\n"; + + foreach ($extension['php_version'] as $version) { + if (!version_compare($this->phpVersion, $version[1], $version[0])) { + printf( + "=> not installed, requires a PHP version %s %s (%s installed)\n", + $version[0], + $version[1], + $this->phpVersion + ); + + return; + } + } + + $this->system(sprintf("wget %s > /dev/null 2>&1", $extension['url'])); + $file = basename($extension['url']); + $this->system(sprintf("tar -xzf %s > /dev/null 2>&1", $file)); + $folder = basename($file, ".tgz"); + $folder = basename($folder, ".tar.gz"); + $this->system(sprintf( + 'sh -c "cd %s && phpize && ./configure %s && make && sudo make install" > /dev/null 2>&1', + $folder, + implode(' ', $extension['cfg']) + )); + foreach ($extension['ini'] as $ini) { + $this->system(sprintf("echo %s >> %s", $ini, $this->iniPath)); + } + printf("=> installed (%s)\n", $folder); + } + } + + private function system($cmd) + { + $ret = 0; + system($cmd, $ret); + if (0 !== $ret) { + printf("=> Command '%s' failed !", $cmd); + + exit($ret); + } + } +} diff --git a/core/vendor/doctrine/common/composer.json b/core/vendor/doctrine/common/composer.json index 7780d93d617fb307f2ab2144765374cb790e6f61..c513315d2e70fda0c0fac1aaf20a81c21c179ee4 100644 --- a/core/vendor/doctrine/common/composer.json +++ b/core/vendor/doctrine/common/composer.json @@ -1,10 +1,10 @@ { "name": "doctrine/common", - "type": "library","version":"2.2.2", + "type": "library","version":"2.3.0-RC1", "description": "Common Library for Doctrine projects", "keywords": ["collections", "spl", "eventmanager", "annotations", "persistence"], "homepage": "http://www.doctrine-project.org", - "license": "LGPL", + "license": "MIT", "authors": [ {"name": "Guilherme Blanco", "email": "guilhermeblanco@gmail.com"}, {"name": "Roman Borschel", "email": "roman@code-factory.org"}, @@ -17,5 +17,10 @@ }, "autoload": { "psr-0": { "Doctrine\\Common": "lib/" } + }, + "extra": { + "branch-alias": { + "dev-master": "2.3.x-dev" + } } } diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation.php index 625125220f79c35693741a35e26c8923a89cebfa..6a1390af882fa8712cbcc30a9d0f568fb0642630 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -52,6 +52,8 @@ public final function __construct(array $data) * Error handler for unknown property accessor in Annotation class. * * @param string $name Unknown property name + * + * @throws \BadMethodCallException */ public function __get($name) { @@ -65,6 +67,8 @@ public function __get($name) * * @param string $name Unkown property name * @param mixed $value Property value + * + * @throws \BadMethodCallException */ public function __set($name, $value) { @@ -72,4 +76,4 @@ public function __set($name, $value) sprintf("Unknown property '%s' on annotation '%s'.", $name, get_class($this)) ); } -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/Attribute.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/Attribute.php index 21597b14c9f6c96848b6f810e3280a0f34c498e5..dbef6df087497cecf043dcdac40f95ffb5551fa0 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/Attribute.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/Attribute.php @@ -14,7 +14,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -44,4 +44,4 @@ final class Attribute * @var boolean */ public $required = false; -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/Attributes.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/Attributes.php index 6e314be463c6bd27d9bf5c427010070c5fdfdeb2..53134e3097af6c5dc95695b478d53282f2455604 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/Attributes.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/Attributes.php @@ -14,7 +14,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -34,4 +34,4 @@ final class Attributes * @var array<Doctrine\Common\Annotations\Annotation\Attribute> */ public $value; -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/IgnoreAnnotation.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/IgnoreAnnotation.php index 1b2b20ac194543b5b8f9cd611e6cee4ce4c66849..a84a4f516e9291ed85ce7341ba9002b9bb1d55d5 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/IgnoreAnnotation.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/IgnoreAnnotation.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -28,8 +28,18 @@ */ final class IgnoreAnnotation { + /** + * @var array + */ public $names; + /** + * Constructor + * + * @param array $values + * + * @throws \RuntimeException + */ public function __construct(array $values) { if (is_string($values['value'])) { @@ -41,4 +51,4 @@ public function __construct(array $values) $this->names = $values['value']; } -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/Required.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/Required.php index 7b89a02288f469bbf55dd950d0dc2220815f2370..d67f9606879fdaa1bf1f9181ee90081a839b6510 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/Required.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/Required.php @@ -14,7 +14,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -30,4 +30,4 @@ */ final class Required { -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/Target.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/Target.php index c41896add0b7943ae86a4cce029ecdc1043eb89d..64655ef61bbc4b9b5b2cef72555cdefd056d6e82 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/Target.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/Target.php @@ -14,7 +14,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -70,6 +70,8 @@ final class Target * Annotation construct * * @param array $values + * + * @throws \InvalidArgumentException */ public function __construct(array $values) { @@ -102,4 +104,4 @@ public function __construct(array $values) $this->value = $values['value']; $this->literal = implode(', ', $this->value); } -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/AnnotationException.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/AnnotationException.php index fdc1913a1281716874a0ea727c5329c268f0c25a..109beeb96d564fa9a3a94d429854356b7a0bcd54 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/AnnotationException.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/AnnotationException.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -52,6 +52,22 @@ public static function semanticalError($message) return new self('[Semantical Error] ' . $message); } + /** + * Creates a new AnnotationException describing a constant semantical error. + * + * @since 2.3 + * @param string $identifier + * @param string $context + * @return AnnotationException + */ + public static function semanticalErrorConstants($identifier, $context = null) + { + return self::semanticalError(sprintf( + "Couldn't find constant %s%s", $identifier, + $context ? ", $context." : "." + )); + } + /** * Creates a new AnnotationException describing an error which occurred during * the creation of the annotation. @@ -108,4 +124,4 @@ public static function requiredError($attributeName, $annotationName, $context, $expected )); } -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/AnnotationReader.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/AnnotationReader.php index dda8b231f18d29a768434ec1e4463d20cbec9008..5a1d2538500b22526156de6af92c6a2dcd0e32de 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/AnnotationReader.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/AnnotationReader.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -35,7 +35,7 @@ * @author Roman Borschel <roman@code-factory.org> * @author Johannes M. Schmitt <schmittjoh@gmail.com> */ -final class AnnotationReader implements Reader +class AnnotationReader implements Reader { /** * Global map for imports. @@ -60,14 +60,15 @@ final class AnnotationReader implements Reader 'subpackage'=> true, 'name'=> true, 'global'=> true, 'param'=> true, 'return'=> true, 'staticvar'=> true, 'category'=> true, 'staticVar'=> true, 'static'=> true, 'var'=> true, 'throws'=> true, 'inheritdoc'=> true, - 'inheritDoc'=> true, 'license'=> true, 'todo'=> true, 'deprecated'=> true, - 'deprec'=> true, 'author'=> true, 'property' => true, 'method' => true, + 'inheritDoc'=> true, 'license'=> true, 'todo'=> true, + 'deprec'=> true, 'property' => true, 'method' => true, 'abstract'=> true, 'exception'=> true, 'magic' => true, 'api' => true, 'final'=> true, 'filesource'=> true, 'throw' => true, 'uses' => true, 'usedby'=> true, 'private' => true, 'Annotation' => true, 'override' => true, 'codeCoverageIgnore' => true, 'codeCoverageIgnoreStart' => true, 'codeCoverageIgnoreEnd' => true, 'Required' => true, 'Attribute' => true, 'Attributes' => true, 'Target' => true, 'SuppressWarnings' => true, + 'ingroup' => true, 'code' => true, 'endcode' => true ); /** @@ -83,21 +84,21 @@ static public function addGlobalIgnoredName($name) /** * Annotations Parser * - * @var Doctrine\Common\Annotations\DocParser + * @var \Doctrine\Common\Annotations\DocParser */ private $parser; /** * Annotations Parser used to collect parsing metadata * - * @var Doctrine\Common\Annotations\DocParser + * @var \Doctrine\Common\Annotations\DocParser */ private $preParser; /** * PHP Parser used to collect imports. * - * @var Doctrine\Common\Annotations\PhpParser + * @var \Doctrine\Common\Annotations\PhpParser */ private $phpParser; @@ -155,7 +156,7 @@ public function getClassAnnotations(ReflectionClass $class) * @param ReflectionClass $class The ReflectionClass of the class from which * the class annotations should be read. * @param string $annotationName The name of the annotation. - * @return The Annotation or NULL, if the requested annotation does not exist. + * @return mixed The Annotation or NULL, if the requested annotation does not exist. */ public function getClassAnnotation(ReflectionClass $class, $annotationName) { @@ -193,7 +194,7 @@ public function getPropertyAnnotations(ReflectionProperty $property) * * @param ReflectionProperty $property * @param string $annotationName The name of the annotation. - * @return The Annotation or NULL, if the requested annotation does not exist. + * @return mixed The Annotation or NULL, if the requested annotation does not exist. */ public function getPropertyAnnotation(ReflectionProperty $property, $annotationName) { @@ -211,8 +212,9 @@ public function getPropertyAnnotation(ReflectionProperty $property, $annotationN /** * Gets the annotations applied to a method. * - * @param ReflectionMethod $property The ReflectionMethod of the method from which + * @param \ReflectionMethod $method The ReflectionMethod of the method from which * the annotations should be read. + * * @return array An array of Annotations. */ public function getMethodAnnotations(ReflectionMethod $method) @@ -231,7 +233,7 @@ public function getMethodAnnotations(ReflectionMethod $method) * * @param ReflectionMethod $method * @param string $annotationName The name of the annotation. - * @return The Annotation or NULL, if the requested annotation does not exist. + * @return mixed The Annotation or NULL, if the requested annotation does not exist. */ public function getMethodAnnotation(ReflectionMethod $method, $annotationName) { @@ -262,6 +264,12 @@ private function getIgnoredAnnotationNames(ReflectionClass $class) return $this->ignoredAnnotationNames[$name]; } + /** + * Retrieve imports + * + * @param \ReflectionClass $class + * @return array + */ private function getImports(ReflectionClass $class) { if (isset($this->imports[$name = $class->getName()])) { diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/AnnotationRegistry.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/AnnotationRegistry.php index 60b00f5136387579c75c15e35f82494bf34b40ad..dfa846a04a601bb75ec0de322b654327242191ff 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/AnnotationRegistry.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/AnnotationRegistry.php @@ -13,12 +13,15 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ namespace Doctrine\Common\Annotations; +/** + * AnnotationRegistry + */ final class AnnotationRegistry { /** @@ -46,6 +49,11 @@ static public function reset() self::$loaders = array(); } + /** + * Register file + * + * @param string $file + */ static public function registerFile($file) { require_once $file; @@ -77,26 +85,28 @@ static public function registerAutoloadNamespaces(array $namespaces) } /** - * Register an autoloading callabale for annotations, much like spl_autoload_register(). + * Register an autoloading callable for annotations, much like spl_autoload_register(). * * NOTE: These class loaders HAVE to be silent when a class was not found! * IMPORTANT: Loaders have to return true if they loaded a class that could contain the searched annotation class. * - * @param callabale $callabale + * @param callable $callable + * + * @throws \InvalidArgumentException */ - static public function registerLoader($callabale) + static public function registerLoader($callable) { - if (!is_callable($callabale)) { + if (!is_callable($callable)) { throw new \InvalidArgumentException("A callable is expected in AnnotationRegistry::registerLoader()."); } - self::$loaders[] = $callabale; + self::$loaders[] = $callable; } /** * Autoload an annotation class silently. * * @param string $class - * @return void + * @return boolean */ static public function loadAnnotationClass($class) { diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/CachedReader.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/CachedReader.php index 6ea47c6ac64c48c5161a06b49fe758d1701ddfcf..e377e3b314735d162b98d45e8725bad1522351b0 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/CachedReader.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/CachedReader.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -29,6 +29,9 @@ */ final class CachedReader implements Reader { + /** + * @var string + */ private static $CACHE_SALT = '@[Annot]'; /** @@ -52,38 +55,48 @@ final class CachedReader implements Reader private $loadedAnnotations; /** + * Constructor + * * @param Reader $reader * @param Cache $cache + * @param bool $debug */ public function __construct(Reader $reader, Cache $cache, $debug = false) { $this->delegate = $reader; $this->cache = $cache; - $this->debug = $debug; + $this->debug = (Boolean) $debug; } + /** + * Get annotations for class + * + * @param \ReflectionClass $class + * @return array + */ public function getClassAnnotations(\ReflectionClass $class) { - $cacheKey = $class->getName() . self::$CACHE_SALT; + $cacheKey = $class->getName(); if (isset($this->loadedAnnotations[$cacheKey])) { return $this->loadedAnnotations[$cacheKey]; } - // Attempt to grab data from cache - if (($data = $this->cache->fetch($cacheKey)) !== false) { - if (!$this->debug || $this->isCacheFresh($cacheKey, $class)) { - return $data; - } + if (false === ($annots = $this->fetchFromCache($cacheKey, $class))) { + $annots = $this->delegate->getClassAnnotations($class); + $this->saveToCache($cacheKey, $annots); } - $annots = $this->delegate->getClassAnnotations($class); - $this->cache->save($cacheKey, $annots); - $this->cache->save('[C]'.$cacheKey, time()); - return $this->loadedAnnotations[$cacheKey] = $annots; } + /** + * Get selected annotation for class + * + * @param \ReflectionClass $class + * @param string $annotationName + * @return null + */ public function getClassAnnotation(\ReflectionClass $class, $annotationName) { foreach ($this->getClassAnnotations($class) as $annot) { @@ -95,29 +108,36 @@ public function getClassAnnotation(\ReflectionClass $class, $annotationName) return null; } + /** + * Get annotations for property + * + * @param \ReflectionProperty $property + * @return array + */ public function getPropertyAnnotations(\ReflectionProperty $property) { $class = $property->getDeclaringClass(); - $cacheKey = $class->getName().'$'.$property->getName().self::$CACHE_SALT; + $cacheKey = $class->getName().'$'.$property->getName(); if (isset($this->loadedAnnotations[$cacheKey])) { return $this->loadedAnnotations[$cacheKey]; } - // Attempt to grab data from cache - if (($data = $this->cache->fetch($cacheKey)) !== false) { - if (!$this->debug || $this->isCacheFresh($cacheKey, $class)) { - return $data; - } + if (false === ($annots = $this->fetchFromCache($cacheKey, $class))) { + $annots = $this->delegate->getPropertyAnnotations($property); + $this->saveToCache($cacheKey, $annots); } - $annots = $this->delegate->getPropertyAnnotations($property); - $this->cache->save($cacheKey, $annots); - $this->cache->save('[C]'.$cacheKey, time()); - return $this->loadedAnnotations[$cacheKey] = $annots; } + /** + * Get selected annotation for property + * + * @param \ReflectionProperty $property + * @param string $annotationName + * @return null + */ public function getPropertyAnnotation(\ReflectionProperty $property, $annotationName) { foreach ($this->getPropertyAnnotations($property) as $annot) { @@ -129,29 +149,36 @@ public function getPropertyAnnotation(\ReflectionProperty $property, $annotation return null; } + /** + * Get method annotations + * + * @param \ReflectionMethod $method + * @return array + */ public function getMethodAnnotations(\ReflectionMethod $method) { $class = $method->getDeclaringClass(); - $cacheKey = $class->getName().'#'.$method->getName().self::$CACHE_SALT; + $cacheKey = $class->getName().'#'.$method->getName(); if (isset($this->loadedAnnotations[$cacheKey])) { return $this->loadedAnnotations[$cacheKey]; } - // Attempt to grab data from cache - if (($data = $this->cache->fetch($cacheKey)) !== false) { - if (!$this->debug || $this->isCacheFresh($cacheKey, $class)) { - return $data; - } + if (false === ($annots = $this->fetchFromCache($cacheKey, $class))) { + $annots = $this->delegate->getMethodAnnotations($method); + $this->saveToCache($cacheKey, $annots); } - $annots = $this->delegate->getMethodAnnotations($method); - $this->cache->save($cacheKey, $annots); - $this->cache->save('[C]'.$cacheKey, time()); - return $this->loadedAnnotations[$cacheKey] = $annots; } + /** + * Get selected method annotation + * + * @param \ReflectionMethod $method + * @param string $annotationName + * @return null + */ public function getMethodAnnotation(\ReflectionMethod $method, $annotationName) { foreach ($this->getMethodAnnotations($method) as $annot) { @@ -163,11 +190,55 @@ public function getMethodAnnotation(\ReflectionMethod $method, $annotationName) return null; } + /** + * Clear loaded annotations + */ public function clearLoadedAnnotations() { $this->loadedAnnotations = array(); } + /** + * Fetches a value from the cache. + * + * @param string $rawCacheKey The cache key. + * @param \ReflectionClass $class The related class. + * @return mixed|boolean The cached value or false when the value is not in cache. + */ + private function fetchFromCache($rawCacheKey, \ReflectionClass $class) + { + $cacheKey = $rawCacheKey . self::$CACHE_SALT; + if (($data = $this->cache->fetch($cacheKey)) !== false) { + if (!$this->debug || $this->isCacheFresh($cacheKey, $class)) { + return $data; + } + } + + return false; + } + + /** + * Saves a value to the cache + * + * @param string $rawCacheKey The cache key. + * @param mixed $value The value. + */ + private function saveToCache($rawCacheKey, $value) + { + $cacheKey = $rawCacheKey . self::$CACHE_SALT; + $this->cache->save($cacheKey, $value); + if ($this->debug) { + $this->cache->save('[C]'.$cacheKey, time()); + } + } + + /** + * Check if cache is fresh + * + * @param string $cacheKey + * @param \ReflectionClass $class + * @return bool + */ private function isCacheFresh($cacheKey, \ReflectionClass $class) { if (false === $filename = $class->getFilename()) { @@ -176,4 +247,4 @@ private function isCacheFresh($cacheKey, \ReflectionClass $class) return $this->cache->fetch('[C]'.$cacheKey) >= filemtime($filename); } -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/DocLexer.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/DocLexer.php index c6223e3647e089241b21869745b479a9fe99e6b9..fc3c2d4254998952ef5e469d79a22120a99fb57d 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/DocLexer.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/DocLexer.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -33,11 +33,12 @@ final class DocLexer extends Lexer { const T_NONE = 1; - const T_IDENTIFIER = 2; - const T_INTEGER = 3; - const T_STRING = 4; - const T_FLOAT = 5; + const T_INTEGER = 2; + const T_STRING = 3; + const T_FLOAT = 4; + // All tokens that are also identifiers should be >= 100 + const T_IDENTIFIER = 100; const T_AT = 101; const T_CLOSE_CURLY_BRACES = 102; const T_CLOSE_PARENTHESIS = 103; @@ -52,19 +53,19 @@ final class DocLexer extends Lexer const T_COLON = 112; /** - * @inheritdoc + * {@inheritdoc} */ protected function getCatchablePatterns() { return array( - '[a-z_][a-z0-9_:]*', + '[a-z_\\\][a-z0-9_\:\\\]*[a-z]{1}', '(?:[+-]?[0-9]+(?:[\.][0-9]+)*)(?:[eE][+-]?[0-9]+)?', '"(?:[^"]|"")*"', ); } /** - * @inheritdoc + * {@inheritdoc} */ protected function getNonCatchablePatterns() { @@ -72,7 +73,11 @@ protected function getNonCatchablePatterns() } /** - * @inheritdoc + * {@inheritdoc} + * + * @param string $value + * + * @return int */ protected function getType(&$value) { @@ -127,7 +132,7 @@ protected function getType(&$value) return self::T_COLON; default: - if (ctype_alpha($value[0]) || $value[0] === '_') { + if (ctype_alpha($value[0]) || $value[0] === '_' || $value[0] === '\\') { return self::T_IDENTIFIER; } @@ -137,4 +142,4 @@ protected function getType(&$value) return $type; } -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/DocParser.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/DocParser.php index 9d16b1762c0c06023d2a6f7cca66b6680c517a73..de31e0b486c777321e2f9c4fd4397d268bc2d356 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/DocParser.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/DocParser.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -49,7 +49,7 @@ final class DocParser /** * The lexer. * - * @var Doctrine\Common\Annotations\DocLexer + * @var \Doctrine\Common\Annotations\DocLexer */ private $lexer; @@ -63,7 +63,7 @@ final class DocParser /** * Doc Parser used to collect annotation target * - * @var Doctrine\Common\Annotations\DocParser + * @var \Doctrine\Common\Annotations\DocParser */ private static $metadataParser; @@ -223,6 +223,11 @@ public function setIgnoredAnnotationNames(array $names) $this->ignoredAnnotationNames = $names; } + /** + * Sets ignore on not-imported annotations + * + * @param $bool + */ public function setIgnoreNotImportedAnnotations($bool) { $this->ignoreNotImportedAnnotations = (Boolean) $bool; @@ -230,7 +235,10 @@ public function setIgnoreNotImportedAnnotations($bool) /** * Sets the default namespaces. - * @param array $namespaces + * + * @param array $namespace + * + * @throws \RuntimeException */ public function addNamespace($namespace) { @@ -240,6 +248,12 @@ public function addNamespace($namespace) $this->namespaces[] = $namespace; } + /** + * Sets the imports + * + * @param array $imports + * @throws \RuntimeException + */ public function setImports(array $imports) { if ($this->namespaces) { @@ -287,7 +301,7 @@ public function parse($input, $context = '') * Attempts to match the given token with the current lookahead token. * If they match, updates the lookahead token; otherwise raises a syntax error. * - * @param int Token type. + * @param int $token type of Token. * @return bool True if tokens match; false otherwise. */ private function match($token) @@ -322,7 +336,8 @@ private function matchAny(array $tokens) * * @param string $expected Expected string. * @param array $token Optional token. - * @throws SyntaxException + * + * @throws AnnotationException */ private function syntaxError($expected, $token = null) { @@ -372,7 +387,7 @@ private function classExists($fqcn) /** * Collects parsing metadata for a given annotation class * - * @param string $name The annotation name + * @param string $name The annotation name */ private function collectAnnotationMetadata($name) { @@ -530,6 +545,7 @@ private function Annotations() * NameSpacePart ::= identifier | null | false | true * SimpleName ::= identifier | null | false | true * + * @throws AnnotationException * @return mixed False if it is not a valid annotation. */ private function Annotation() @@ -537,20 +553,7 @@ private function Annotation() $this->match(DocLexer::T_AT); // check if we have an annotation - if ($this->lexer->isNextTokenAny(self::$classIdentifiers)) { - $this->lexer->moveNext(); - $name = $this->lexer->token['value']; - } else if ($this->lexer->isNextToken(DocLexer::T_NAMESPACE_SEPARATOR)) { - $name = ''; - } else { - $this->syntaxError('namespace separator or identifier'); - } - - while ($this->lexer->lookahead['position'] === $this->lexer->token['position'] + strlen($this->lexer->token['value']) && $this->lexer->isNextToken(DocLexer::T_NAMESPACE_SEPARATOR)) { - $this->match(DocLexer::T_NAMESPACE_SEPARATOR); - $this->matchAny(self::$classIdentifiers); - $name .= '\\'.$this->lexer->token['value']; - } + $name = $this->Identifier(); // only process names which are not fully qualified, yet // fully qualified names must start with a \ @@ -746,6 +749,91 @@ private function Values() return $values; } + /** + * Constant ::= integer | string | float | boolean + * + * @throws AnnotationException + * @return mixed + */ + private function Constant() + { + $identifier = $this->Identifier(); + + if (!defined($identifier) && false !== strpos($identifier, '::') && '\\' !== $identifier[0]) { + + list($className, $const) = explode('::', $identifier); + $alias = (false === $pos = strpos($className, '\\'))? $className : substr($className, 0, $pos); + + $found = false; + switch (true) { + case !empty ($this->namespaces): + foreach ($this->namespaces as $ns) { + if (class_exists($ns.'\\'.$className) || interface_exists($ns.'\\'.$className)) { + $className = $ns.'\\'.$className; + $found = true; + break; + } + } + break; + + case isset($this->imports[$loweredAlias = strtolower($alias)]): + $found = true; + if (false !== $pos) { + $className = $this->imports[$loweredAlias].substr($className, $pos); + } else { + $className = $this->imports[$loweredAlias]; + } + break; + + default: + if(isset($this->imports['__NAMESPACE__'])) { + $ns = $this->imports['__NAMESPACE__']; + if (class_exists($ns.'\\'.$className) || interface_exists($ns.'\\'.$className)) { + $className = $ns.'\\'.$className; + $found = true; + } + } + break; + } + + if ($found) { + $identifier = $className . '::' . $const; + } + } + + if (!defined($identifier)) { + throw AnnotationException::semanticalErrorConstants($identifier, $this->context); + } + + return constant($identifier); + } + + /** + * Identifier ::= string + * + * @return string + */ + private function Identifier() + { + // check if we have an annotation + if ($this->lexer->isNextTokenAny(self::$classIdentifiers)) { + $this->lexer->moveNext(); + $className = $this->lexer->token['value']; + } else { + $this->syntaxError('namespace separator or identifier'); + } + + while ($this->lexer->lookahead['position'] === ($this->lexer->token['position'] + strlen($this->lexer->token['value'])) + && $this->lexer->isNextToken(DocLexer::T_NAMESPACE_SEPARATOR)) { + + $this->match(DocLexer::T_NAMESPACE_SEPARATOR); + $this->matchAny(self::$classIdentifiers); + $className .= '\\' . $this->lexer->token['value']; + } + + return $className; + } + /** * Value ::= PlainValue | FieldAssignment * @@ -777,6 +865,10 @@ private function PlainValue() return $this->Annotation(); } + if ($this->lexer->isNextToken(DocLexer::T_IDENTIFIER)) { + return $this->Constant(); + } + switch ($this->lexer->lookahead['type']) { case DocLexer::T_STRING: $this->match(DocLexer::T_STRING); @@ -867,8 +959,8 @@ private function Arrayx() /** * ArrayEntry ::= Value | KeyValuePair - * KeyValuePair ::= Key ("=" | ":") PlainValue - * Key ::= string | integer + * KeyValuePair ::= Key ("=" | ":") PlainValue | Constant + * Key ::= string | integer | Constant * * @return array */ @@ -878,9 +970,14 @@ private function ArrayEntry() if (DocLexer::T_EQUALS === $peek['type'] || DocLexer::T_COLON === $peek['type']) { - $this->matchAny(array(DocLexer::T_INTEGER, DocLexer::T_STRING)); - $key = $this->lexer->token['value']; + if ($this->lexer->isNextToken(DocLexer::T_IDENTIFIER)) { + $key = $this->Constant(); + } else { + $this->matchAny(array(DocLexer::T_INTEGER, DocLexer::T_STRING)); + $key = $this->lexer->token['value']; + } + $this->matchAny(array(DocLexer::T_EQUALS, DocLexer::T_COLON)); return array($key, $this->PlainValue()); @@ -888,4 +985,4 @@ private function ArrayEntry() return array(null, $this->Value()); } -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/FileCacheReader.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/FileCacheReader.php index 4a42b5832bbeabf5b47fc6ff492b91fceefb4675..3934861b0f24467f59922f4998c0905da9b1e4b6 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/FileCacheReader.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/FileCacheReader.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -32,10 +32,31 @@ class FileCacheReader implements Reader * @var Reader */ private $reader; + + /** + * @var string + */ private $dir; + + /** + * @var bool + */ private $debug; + + /** + * @var array + */ private $loadedAnnotations = array(); + /** + * Constructor + * + * @param Reader $reader + * @param string $cacheDir + * @param bool $debug + * + * @throws \InvalidArgumentException + */ public function __construct(Reader $reader, $cacheDir, $debug = false) { $this->reader = $reader; @@ -50,6 +71,12 @@ public function __construct(Reader $reader, $cacheDir, $debug = false) $this->debug = $debug; } + /** + * Retrieve annotations for class + * + * @param \ReflectionClass $class + * @return array + */ public function getClassAnnotations(\ReflectionClass $class) { $key = $class->getName(); @@ -78,6 +105,12 @@ public function getClassAnnotations(\ReflectionClass $class) return $this->loadedAnnotations[$key] = include $path; } + /** + * Get annotations for property + * + * @param \ReflectionProperty $property + * @return array + */ public function getPropertyAnnotations(\ReflectionProperty $property) { $class = $property->getDeclaringClass(); @@ -107,6 +140,12 @@ public function getPropertyAnnotations(\ReflectionProperty $property) return $this->loadedAnnotations[$key] = include $path; } + /** + * Retrieve annotations for method + * + * @param \ReflectionMethod $method + * @return array + */ public function getMethodAnnotations(\ReflectionMethod $method) { $class = $method->getDeclaringClass(); @@ -136,6 +175,12 @@ public function getMethodAnnotations(\ReflectionMethod $method) return $this->loadedAnnotations[$key] = include $path; } + /** + * Save cache file + * + * @param string $path + * @param mixed $data + */ private function saveCacheFile($path, $data) { file_put_contents($path, '<?php return unserialize('.var_export(serialize($data), true).');'); @@ -144,10 +189,11 @@ private function saveCacheFile($path, $data) /** * Gets a class annotation. * - * @param ReflectionClass $class The ReflectionClass of the class from which + * @param \ReflectionClass $class The ReflectionClass of the class from which * the class annotations should be read. * @param string $annotationName The name of the annotation. - * @return The Annotation or NULL, if the requested annotation does not exist. + * + * @return mixed The Annotation or NULL, if the requested annotation does not exist. */ public function getClassAnnotation(\ReflectionClass $class, $annotationName) { @@ -165,9 +211,9 @@ public function getClassAnnotation(\ReflectionClass $class, $annotationName) /** * Gets a method annotation. * - * @param ReflectionMethod $method + * @param \ReflectionMethod $method * @param string $annotationName The name of the annotation. - * @return The Annotation or NULL, if the requested annotation does not exist. + * @return mixed The Annotation or NULL, if the requested annotation does not exist. */ public function getMethodAnnotation(\ReflectionMethod $method, $annotationName) { @@ -185,9 +231,9 @@ public function getMethodAnnotation(\ReflectionMethod $method, $annotationName) /** * Gets a property annotation. * - * @param ReflectionProperty $property + * @param \ReflectionProperty $property * @param string $annotationName The name of the annotation. - * @return The Annotation or NULL, if the requested annotation does not exist. + * @return mixed The Annotation or NULL, if the requested annotation does not exist. */ public function getPropertyAnnotation(\ReflectionProperty $property, $annotationName) { @@ -202,8 +248,11 @@ public function getPropertyAnnotation(\ReflectionProperty $property, $annotation return null; } + /** + * Clear stores annotations + */ public function clearLoadedAnnotations() { $this->loadedAnnotations = array(); } -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/IndexedReader.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/IndexedReader.php index 1eea49210a3f8d64d2392bce6f9dd2cd8473efe0..2dfdd4da18db097db8db033e9a58e5cb24cc2558 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/IndexedReader.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/IndexedReader.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -28,13 +28,27 @@ */ class IndexedReader implements Reader { + /** + * @var Reader + */ private $delegate; + /** + * Constructor + * + * @param Reader $reader + */ public function __construct(Reader $reader) { $this->delegate = $reader; } + /** + * Get Annotations for class + * + * @param \ReflectionClass $class + * @return array + */ public function getClassAnnotations(\ReflectionClass $class) { $annotations = array(); @@ -45,11 +59,24 @@ public function getClassAnnotations(\ReflectionClass $class) return $annotations; } + /** + * Get selected annotation for class + * + * @param \ReflectionClass $class + * @param string $annotation + * @return mixed + */ public function getClassAnnotation(\ReflectionClass $class, $annotation) { return $this->delegate->getClassAnnotation($class, $annotation); } + /** + * Get Annotations for method + * + * @param \ReflectionMethod $method + * @return array + */ public function getMethodAnnotations(\ReflectionMethod $method) { $annotations = array(); @@ -60,11 +87,24 @@ public function getMethodAnnotations(\ReflectionMethod $method) return $annotations; } + /** + * Get selected annotation for method + * + * @param \ReflectionMethod $method + * @param string $annotation + * @return mixed + */ public function getMethodAnnotation(\ReflectionMethod $method, $annotation) { return $this->delegate->getMethodAnnotation($method, $annotation); } + /** + * Get annotations for property + * + * @param \ReflectionProperty $property + * @return array + */ public function getPropertyAnnotations(\ReflectionProperty $property) { $annotations = array(); @@ -75,6 +115,13 @@ public function getPropertyAnnotations(\ReflectionProperty $property) return $annotations; } + /** + * Get selected annotation for property + * + * @param \ReflectionProperty $property + * @param string $annotation + * @return mixed + */ public function getPropertyAnnotation(\ReflectionProperty $property, $annotation) { return $this->delegate->getPropertyAnnotation($property, $annotation); @@ -83,12 +130,12 @@ public function getPropertyAnnotation(\ReflectionProperty $property, $annotation /** * Proxy all methods to the delegate. * - * @param type $method - * @param type $args - * @return type + * @param string $method + * @param array $args + * @return mixed */ public function __call($method, $args) { return call_user_func_array(array($this->delegate, $method), $args); } -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/PhpParser.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/PhpParser.php index a14f8f5befcdce734ea045b65db65368c277cd34..c09dd51d1bcff7e83897d6a92be1986eb81100b2 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/PhpParser.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/PhpParser.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -29,35 +29,18 @@ */ final class PhpParser { - /** - * The token list. - * - * @var array - */ - private $tokens; - - /** - * The number of tokens. - * - * @var int - */ - private $numTokens = 0; - - /** - * The current array pointer. - * - * @var int - */ - private $pointer = 0; - /** * Parses a class. * - * @param \ReflectionClass $class A <code>ReflectionClass</code> object. - * @return array A list with use statements in the form (Alias => FQN). + * @param \ReflectionClass $class A <code>ReflectionClass</code> object. + * @return array A list with use statements in the form (Alias => FQN). */ public function parseClass(\ReflectionClass $class) { + if (method_exists($class, 'getUseStatements')) { + return $class->getUseStatements(); + } + if (false === $filename = $class->getFilename()) { return array(); } @@ -65,11 +48,9 @@ public function parseClass(\ReflectionClass $class) $content = $this->getFileContent($filename, $class->getStartLine()); $namespace = str_replace('\\', '\\\\', $class->getNamespaceName()); $content = preg_replace('/^.*?(\bnamespace\s+' . $namespace . '\s*[;{].*)$/s', '\\1', $content); - $this->tokens = token_get_all('<?php ' . $content); - $this->numTokens = count($this->tokens); - $this->pointer = 0; + $tokenizer = new TokenParser('<?php ' . $content); - $statements = $this->parseUseStatements($class->getNamespaceName()); + $statements = $tokenizer->parseUseStatements($class->getNamespaceName()); return $statements; } @@ -77,8 +58,8 @@ public function parseClass(\ReflectionClass $class) /** * Get the content of the file right up to the given line number. * - * @param string $filename The name of the file to load. - * @param int $lineNumber The number of lines to read from file. + * @param string $filename The name of the file to load. + * @param int $lineNumber The number of lines to read from file. * @return string The content of the file. */ private function getFileContent($filename, $lineNumber) @@ -86,7 +67,7 @@ private function getFileContent($filename, $lineNumber) $content = ''; $lineCnt = 0; $file = new SplFileObject($filename); - while(!$file->eof()) { + while (!$file->eof()) { if ($lineCnt++ == $lineNumber) { break; } @@ -96,108 +77,4 @@ private function getFileContent($filename, $lineNumber) return $content; } - - /** - * Gets the next non whitespace and non comment token. - * - * @return array The token if exists, null otherwise. - */ - private function next() - { - for ($i = $this->pointer; $i < $this->numTokens; $i++) { - $this->pointer++; - if ($this->tokens[$i][0] === T_WHITESPACE || - $this->tokens[$i][0] === T_COMMENT || - $this->tokens[$i][0] === T_DOC_COMMENT) { - - continue; - } - - return $this->tokens[$i]; - } - - return null; - } - - /** - * Get all use statements. - * - * @param string $namespaceName The namespace name of the reflected class. - * @return array A list with all found use statements. - */ - private function parseUseStatements($namespaceName) - { - $statements = array(); - while (($token = $this->next())) { - if ($token[0] === T_USE) { - $statements = array_merge($statements, $this->parseUseStatement()); - continue; - } else if ($token[0] !== T_NAMESPACE || $this->parseNamespace() != $namespaceName) { - continue; - } - - // Get fresh array for new namespace. This is to prevent the parser to collect the use statements - // for a previous namespace with the same name. This is the case if a namespace is defined twice - // or if a namespace with the same name is commented out. - $statements = array(); - } - - return $statements; - } - - /** - * Get the namespace name. - * - * @return string The found namespace name. - */ - private function parseNamespace() - { - $namespace = ''; - while (($token = $this->next())){ - if ($token[0] === T_STRING || $token[0] === T_NS_SEPARATOR) { - $namespace .= $token[1]; - } else { - break; - } - } - - return $namespace; - } - - /** - * Parse a single use statement. - * - * @return array A list with all found class names for a use statement. - */ - private function parseUseStatement() - { - $class = ''; - $alias = ''; - $statements = array(); - $explicitAlias = false; - while (($token = $this->next())) { - $isNameToken = $token[0] === T_STRING || $token[0] === T_NS_SEPARATOR; - if (!$explicitAlias && $isNameToken) { - $class .= $token[1]; - $alias = $token[1]; - } else if ($explicitAlias && $isNameToken) { - $alias .= $token[1]; - } else if ($token[0] === T_AS) { - $explicitAlias = true; - $alias = ''; - } else if ($token === ',') { - $statements[strtolower($alias)] = $class; - $class = ''; - $alias = ''; - $explicitAlias = false; - } else if ($token === ';') { - $statements[strtolower($alias)] = $class; - break; - } else { - break; - } - } - - return $statements; - } -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Reader.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Reader.php index 8e85d39200fc27e935b68bf764c95cd05b076666..6a01cb4a56b2746f053a538c1b3fd1420e197d90 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Reader.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Reader.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -26,10 +26,42 @@ */ interface Reader { + /** + * @param \ReflectionClass $class + * @return mixed + */ function getClassAnnotations(\ReflectionClass $class); + + /** + * @param \ReflectionClass $class + * @param string $annotationName + * @return mixed + */ function getClassAnnotation(\ReflectionClass $class, $annotationName); + + /** + * @param \ReflectionMethod $method + * @return mixed + */ function getMethodAnnotations(\ReflectionMethod $method); + + /** + * @param \ReflectionMethod $method + * @param string $annotationName + * @return mixed + */ function getMethodAnnotation(\ReflectionMethod $method, $annotationName); + + /** + * @param \ReflectionProperty $property + * @return mixed + */ function getPropertyAnnotations(\ReflectionProperty $property); + + /** + * @param \ReflectionProperty $property + * @param string $annotationName + * @return mixed + */ function getPropertyAnnotation(\ReflectionProperty $property, $annotationName); -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/SimpleAnnotationReader.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/SimpleAnnotationReader.php index a13c7fa0729f9c8a046641d27325b126dc7cda73..4210d90184551b8b04e3d807c978902177ed7a36 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/SimpleAnnotationReader.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/SimpleAnnotationReader.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -62,8 +62,9 @@ public function addNamespace($namespace) /** * Gets the annotations applied to a class. * - * @param ReflectionClass $class The ReflectionClass of the class from which + * @param \ReflectionClass $class The ReflectionClass of the class from which * the class annotations should be read. + * * @return array An array of Annotations. */ public function getClassAnnotations(\ReflectionClass $class) @@ -71,11 +72,12 @@ public function getClassAnnotations(\ReflectionClass $class) return $this->parser->parse($class->getDocComment(), 'class '.$class->getName()); } - /** + /** * Gets the annotations applied to a method. * - * @param ReflectionMethod $property The ReflectionMethod of the method from which + * @param \ReflectionMethod $method The ReflectionMethod of the method from which * the annotations should be read. + * * @return array An array of Annotations. */ public function getMethodAnnotations(\ReflectionMethod $method) @@ -86,8 +88,9 @@ public function getMethodAnnotations(\ReflectionMethod $method) /** * Gets the annotations applied to a property. * - * @param ReflectionProperty $property The ReflectionProperty of the property + * @param \ReflectionProperty $property The ReflectionProperty of the property * from which the annotations should be read. + * * @return array An array of Annotations. */ public function getPropertyAnnotations(\ReflectionProperty $property) @@ -98,10 +101,11 @@ public function getPropertyAnnotations(\ReflectionProperty $property) /** * Gets a class annotation. * - * @param ReflectionClass $class The ReflectionClass of the class from which + * @param \ReflectionClass $class The ReflectionClass of the class from which * the class annotations should be read. * @param string $annotationName The name of the annotation. - * @return The Annotation or NULL, if the requested annotation does not exist. + * + * @return mixed The Annotation or NULL, if the requested annotation does not exist. */ public function getClassAnnotation(\ReflectionClass $class, $annotationName) { @@ -117,9 +121,10 @@ public function getClassAnnotation(\ReflectionClass $class, $annotationName) /** * Gets a method annotation. * - * @param ReflectionMethod $method + * @param \ReflectionMethod $method * @param string $annotationName The name of the annotation. - * @return The Annotation or NULL, if the requested annotation does not exist. + * + * @return mixed The Annotation or NULL, if the requested annotation does not exist. */ public function getMethodAnnotation(\ReflectionMethod $method, $annotationName) { @@ -135,9 +140,9 @@ public function getMethodAnnotation(\ReflectionMethod $method, $annotationName) /** * Gets a property annotation. * - * @param ReflectionProperty $property + * @param \ReflectionProperty $property * @param string $annotationName The name of the annotation. - * @return The Annotation or NULL, if the requested annotation does not exist. + * @return mixed The Annotation or NULL, if the requested annotation does not exist. */ public function getPropertyAnnotation(\ReflectionProperty $property, $annotationName) { @@ -149,4 +154,4 @@ public function getPropertyAnnotation(\ReflectionProperty $property, $annotation return null; } -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/TokenParser.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/TokenParser.php new file mode 100644 index 0000000000000000000000000000000000000000..a1ef1154f0112366c1cb088c178b582a8d577efd --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/TokenParser.php @@ -0,0 +1,175 @@ +<?php +/* + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This software consists of voluntary contributions made by many individuals + * and is licensed under the MIT license. For more information, see + * <http://www.doctrine-project.org>. + */ + +namespace Doctrine\Common\Annotations; + +/** + * Parses a file for namespaces/use/class declarations. + * + * @author Fabien Potencier <fabien@symfony.com> + * @author Christian Kaps <christian.kaps@mohiva.com> + */ +class TokenParser +{ + /** + * The token list. + * + * @var array + */ + private $tokens; + + /** + * The number of tokens. + * + * @var int + */ + private $numTokens = 0; + + /** + * The current array pointer. + * + * @var int + */ + private $pointer = 0; + + public function __construct($contents) + { + $this->tokens = token_get_all($contents); + $this->numTokens = count($this->tokens); + $this->pointer = 0; + } + + /** + * Gets the next non whitespace and non comment token. + * + * @param $docCommentIsComment + * If TRUE then a doc comment is considered a comment and skipped. + * If FALSE then only whitespace and normal comments are skipped. + * + * @return array The token if exists, null otherwise. + */ + public function next($docCommentIsComment = TRUE) + { + for ($i = $this->pointer; $i < $this->numTokens; $i++) { + $this->pointer++; + if ($this->tokens[$i][0] === T_WHITESPACE || + $this->tokens[$i][0] === T_COMMENT || + ($docCommentIsComment && $this->tokens[$i][0] === T_DOC_COMMENT)) { + + continue; + } + + return $this->tokens[$i]; + } + + return null; + } + + /** + * Parse a single use statement. + * + * @return array A list with all found class names for a use statement. + */ + public function parseUseStatement() + { + $class = ''; + $alias = ''; + $statements = array(); + $explicitAlias = false; + while (($token = $this->next())) { + $isNameToken = $token[0] === T_STRING || $token[0] === T_NS_SEPARATOR; + if (!$explicitAlias && $isNameToken) { + $class .= $token[1]; + $alias = $token[1]; + } else if ($explicitAlias && $isNameToken) { + $alias .= $token[1]; + } else if ($token[0] === T_AS) { + $explicitAlias = true; + $alias = ''; + } else if ($token === ',') { + $statements[strtolower($alias)] = $class; + $class = ''; + $alias = ''; + $explicitAlias = false; + } else if ($token === ';') { + $statements[strtolower($alias)] = $class; + break; + } else { + break; + } + } + + return $statements; + } + + /** + * Get all use statements. + * + * @param string $namespaceName The namespace name of the reflected class. + * @return array A list with all found use statements. + */ + public function parseUseStatements($namespaceName) + { + $statements = array(); + while (($token = $this->next())) { + if ($token[0] === T_USE) { + $statements = array_merge($statements, $this->parseUseStatement()); + continue; + } + if ($token[0] !== T_NAMESPACE || $this->parseNamespace() != $namespaceName) { + continue; + } + + // Get fresh array for new namespace. This is to prevent the parser to collect the use statements + // for a previous namespace with the same name. This is the case if a namespace is defined twice + // or if a namespace with the same name is commented out. + $statements = array(); + } + + return $statements; + } + + /** + * Get the namespace. + * + * @return string The found namespace. + */ + public function parseNamespace() + { + $name = ''; + while (($token = $this->next()) && ($token[0] === T_STRING || $token[0] === T_NS_SEPARATOR)) { + $name .= $token[1]; + } + + return $name; + } + + /** + * Get the class name. + * + * @return string The foundclass name. + */ + public function parseClass() + { + // Namespaces and class names are tokenized the same: T_STRINGs + // separated by T_NS_SEPARATOR so we can use one function to provide + // both. + return $this->parseNamespace(); + } +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/ApcCache.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/ApcCache.php index a59296f5d657e7db6343e5f55e174e4ad1f2279a..2d0cd23afdd2b72bbd8c34c957e101d8b32c26ad 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/ApcCache.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/ApcCache.php @@ -14,7 +14,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -47,11 +47,7 @@ protected function doFetch($id) */ protected function doContains($id) { - $found = false; - - apc_fetch($id, $found); - - return $found; + return apc_exists($id); } /** @@ -94,4 +90,4 @@ protected function doGetStats() Cache::STATS_MEMORY_AVAILIABLE => $sma['avail_mem'], ); } -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/ArrayCache.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/ArrayCache.php index 8a0b982b4a59d2881dd5124d94b6de70e30d3c94..a7a70aad51ce7c781e7365d72fc5014d15804543 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/ArrayCache.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/ArrayCache.php @@ -15,7 +15,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -93,4 +93,4 @@ protected function doGetStats() { return null; } -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/Cache.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/Cache.php index d303bde4c6de93dba7da1b4020cadaed87d301e7..5493562de79a3f61fb92d06216d22d5c8f401386 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/Cache.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/Cache.php @@ -15,7 +15,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -45,7 +45,7 @@ interface Cache * Fetches an entry from the cache. * * @param string $id cache id The id of the cache entry to fetch. - * @return string The cached data or FALSE, if no cache entry exists for the given id. + * @return mixed The cached data or FALSE, if no cache entry exists for the given id. */ function fetch($id); @@ -61,7 +61,7 @@ function contains($id); * Puts data into the cache. * * @param string $id The cache id. - * @param string $data The cache entry/data. + * @param mixed $data The cache entry/data. * @param int $lifeTime The lifetime. If != 0, sets a specific lifetime for this cache entry (0 => infinite lifeTime). * @return boolean TRUE if the entry was successfully stored in the cache, FALSE otherwise. */ diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/CacheProvider.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/CacheProvider.php index fa11fc22fab1012dc81703a1ed75867bdcdb8d7d..4221a62e593078109ae2edb8344d8464ab556b63 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/CacheProvider.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/CacheProvider.php @@ -14,7 +14,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -39,6 +39,11 @@ abstract class CacheProvider implements Cache */ private $namespace = ''; + /** + * @var string The namespace version + */ + private $namespaceVersion; + /** * Set the namespace to prefix all cache ids with. * @@ -117,10 +122,12 @@ public function flushAll() */ public function deleteAll() { - $namespaceCacheKey = sprintf(self::DOCTRINE_NAMESPACE_CACHEKEY, $this->namespace); - $namespaceVersion = ($this->doContains($namespaceCacheKey)) ? $this->doFetch($namespaceCacheKey) : 1; + $namespaceCacheKey = $this->getNamespaceCacheKey(); + $namespaceVersion = $this->getNamespaceVersion() + 1; - return $this->doSave($namespaceCacheKey, $namespaceVersion + 1); + $this->namespaceVersion = $namespaceVersion; + + return $this->doSave($namespaceCacheKey, $namespaceVersion); } /** @@ -131,12 +138,46 @@ public function deleteAll() */ private function getNamespacedId($id) { - $namespaceCacheKey = sprintf(self::DOCTRINE_NAMESPACE_CACHEKEY, $this->namespace); - $namespaceVersion = ($this->doContains($namespaceCacheKey)) ? $this->doFetch($namespaceCacheKey) : 1; + $namespaceVersion = $this->getNamespaceVersion(); return sprintf('%s[%s][%s]', $this->namespace, $id, $namespaceVersion); } + /** + * Namespace cache key + * + * @return string $namespaceCacheKey + */ + private function getNamespaceCacheKey() + { + return sprintf(self::DOCTRINE_NAMESPACE_CACHEKEY, $this->namespace); + } + + /** + * Namespace version + * + * @return string $namespaceVersion + */ + private function getNamespaceVersion() + { + if (null !== $this->namespaceVersion) { + return $this->namespaceVersion; + } + + $namespaceCacheKey = $this->getNamespaceCacheKey(); + $namespaceVersion = $this->doFetch($namespaceCacheKey); + + if (false === $namespaceVersion) { + $namespaceVersion = 1; + + $this->doSave($namespaceCacheKey, $namespaceVersion); + } + + $this->namespaceVersion = $namespaceVersion; + + return $this->namespaceVersion; + } + /** * Fetches an entry from the cache. * @@ -158,7 +199,9 @@ abstract protected function doContains($id); * * @param string $id The cache id. * @param string $data The cache entry/data. - * @param int $lifeTime The lifetime. If != false, sets a specific lifetime for this cache entry (null => infinite lifeTime). + * @param bool|int $lifeTime The lifetime. If != false, sets a specific lifetime for this + * cache entry (null => infinite lifeTime). + * * @return boolean TRUE if the entry was successfully stored in the cache, FALSE otherwise. */ abstract protected function doSave($id, $data, $lifeTime = false); diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/FileCache.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/FileCache.php new file mode 100644 index 0000000000000000000000000000000000000000..44359754eb0530951ad216ccbb0b1dc4254a130d --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/FileCache.php @@ -0,0 +1,132 @@ +<?php + +/* + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This software consists of voluntary contributions made by many individuals + * and is licensed under the MIT license. For more information, see + * <http://www.doctrine-project.org>. + */ + +namespace Doctrine\Common\Cache; + +/** + * Base file cache driver. + * + * @since 2.3 + * @author Fabio B. Silva <fabio.bat.silva@gmail.com> + */ +abstract class FileCache extends CacheProvider +{ + /** + * @var string Cache directory. + */ + protected $directory; + + /** + * @var string Cache file extension. + */ + protected $extension; + + /** + * Constructor + * + * @param string $directory Cache directory. + * @param string $directory Cache file extension. + * + * @throws \InvalidArgumentException + */ + public function __construct($directory, $extension = null) + { + if ( ! is_dir($directory) && ! @mkdir($directory, 0777, true)) { + throw new \InvalidArgumentException(sprintf( + 'The directory "%s" does not exist and could not be created.', + $directory + )); + } + + if ( ! is_writable($directory)) { + throw new \InvalidArgumentException(sprintf( + 'The directory "%s" is not writable.', + $directory + )); + } + + $this->directory = realpath($directory); + $this->extension = $extension ?: $this->extension; + } + + /** + * Gets the cache directory. + * + * @return string + */ + public function getDirectory() + { + return $this->directory; + } + + /** + * Gets the cache file extension. + * + * @return string + */ + public function getExtension() + { + return $this->extension; + } + + /** + * @return string + */ + protected function getFilename($id) + { + $path = implode(str_split(md5($id), 12), DIRECTORY_SEPARATOR); + $path = $this->directory . DIRECTORY_SEPARATOR . $path; + + return $path . DIRECTORY_SEPARATOR . $id . $this->extension; + } + + /** + * {@inheritdoc} + */ + protected function doDelete($id) + { + return unlink($this->getFilename($id)); + } + + /** + * {@inheritdoc} + */ + protected function doFlush() + { + $pattern = '/^.+\\' . $this->extension . '$/i'; + $iterator = new \RecursiveDirectoryIterator($this->directory); + $iterator = new \RecursiveIteratorIterator($iterator); + $iterator = new \RegexIterator($iterator, $pattern); + + foreach ($iterator as $name => $file) { + unlink($name); + } + + return true; + } + + /** + * {@inheritdoc} + */ + protected function doGetStats() + { + return null; + } +} \ No newline at end of file diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/FilesystemCache.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/FilesystemCache.php new file mode 100644 index 0000000000000000000000000000000000000000..a27a7176b839c073cd18aa4eef0cb9cf1dacab7c --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/FilesystemCache.php @@ -0,0 +1,114 @@ +<?php + +/* + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This software consists of voluntary contributions made by many individuals + * and is licensed under the MIT license. For more information, see + * <http://www.doctrine-project.org>. + */ + +namespace Doctrine\Common\Cache; + +/** + * Filesystem cache driver. + * + * @since 2.3 + * @author Fabio B. Silva <fabio.bat.silva@gmail.com> + */ +class FilesystemCache extends FileCache +{ + const EXTENSION = '.doctrinecache.data'; + + /** + * {@inheritdoc} + */ + protected $extension = self::EXTENSION; + + /** + * {@inheritdoc} + */ + protected function doFetch($id) + { + $data = ''; + $lifetime = -1; + $filename = $this->getFilename($id); + + if ( ! file_exists($filename)) { + return false; + } + + $resource = fopen($filename, "r"); + + if (false !== ($line = fgets($resource))) { + $lifetime = (integer) $line; + } + + if ($lifetime !== 0 && $lifetime < time()) { + fclose($resource); + + return false; + } + + while (false !== ($line = fgets($resource))) { + $data .= $line; + } + + fclose($resource); + + return unserialize($data); + } + + /** + * {@inheritdoc} + */ + protected function doContains($id) + { + $lifetime = -1; + $filename = $this->getFilename($id); + + if ( ! file_exists($filename)) { + return false; + } + + $resource = fopen($filename, "r"); + + if (false !== ($line = fgets($resource))) { + $lifetime = (integer) $line; + } + + fclose($resource); + + return $lifetime === 0 || $lifetime > time(); + } + + /** + * {@inheritdoc} + */ + protected function doSave($id, $data, $lifeTime = 0) + { + if ($lifeTime > 0) { + $lifeTime = time() + $lifeTime; + } + + $data = serialize($data); + $filename = $this->getFilename($id); + $filepath = pathinfo($filename, PATHINFO_DIRNAME); + + if ( ! is_dir($filepath)) { + mkdir($filepath, 0777, true); + } + + return file_put_contents($filename, $lifeTime . PHP_EOL . $data); + } +} \ No newline at end of file diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/MemcacheCache.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/MemcacheCache.php index dd6d1e31476c6df23600dc6b380d502374ff5da1..5687b965f1d5f3ad1cdbabea38d53e8a460fa2ba 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/MemcacheCache.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/MemcacheCache.php @@ -14,7 +14,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/MemcachedCache.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/MemcachedCache.php index 4675fae70bbee6757a3e73ac6b635fb858a25487..75f1345550affbdd9c4f2f3486ed7759d88d8fbd 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/MemcachedCache.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/MemcachedCache.php @@ -14,7 +14,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/PhpFileCache.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/PhpFileCache.php new file mode 100644 index 0000000000000000000000000000000000000000..0971cd96759a3064c3da3347cd3c2921de35f03a --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/PhpFileCache.php @@ -0,0 +1,108 @@ +<?php + +/* + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This software consists of voluntary contributions made by many individuals + * and is licensed under the MIT license. For more information, see + * <http://www.doctrine-project.org>. + */ + +namespace Doctrine\Common\Cache; + +/** + * Php file cache driver. + * + * @since 2.3 + * @author Fabio B. Silva <fabio.bat.silva@gmail.com> + */ +class PhpFileCache extends FileCache +{ + const EXTENSION = '.doctrinecache.php'; + + /** + * {@inheritdoc} + */ + protected $extension = self::EXTENSION; + + /** + * {@inheritdoc} + */ + protected function doFetch($id) + { + $filename = $this->getFilename($id); + + if ( ! file_exists($filename)) { + return false; + } + + $value = include $filename; + + if ($value['lifetime'] !== 0 && $value['lifetime'] < time()) { + return false; + } + + return $value['data']; + } + + /** + * {@inheritdoc} + */ + protected function doContains($id) + { + $filename = $this->getFilename($id); + + if ( ! file_exists($filename)) { + return false; + } + + $value = include $filename; + + return $value['lifetime'] === 0 || $value['lifetime'] > time(); + } + + /** + * {@inheritdoc} + */ + protected function doSave($id, $data, $lifeTime = 0) + { + if ($lifeTime > 0) { + $lifeTime = time() + $lifeTime; + } + + if (is_object($data) && ! method_exists($data, '__set_state')) { + throw new \InvalidArgumentException( + "Invalid argument given, PhpFileCache only allows objects that implement __set_state() " . + "and fully support var_export(). You can use the FilesystemCache to save arbitrary object " . + "graphs using serialize()/deserialize()." + ); + } + + $filename = $this->getFilename($id); + $filepath = pathinfo($filename, PATHINFO_DIRNAME); + + if ( ! is_dir($filepath)) { + mkdir($filepath, 0777, true); + } + + $value = array( + 'lifetime' => $lifeTime, + 'data' => $data + ); + + $value = var_export($value, true); + $code = sprintf('<?php return %s;', $value); + + return file_put_contents($filename, $code); + } +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/RedisCache.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/RedisCache.php new file mode 100644 index 0000000000000000000000000000000000000000..5d4814b5f5da03e1ab726c2d4128ce284b1948fc --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/RedisCache.php @@ -0,0 +1,119 @@ +<?php + +/* + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This software consists of voluntary contributions made by many individuals + * and is licensed under the MIT license. For more information, see + * <http://www.doctrine-project.org>. + */ + +namespace Doctrine\Common\Cache; + +use Redis; + +/** + * Redis cache provider. + * + * @license http://www.opensource.org/licenses/lgpl-license.php LGPL + * @link www.doctrine-project.org + * @since 2.2 + * @author Osman Ungur <osmanungur@gmail.com> + */ +class RedisCache extends CacheProvider +{ + /** + * @var Redis + */ + private $redis; + + /** + * Sets the redis instance to use. + * + * @param Redis $redis + */ + public function setRedis(Redis $redis) + { + $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_IGBINARY); + $this->redis = $redis; + } + + /** + * Gets the redis instance used by the cache. + * + * @return Redis + */ + public function getRedis() + { + return $this->redis; + } + + /** + * {@inheritdoc} + */ + protected function doFetch($id) + { + return $this->redis->get($id); + } + + /** + * {@inheritdoc} + */ + protected function doContains($id) + { + return $this->redis->exists($id); + } + + /** + * {@inheritdoc} + */ + protected function doSave($id, $data, $lifeTime = 0) + { + $result = $this->redis->set($id, $data); + if ($lifeTime > 0) { + $this->redis->expire($id, $lifeTime); + } + return $result; + } + + /** + * {@inheritdoc} + */ + protected function doDelete($id) + { + return $this->redis->delete($id); + } + + /** + * {@inheritdoc} + */ + protected function doFlush() + { + return $this->redis->flushDB(); + } + + /** + * {@inheritdoc} + */ + protected function doGetStats() + { + $info = $this->redis->info(); + return array( + Cache::STATS_HITS => false, + Cache::STATS_MISSES => false, + Cache::STATS_UPTIME => $info['uptime_in_seconds'], + Cache::STATS_MEMORY_USAGE => $info['used_memory'], + Cache::STATS_MEMORY_AVAILIABLE => false + ); + } +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/WinCacheCache.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/WinCacheCache.php index ed8ca74ab43ac3779b83aadafd3c1ca75a4e8e9b..777d0fd53553719d2e2177776f14dc16f52a176c 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/WinCacheCache.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/WinCacheCache.php @@ -14,7 +14,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -32,7 +32,7 @@ * @author Roman Borschel <roman@code-factory.org> * @author David Abdemoulaie <dave@hobodave.com> */ -class WincacheCache extends CacheProvider +class WinCacheCache extends CacheProvider { /** * {@inheritdoc} @@ -79,14 +79,15 @@ protected function doFlush() */ protected function doGetStats() { - $info = wincache_ucache_info(); - $meminfo= wincache_ucache_meminfo(); + $info = wincache_ucache_info(); + $meminfo = wincache_ucache_meminfo(); + return array( - Cache::STATS_HITS => $info['total_hit_count'], - Cache::STATS_MISSES => $info['total_miss_count'], - Cache::STATS_UPTIME => $info['total_cache_uptime'], - Cache::STATS_MEMORY_USAGE => $meminfo['memory_total'], - Cache::STATS_MEMORY_AVAILIABLE => $meminfo['memory_free'], + Cache::STATS_HITS => $info['total_hit_count'], + Cache::STATS_MISSES => $info['total_miss_count'], + Cache::STATS_UPTIME => $info['total_cache_uptime'], + Cache::STATS_MEMORY_USAGE => $meminfo['memory_total'], + Cache::STATS_MEMORY_AVAILIABLE => $meminfo['memory_free'], ); } -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/XcacheCache.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/XcacheCache.php index 6e22d26541976e2abf75364e6d42bb73226ae4f4..8733e266cc00cb8f3cac7917c4c59141a6419e81 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/XcacheCache.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/XcacheCache.php @@ -14,7 +14,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -107,4 +107,4 @@ protected function doGetStats() Cache::STATS_MEMORY_AVAILIABLE => $info['avail'], ); } -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/ZendDataCache.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/ZendDataCache.php index 4e4dabe775e2633a9b50867e5731af71b809cda4..fc90bc690912c6fefaec01d9547b7043a8723328 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/ZendDataCache.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/ZendDataCache.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/ClassLoader.php b/core/vendor/doctrine/common/lib/Doctrine/Common/ClassLoader.php index 375b0d6b4933ebf0c3b62246032f77aba95331de..45024e16cd6b99ca00ddd812e438f20fb7af91ef 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/ClassLoader.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/ClassLoader.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -149,7 +149,8 @@ public function unregister() /** * Loads the given class or interface. * - * @param string $classname The name of the class to load. + * @param string $className The name of the class to load. + * @return boolean TRUE if the class has been successfully loaded, FALSE otherwise. */ public function loadClass($className) @@ -244,7 +245,7 @@ public static function classExists($className) * for (and is able to load) the class with the given name. * * @param string $className The name of the class. - * @return The <tt>ClassLoader</tt> for the class or NULL if no such <tt>ClassLoader</tt> exists. + * @return ClassLoader The <tt>ClassLoader</tt> for the class or NULL if no such <tt>ClassLoader</tt> exists. */ public static function getClassLoader($className) { diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/ArrayCollection.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/ArrayCollection.php index 2a7d4eaf86de914784aac5162377c3b805793148..a075c08b10b34d2f1bd4403172c69771050e27df 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/ArrayCollection.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/ArrayCollection.php @@ -13,13 +13,15 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ namespace Doctrine\Common\Collections; use Closure, ArrayIterator; +use Doctrine\Common\Collections\Expr\Expression; +use Doctrine\Common\Collections\Expr\ClosureExpressionVisitor; /** * An ArrayCollection is a Collection implementation that wraps a regular PHP array. @@ -29,7 +31,7 @@ * @author Jonathan Wage <jonwage@gmail.com> * @author Roman Borschel <roman@code-factory.org> */ -class ArrayCollection implements Collection +class ArrayCollection implements Collection, Selectable { /** * An array containing the entries of this collection. @@ -151,6 +153,9 @@ public function removeElement($element) * ArrayAccess implementation of offsetExists() * * @see containsKey() + * + * @param mixed $offset + * @return bool */ public function offsetExists($offset) { @@ -161,6 +166,9 @@ public function offsetExists($offset) * ArrayAccess implementation of offsetGet() * * @see get() + * + * @param mixed $offset + * @return mixed */ public function offsetGet($offset) { @@ -168,10 +176,14 @@ public function offsetGet($offset) } /** - * ArrayAccess implementation of offsetGet() + * ArrayAccess implementation of offsetSet() * * @see add() * @see set() + * + * @param mixed $offset + * @param mixed $value + * @return bool */ public function offsetSet($offset, $value) { @@ -185,6 +197,9 @@ public function offsetSet($offset, $value) * ArrayAccess implementation of offsetUnset() * * @see remove() + * + * @param mixed $offset + * @return mixed */ public function offsetUnset($offset) { @@ -224,7 +239,7 @@ public function contains($element) } /** - * Tests for the existance of an element that satisfies the given predicate. + * Tests for the existence of an element that satisfies the given predicate. * * @param Closure $p The predicate. * @return boolean TRUE if the predicate is TRUE for at least one element, FALSE otherwise. @@ -328,7 +343,7 @@ public function add($value) /** * Checks whether the collection is empty. * - * Note: This is preferrable over count() == 0. + * Note: This is preferable over count() == 0. * * @return boolean TRUE if the collection is empty, FALSE otherwise. */ @@ -444,4 +459,52 @@ public function slice($offset, $length = null) { return array_slice($this->_elements, $offset, $length, true); } + + /** + * Select all elements from a selectable that match the criteria and + * return a new collection containing these elements. + * + * @param Criteria $criteria + * @return Collection + */ + public function matching(Criteria $criteria) + { + $expr = $criteria->getWhereExpression(); + $filtered = $this->_elements; + + if ($expr) { + $visitor = new ClosureExpressionVisitor(); + $filter = $visitor->dispatch($expr); + $filtered = array_filter($filtered, $filter); + } + + if ($orderings = $criteria->getOrderings()) { + $next = null; + foreach (array_reverse($orderings) as $field => $ordering) { + $next = ClosureExpressionVisitor::sortByField($field, $ordering == 'DESC' ? -1 : 1, $next); + } + + usort($filtered, $next); + } + + $offset = $criteria->getFirstResult(); + $length = $criteria->getMaxResults(); + + if ($offset || $length) { + $filtered = array_slice($filtered, (int)$offset, $length); + } + + return new static($filtered); + } + + /** + * Return the expression builder. + * + * @return ExpressionBuilder + */ + public function expr() + { + return new ExpressionBuilder(); + } } + diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Collection.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Collection.php index 9fca659c654005b3195441b992f0ba9434674aed..51eb9e7a763ff41dc02475fb82fbd814ae535e1a 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Collection.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Collection.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -240,4 +240,4 @@ function indexOf($element); * @return array */ function slice($offset, $length = null); -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Criteria.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Criteria.php new file mode 100644 index 0000000000000000000000000000000000000000..6eb52e5ccce3609bff774d1421cb12eacdcea8a2 --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Criteria.php @@ -0,0 +1,171 @@ +<?php +/* + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This software consists of voluntary contributions made by many individuals + * and is licensed under the MIT license. For more information, see + * <http://www.doctrine-project.org>. + */ + +namespace Doctrine\Common\Collections; + +use Doctrine\Common\Collections\Expr\Expression; + +/** + * Criteria for filtering Selectable collections. + * + * @author Benjamin Eberlei <kontakt@beberlei.de> + * @since 2.3 + */ +class Criteria +{ + /** + * @var string + */ + const ASC = 'ASC'; + + /** + * @var string + */ + const DESC = 'DESC'; + + /** + * @var \Doctrine\Common\Collections\Expr\Expression + */ + private $expression; + + /** + * @var array|null + */ + private $orderings; + + /** + * @var int + */ + private $firstResult; + + /** + * @var int + */ + private $maxResults; + + /** + * Construct new criteria + * + * @param Expression $expression + * @param array $orderings + * @param int $firstResult + * @param int $maxResults + */ + public function __construct(Expression $expression = null, array $orderings = null, $firstResult = null, $maxResults = null) + { + $this->expression = $expression; + $this->orderings = $orderings; + $this->firstResult = $firstResult; + $this->maxResults = $maxResults; + } + + /** + * Set the where expression to evaluate when this criteria is searched for. + * + * @param Expression + * @return Criteria + */ + public function where(Expression $expression) + { + $this->expression = $expression; + return $this; + } + + /** + * Get the expression attached to this criteria. + * + * @return Expression|null + */ + public function getWhereExpression() + { + return $this->expression; + } + + /** + * Get current orderings of this Criteria + * + * @return array + */ + public function getOrderings() + { + return $this->orderings; + } + + /** + * Set the ordering of the result of this criteria. + * + * Keys are field and values are the order, being either ASC or DESC. + * + * @see Criteria::ASC + * @see Criteria::DESC + * + * @param array + * @return Criteria + */ + public function orderBy(array $orderings) + { + $this->orderings = $orderings; + return $this; + } + + /** + * Get current first result option of the critera. + * + * @return firstResult. + */ + public function getFirstResult() + { + return $this->firstResult; + } + + /** + * Set number of first result that this criteria should return. + * + * @param firstResult the value to set. + * @return Criteria + */ + public function setFirstResult($firstResult) + { + $this->firstResult = $firstResult; + return $this; + } + + /** + * Get maxResults. + * + * @return maxResults. + */ + public function getMaxResults() + { + return $this->maxResults; + } + + /** + * Set maxResults. + * + * @param maxResults the value to set. + * @return Criteria + */ + public function setMaxResults($maxResults) + { + $this->maxResults = $maxResults; + return $this; + } +} + diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/ClosureExpressionVisitor.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/ClosureExpressionVisitor.php new file mode 100644 index 0000000000000000000000000000000000000000..06ccb047f0da050fd3a8bbd9004d50ce5446072e --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/ClosureExpressionVisitor.php @@ -0,0 +1,195 @@ +<?php +/* + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This software consists of voluntary contributions made by many individuals + * and is licensed under the MIT license. For more information, see + * <http://www.doctrine-project.org>. + */ + +namespace Doctrine\Common\Collections\Expr; + +/** + * Walks an expression graph and turns it into a PHP closure. + * + * This closure can be used with {@Collection#filter()} and is used internally + * by {@ArrayCollection#select()}. + * + * @author Benjamin Eberlei <kontakt@beberlei.de> + * @since 2.3 + */ +class ClosureExpressionVisitor extends ExpressionVisitor +{ + /** + * Access the field of a given object. This field has to be public directly + * or indirectly (through an accessor get* or a magic method, __get, __call). + * + * is*() is not supported. + * + * @return mixed + */ + static public function getObjectFieldValue($object, $field) + { + $accessor = "get" . $field; + + if (method_exists($object, $accessor) || method_exists($object, '__call')) { + return $object->$accessor(); + } + + if ($object instanceof \ArrayAccess) { + return $object[$field]; + } + + return $object->$field; + } + + /** + * Helper for sorting arrays of objects based on multiple fields + + * orientations. + * + * @param string $name + * @param int $orientation + * @param Closure $next + * @return Closure + */ + static public function sortByField($name, $orientation = 1, \Closure $next = null) + { + if (!$next) { + $next = function() { + return 0; + }; + } + + return function ($a, $b) use ($name, $next, $orientation) { + $aValue = ClosureExpressionVisitor::getObjectFieldValue($a, $name); + $bValue = ClosureExpressionVisitor::getObjectFieldValue($b, $name); + + if ($aValue === $bValue) { + return $next($a, $b); + } + + return (($aValue > $bValue) ? 1 : -1) * $orientation; + }; + } + + /** + * {@inheritDoc} + */ + public function walkComparison(Comparison $comparison) + { + $field = $comparison->getField(); + $value = $comparison->getValue()->getValue(); // shortcut for walkValue() + + switch ($comparison->getOperator()) { + case Comparison::EQ: + case Comparison::IS: + return function ($object) use ($field, $value) { + return ClosureExpressionVisitor::getObjectFieldValue($object, $field) === $value; + }; + + case Comparison::NEQ: + return function ($object) use ($field, $value) { + return ClosureExpressionVisitor::getObjectFieldValue($object, $field) !== $value; + }; + + case Comparison::LT: + return function ($object) use ($field, $value) { + return ClosureExpressionVisitor::getObjectFieldValue($object, $field) < $value; + }; + + case Comparison::LTE: + return function ($object) use ($field, $value) { + return ClosureExpressionVisitor::getObjectFieldValue($object, $field) <= $value; + }; + + case Comparison::GT: + return function ($object) use ($field, $value) { + return ClosureExpressionVisitor::getObjectFieldValue($object, $field) > $value; + }; + + case Comparison::GTE: + return function ($object) use ($field, $value) { + return ClosureExpressionVisitor::getObjectFieldValue($object, $field) >= $value; + }; + + case Comparison::IN: + return function ($object) use ($field, $value) { + return in_array(ClosureExpressionVisitor::getObjectFieldValue($object, $field), $value); + }; + + case Comparison::NIN: + return function ($object) use ($field, $value) { + return ! in_array(ClosureExpressionVisitor::getObjectFieldValue($object, $field), $value); + }; + + default: + throw new \RuntimeException("Unknown comparison operator: " . $comparison->getOperator()); + } + } + + /** + * {@inheritDoc} + */ + public function walkValue(Value $value) + { + return $value->getValue(); + } + + /** + * {@inheritDoc} + */ + public function walkCompositeExpression(CompositeExpression $expr) + { + $expressionList = array(); + + foreach ($expr->getExpressionList() as $child) { + $expressionList[] = $this->dispatch($child); + } + + switch($expr->getType()) { + case CompositeExpression::TYPE_AND: + return $this->andExpressions($expressionList); + + case CompositeExpression::TYPE_OR: + return $this->orExpressions($expressionList); + + default: + throw new \RuntimeException("Unknown composite " . $expr->getType()); + } + } + + private function andExpressions($expressions) + { + return function ($object) use ($expressions) { + foreach ($expressions as $expression) { + if ( ! $expression($object)) { + return false; + } + } + return true; + }; + } + + private function orExpressions($expressions) + { + return function ($object) use ($expressions) { + foreach ($expressions as $expression) { + if ($expression($object)) { + return true; + } + } + return false; + }; + } +} + diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/Comparison.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/Comparison.php new file mode 100644 index 0000000000000000000000000000000000000000..29cfcffa2cb6411c323b65d55811e1221999da42 --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/Comparison.php @@ -0,0 +1,75 @@ +<?php +/* + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This software consists of voluntary contributions made by many individuals + * and is licensed under the MIT license. For more information, see + * <http://www.doctrine-project.org>. + */ + +namespace Doctrine\Common\Collections\Expr; + +/** + * Comparison of a field with a value by the given operator. + * + * @author Benjamin Eberlei <kontakt@beberlei.de> + * @since 2.3 + */ +class Comparison implements Expression +{ + const EQ = '='; + const NEQ = '<>'; + const LT = '<'; + const LTE = '<='; + const GT = '>'; + const GTE = '>='; + const IS = 'IS'; + const IN = 'IN'; + const NIN = 'NIN'; + + private $field; + private $op; + private $value; + + public function __construct($field, $operator, $value) + { + if ( ! ($value instanceof Value)) { + $value = new Value($value); + } + + $this->field = $field; + $this->op = $operator; + $this->value = $value; + } + + public function getField() + { + return $this->field; + } + + public function getValue() + { + return $this->value; + } + + public function getOperator() + { + return $this->op; + } + + public function visit(ExpressionVisitor $visitor) + { + return $visitor->walkComparison($this); + } +} + diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/CompositeExpression.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/CompositeExpression.php new file mode 100644 index 0000000000000000000000000000000000000000..fe917cf3b54de854581d59ad04378792596991b4 --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/CompositeExpression.php @@ -0,0 +1,72 @@ +<?php +/* + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This software consists of voluntary contributions made by many individuals + * and is licensed under the MIT license. For more information, see + * <http://www.doctrine-project.org>. + */ + +namespace Doctrine\Common\Collections\Expr; + +/** + * Expression of Expressions combined by AND or OR operation. + * + * @author Benjamin Eberlei <kontakt@beberlei.de> + * @since 2.3 + */ +class CompositeExpression implements Expression +{ + const TYPE_AND = 'AND'; + const TYPE_OR = 'OR'; + + private $type; + private $expressions = array(); + + public function __construct($type, array $expressions) + { + $this->type = $type; + + foreach ($expressions as $expr) { + if ($expr instanceof Value) { + throw new \RuntimeException("Values are not supported expressions as children of and/or expressions."); + } + if ( ! ($expr instanceof Expression)) { + throw new \RuntimeException("No expression given to CompositeExpression."); + } + + $this->expressions[] = $expr; + } + } + + /** + * Return the list of expressions nested in this composite. + * + * @return Expression[] + */ + public function getExpressionList() + { + return $this->expressions; + } + + public function getType() + { + return $this->type; + } + + public function visit(ExpressionVisitor $visitor) + { + return $visitor->walkCompositeExpression($this); + } +} + diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/Expression.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/Expression.php new file mode 100644 index 0000000000000000000000000000000000000000..b0762ad2f44f01e8403212391d0dc8cbaef9e6b1 --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/Expression.php @@ -0,0 +1,31 @@ +<?php +/* + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This software consists of voluntary contributions made by many individuals + * and is licensed under the MIT license. For more information, see + * <http://www.doctrine-project.org>. + */ + +namespace Doctrine\Common\Collections\Expr; + +/** + * Expression for the {@link Selectable} interface. + * + * @author Benjamin Eberlei <kontakt@beberlei.de> + */ +interface Expression +{ + public function visit(ExpressionVisitor $visitor); +} + diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/ExpressionVisitor.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/ExpressionVisitor.php new file mode 100644 index 0000000000000000000000000000000000000000..5e69b987c7bf1e672fbba8a3c057d10a948b9fdd --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/ExpressionVisitor.php @@ -0,0 +1,81 @@ +<?php +/* + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This software consists of voluntary contributions made by many individuals + * and is licensed under the MIT license. For more information, see + * <http://www.doctrine-project.org>. + */ + +namespace Doctrine\Common\Collections\Expr; + +/** + * An Expression visitor walks a graph of expressions and turns them into a + * query for the underlying implementation. + * + * @author Benjamin Eberlei <kontakt@beberlei.de> + */ +abstract class ExpressionVisitor +{ + /** + * Convert a comparison expression into the target query language output + * + * @param Comparison $comparison + * + * @return mixed + */ + abstract public function walkComparison(Comparison $comparison); + + /** + * Convert a value expression into the target query language part. + * + * @param Value $value + * + * @return mixed + */ + abstract public function walkValue(Value $value); + + /** + * Convert a composite expression into the target query language output + * + * @param CompositeExpression $expr + * + * @return mixed + */ + abstract public function walkCompositeExpression(CompositeExpression $expr); + + /** + * Dispatch walking an expression to the appropriate handler. + * + * @param Expression + * + * @return mixed + */ + public function dispatch(Expression $expr) + { + switch (true) { + case ($expr instanceof Comparison): + return $this->walkComparison($expr); + + case ($expr instanceof Value): + return $this->walkValue($expr); + + case ($expr instanceof CompositeExpression): + return $this->walkCompositeExpression($expr); + + default: + throw new \RuntimeException("Unknown Expression " . get_class($expr)); + } + } +} + diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/Value.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/Value.php new file mode 100644 index 0000000000000000000000000000000000000000..f0df11ac6d1c3aee330c8d95d3c0035246a02364 --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/Value.php @@ -0,0 +1,41 @@ +<?php +/* + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This software consists of voluntary contributions made by many individuals + * and is licensed under the MIT license. For more information, see + * <http://www.doctrine-project.org>. + */ + +namespace Doctrine\Common\Collections\Expr; + +class Value implements Expression +{ + private $value; + + public function __construct($value) + { + $this->value = $value; + } + + public function getValue() + { + return $this->value; + } + + public function visit(ExpressionVisitor $visitor) + { + return $visitor->walkValue($this); + } +} + diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/ExpressionBuilder.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/ExpressionBuilder.php new file mode 100644 index 0000000000000000000000000000000000000000..b53f0cd747b6232697e3c1d1b873fc468489aa72 --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/ExpressionBuilder.php @@ -0,0 +1,149 @@ +<?php +/* + * THIS SOFTWARE IS PROVIDED BY THE COPYvalue HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYvalue + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This software consists of voluntary contributions made by many individuals + * and is licensed under the MIT license. For more information, see + * <http://www.doctrine-project.org>. + */ + +namespace Doctrine\Common\Collections; + +use Doctrine\Common\Collections\Expr\Comparison; +use Doctrine\Common\Collections\Expr\CompositeExpression; +use Doctrine\Common\Collections\Expr\Value; + +/** + * Builder for Expressions in the {@link Selectable} interface. + * + * @author Benjamin Eberlei <kontakt@beberlei.de> + * @since 2.3 + */ +class ExpressionBuilder +{ + /** + * @return CompositeExpression + */ + public function andX($x = null) + { + return new CompositeExpression(CompositeExpression::TYPE_AND, func_get_args()); + } + + /** + * @return CompositeExpression + */ + public function orX($x = null) + { + return new CompositeExpression(CompositeExpression::TYPE_OR, func_get_args()); + } + + /** + * @param string $field + * @param mixed $value + * + * @return Comparison + */ + public function eq($field, $value) + { + return new Comparison($field, Comparison::EQ, new Value($value)); + } + + /** + * @param string $field + * @param mixed $value + * + * @return Comparison + */ + public function gt($field, $value) + { + return new Comparison($field, Comparison::GT, new Value($value)); + } + + /** + * @param string $field + * @param mixed $value + * + * @return Comparison + */ + public function lt($field, $value) + { + return new Comparison($field, Comparison::LT, new Value($value)); + } + + /** + * @param string $field + * @param mixed $value + * + * @return Comparison + */ + public function gte($field, $value) + { + return new Comparison($field, Comparison::GTE, new Value($value)); + } + + /** + * @param string $field + * @param mixed $value + * + * @return Comparison + */ + public function lte($field, $value) + { + return new Comparison($field, Comparison::LTE, new Value($value)); + } + + /** + * @param string $field + * @param mixed $value + * + * @return Comparison + */ + public function neq($field, $value) + { + return new Comparison($field, Comparison::NEQ, new Value($value)); + } + + /** + * @param string $field + * @param mixed $value + * + * @return Comparison + */ + public function isNull($field) + { + return new Comparison($field, Comparison::IS, new Value(null)); + } + + /** + * @param string $field + * @param mixed $value + * + * @return Comparison + */ + public function in($field, array $values) + { + return new Comparison($field, Comparison::IN, new Value($values)); + } + + /** + * @param string $field + * @param mixed $value + * + * @return Comparison + */ + public function notIn($field, array $values) + { + return new Comparison($field, Comparison::NIN, new Value($values)); + } +} + diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Selectable.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Selectable.php new file mode 100644 index 0000000000000000000000000000000000000000..d5543c17f5d256d8aafba69638c9c2f02ce1773f --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Selectable.php @@ -0,0 +1,55 @@ +<?php +/* + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This software consists of voluntary contributions made by many individuals + * and is licensed under the MIT license. For more information, see + * <http://www.doctrine-project.org>. + */ + +namespace Doctrine\Common\Collections; + +/** + * Interface for collections that allow efficient filtering with an expression API. + * + * Goal of this interface is a backend independent method to fetch elements + * from a collections. {@link Expression} is crafted in a way that you can + * implement queries from both in-memory and database-backed collections. + * + * For database backed collections this allows very efficient access by + * utilizing the query APIs, for example SQL in the ORM. Applications using + * this API can implement efficient database access without having to ask the + * EntityManager or Repositories. + * + * @author Benjamin Eberlei <kontakt@beberlei.de> + * @since 2.3 + */ +interface Selectable +{ + /** + * Select all elements from a selectable that match the expression and + * return a new collection containing these elements. + * + * @param Criteria $criteria + * @return Collection + */ + function matching(Criteria $criteria); + + /** + * Return the expression builder. + * + * @return \Doctrine\Common\Collections\ExpressionBuilder + */ + function expr(); +} + diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/CommonException.php b/core/vendor/doctrine/common/lib/Doctrine/Common/CommonException.php index 8c5669be52dcfbc762000d9afdb25c5745163c68..6db7675950df813f449cef519e6369089da9af97 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/CommonException.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/CommonException.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -25,4 +25,4 @@ * */ class CommonException extends \Exception { -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Comparable.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Comparable.php index bc95d3030389eac9d9af0c70948fe717ba10f7d7..20d065e74d7c294e2019c09b9d09cafea08905bc 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Comparable.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Comparable.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -40,6 +40,8 @@ interface Comparable * This method should not check for identity using ===, only for semantical equality for example * when two different DateTime instances point to the exact same Date + TZ. * + * @param mixed $other + * * @return int */ public function compareTo($other); diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/EventArgs.php b/core/vendor/doctrine/common/lib/Doctrine/Common/EventArgs.php index 6a3c0699ad2233894125634d2ae35e4767d2822d..a87eee89ac7768b8ef8b348cd14ca264f6c54402 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/EventArgs.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/EventArgs.php @@ -15,7 +15,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -40,7 +40,6 @@ class EventArgs { /** * @var EventArgs Single instance of EventArgs - * @static */ private static $_emptyEventArgsInstance; @@ -55,7 +54,6 @@ class EventArgs * * @see EventManager::dispatchEvent * @link http://msdn.microsoft.com/en-us/library/system.eventargs.aspx - * @static * @return EventArgs */ public static function getEmptyInstance() diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/EventManager.php b/core/vendor/doctrine/common/lib/Doctrine/Common/EventManager.php index a1f11ed237ab81f802e919267d7a12606bd1ffd5..25aac445d117a9707aa0d1fc8c1f0b3a93e0f98a 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/EventManager.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/EventManager.php @@ -15,7 +15,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -127,10 +127,21 @@ public function removeEventListener($events, $listener) * Adds an EventSubscriber. The subscriber is asked for all the events he is * interested in and added as a listener for these events. * - * @param Doctrine\Common\EventSubscriber $subscriber The subscriber. + * @param \Doctrine\Common\EventSubscriber $subscriber The subscriber. */ public function addEventSubscriber(EventSubscriber $subscriber) { $this->addEventListener($subscriber->getSubscribedEvents(), $subscriber); } -} \ No newline at end of file + + /** + * Removes an EventSubscriber. The subscriber is asked for all the events it is + * interested in and removed as a listener for these events. + * + * @param \Doctrine\Common\EventSubscriber $subscriber The subscriber. + */ + public function removeEventSubscriber(EventSubscriber $subscriber) + { + $this->removeEventListener($subscriber->getSubscribedEvents(), $subscriber); + } +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/EventSubscriber.php b/core/vendor/doctrine/common/lib/Doctrine/Common/EventSubscriber.php index ed3383fafecb66d602c345e3ee431733a662b040..14587913a76ebbd10241aa47eab8473a4bc6a41e 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/EventSubscriber.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/EventSubscriber.php @@ -15,7 +15,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Lexer.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Lexer.php index 8df3b8437e3077c6dea0ecec6bd1c69bba476441..8e2554c75f8ef70676617c0085bdca5ae94d700c 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Lexer.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Lexer.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -145,7 +145,7 @@ public function moveNext() /** * Tells the lexer to skip input tokens until it sees a token with the given value. * - * @param $type The token type to skip until. + * @param string $type The token type to skip until. */ public function skipUntil($type) { @@ -263,4 +263,4 @@ abstract protected function getNonCatchablePatterns(); * @return integer */ abstract protected function getType(&$value); -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/NotifyPropertyChanged.php b/core/vendor/doctrine/common/lib/Doctrine/Common/NotifyPropertyChanged.php index 93e504aec1d62d15f363252d6ecded926d116a4a..e32c0b98e43cc0c4dd4ae30ee958b5de0bcb6c8d 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/NotifyPropertyChanged.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/NotifyPropertyChanged.php @@ -15,7 +15,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/AbstractManagerRegistry.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/AbstractManagerRegistry.php index f0452866bdae261a43b4035d383beae7ed9d1021..94fcd052a737f4848350ca3cb199607568640473 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/AbstractManagerRegistry.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/AbstractManagerRegistry.php @@ -14,7 +14,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -34,13 +34,46 @@ */ abstract class AbstractManagerRegistry implements ManagerRegistry { + /** + * @var string + */ private $name; + + /** + * @var array + */ private $connections; + + /** + * @var array + */ private $managers; + + /** + * @var string + */ private $defaultConnection; + + /** + * @var string + */ private $defaultManager; + + /** + * @var string + */ private $proxyInterfaceName; + /** + * Constructor + * + * @param string $name + * @param array $connections + * @param array $managers + * @param string $defaultConnection + * @param string $defaultManager + * @param string $proxyInterfaceName + */ public function __construct($name, array $connections, array $managers, $defaultConnection, $defaultManager, $proxyInterfaceName) { $this->name = $name; @@ -82,7 +115,7 @@ public function getName() } /** - * @inheritdoc + * {@inheritdoc} */ public function getConnection($name = null) { @@ -98,7 +131,7 @@ public function getConnection($name = null) } /** - * @inheritdoc + * {@inheritdoc} */ public function getConnectionNames() { @@ -106,7 +139,7 @@ public function getConnectionNames() } /** - * @inheritdoc + * {@inheritdoc} */ public function getConnections() { @@ -119,7 +152,7 @@ public function getConnections() } /** - * @inheritdoc + * {@inheritdoc} */ public function getDefaultConnectionName() { @@ -127,7 +160,7 @@ public function getDefaultConnectionName() } /** - * @inheritdoc + * {@inheritdoc} */ public function getDefaultManagerName() { @@ -135,7 +168,9 @@ public function getDefaultManagerName() } /** - * @inheritdoc + * {@inheritdoc} + * + * @throws \InvalidArgumentException */ public function getManager($name = null) { @@ -151,10 +186,16 @@ public function getManager($name = null) } /** - * @inheritdoc + * {@inheritdoc} */ public function getManagerForClass($class) { + // Check for namespace alias + if (strpos($class, ':') !== false) { + list($namespaceAlias, $simpleClassName) = explode(':', $class); + $class = $this->getAliasNamespace($namespaceAlias) . '\\' . $simpleClassName; + } + $proxyClass = new \ReflectionClass($class); if ($proxyClass->implementsInterface($this->proxyInterfaceName)) { $class = $proxyClass->getParentClass()->getName(); @@ -170,7 +211,7 @@ public function getManagerForClass($class) } /** - * @inheritdoc + * {@inheritdoc} */ public function getManagerNames() { @@ -178,7 +219,7 @@ public function getManagerNames() } /** - * @inheritdoc + * {@inheritdoc} */ public function getManagers() { @@ -191,7 +232,7 @@ public function getManagers() } /** - * @inheritdoc + * {@inheritdoc} */ public function getRepository($persistentObjectName, $persistentManagerName = null) { @@ -199,7 +240,7 @@ public function getRepository($persistentObjectName, $persistentManagerName = nu } /** - * @inheritdoc + * {@inheritdoc} */ public function resetManager($name = null) { diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ConnectionRegistry.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ConnectionRegistry.php index a47727fa0766b9c7c97b1c53ffd6d7b1e3d5272b..7d6f0cfb368875800f5b2fc6a740635e0e81f7ce 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ConnectionRegistry.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ConnectionRegistry.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -43,7 +43,7 @@ function getDefaultConnectionName(); * * @param string $name The connection name (null for the default one) * - * @return Connection + * @return object */ function getConnection($name = null); diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/LifecycleEventArgs.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/LifecycleEventArgs.php index 8055b66d6bf94da7aa94b6ea9c53f7527fff6055..2fb7c4737c0f0abe94ff75a0f774756ce8526f06 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/LifecycleEventArgs.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/LifecycleEventArgs.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -56,7 +56,7 @@ public function __construct($entity, ObjectManager $objectManager) } /** - * Retireve associated Entity. + * Retrieve associated Entity. * * @return object */ @@ -74,4 +74,4 @@ public function getObjectManager() { return $this->objectManager; } -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/LoadClassMetadataEventArgs.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/LoadClassMetadataEventArgs.php index 4a18d16759e023f3e0c8d2ac3c6647420559d74e..c014d7318e4d80e20066e13c93b1476c7b240996 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/LoadClassMetadataEventArgs.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/LoadClassMetadataEventArgs.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -44,7 +44,7 @@ class LoadClassMetadataEventArgs extends EventArgs /** * Constructor. * - * @param ClasseMetadata $classMetadata + * @param ClassMetadata $classMetadata * @param ObjectManager $objectManager */ public function __construct(ClassMetadata $classMetadata, ObjectManager $objectManager) diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/ManagerEventArgs.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/ManagerEventArgs.php index 33c4d7964e9043e1dcdd16808094983227c15c73..f1393658de1e0a0680c87773bafaa5700df51f98 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/ManagerEventArgs.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/ManagerEventArgs.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -56,4 +56,4 @@ public function getObjectManager() { return $this->objectManager; } -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/OnClearEventArgs.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/OnClearEventArgs.php index f67ab50e67bb5274b1c00d32d253a952fbcbe698..18b655411c8ec5bb4b846f75ddaebbffebfade4a 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/OnClearEventArgs.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/OnClearEventArgs.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -31,7 +31,7 @@ class OnClearEventArgs extends \Doctrine\Common\EventArgs { /** - * @var ObjectManager + * @var \Doctrine\Common\Persistence\ObjectManager */ private $objectManager; @@ -43,7 +43,7 @@ class OnClearEventArgs extends \Doctrine\Common\EventArgs /** * Constructor. * - * @param ObjectManager $objectManager + * @param \Doctrine\Common\Persistence\ObjectManager $objectManager * @param string $entityClass Optional entity class */ public function __construct($objectManager, $entityClass = null) @@ -55,7 +55,7 @@ public function __construct($objectManager, $entityClass = null) /** * Retrieve associated ObjectManager. * - * @return ObjectManager + * @return \Doctrine\Common\Persistence\ObjectManager */ public function getObjectManager() { @@ -81,4 +81,4 @@ public function clearsAllEntities() { return ($this->entityClass === null); } -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/PreUpdateEventArgs.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/PreUpdateEventArgs.php index 191d053abb9baf791e6fcb09b7c78ae67c91b3ef..86ac8193f818b369bea29f5602627454afaef0a4 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/PreUpdateEventArgs.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/PreUpdateEventArgs.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -64,6 +64,8 @@ public function getEntityChangeSet() /** * Check if field has a changeset. * + * @param string $field + * * @return boolean */ public function hasChangedField($field) @@ -114,6 +116,8 @@ public function setNewValue($field, $value) * Assert the field exists in changeset. * * @param string $field + * + * @throws \InvalidArgumentException */ private function assertValidField($field) { diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ManagerRegistry.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ManagerRegistry.php index 4d92426b12d436f7429389ac4dbad5142ff12bcb..bdb23bd2903ec6e736b3766b6e8cb69c8c08ec1a 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ManagerRegistry.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ManagerRegistry.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -50,7 +50,7 @@ function getManager($name = null); /** * Gets an array of all registered object managers * - * @return array An array of ObjectManager instances + * @return \Doctrine\Common\Persistence\ObjectManager[] An array of ObjectManager instances */ function getManagers(); diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php index a2a618506e926ca023cfd81b1444a1be6b519d09..1ace1ccb60ffa0e46fbe652a36a2f9666e823a16 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php @@ -13,13 +13,14 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ namespace Doctrine\Common\Persistence\Mapping; -use Doctrine\Common\Cache\Cache; +use Doctrine\Common\Cache\Cache, + Doctrine\Common\Util\ClassUtils; /** * The ClassMetadataFactory is used to create ClassMetadata objects that contain all the @@ -134,7 +135,7 @@ abstract protected function getFqcnFromAlias($namespaceAlias, $simpleClassName); /** * Return the mapping driver implementation. * - * @return MappingDriver + * @return \Doctrine\Common\Persistence\Mapping\Driver\MappingDriver */ abstract protected function getDriver(); @@ -151,54 +152,69 @@ abstract protected function wakeupReflection(ClassMetadata $class, ReflectionSer * Initialize Reflection after ClassMetadata was constructed. * * @param ClassMetadata $class - * @param ReflectionSErvice $reflService + * @param ReflectionService $reflService * @return void */ abstract protected function initializeReflection(ClassMetadata $class, ReflectionService $reflService); + /** + * Checks whether the class metadata is an entity. + * + * This method should false for mapped superclasses or + * embedded classes. + * + * @param ClassMetadata $class + * @return boolean + */ + abstract protected function isEntity(ClassMetadata $class); + /** * Gets the class metadata descriptor for a class. * * @param string $className The name of the class. - * @return Doctrine\Common\Persistence\Mapping\ClassMetadata + * @return \Doctrine\Common\Persistence\Mapping\ClassMetadata */ public function getMetadataFor($className) { - if ( ! isset($this->loadedMetadata[$className])) { - $realClassName = $className; + if (isset($this->loadedMetadata[$className])) { + return $this->loadedMetadata[$className]; + } - // Check for namespace alias - if (strpos($className, ':') !== false) { - list($namespaceAlias, $simpleClassName) = explode(':', $className); - $realClassName = $this->getFqcnFromAlias($namespaceAlias, $simpleClassName); + $realClassName = $className; - if (isset($this->loadedMetadata[$realClassName])) { - // We do not have the alias name in the map, include it - $this->loadedMetadata[$className] = $this->loadedMetadata[$realClassName]; + // Check for namespace alias + if (strpos($className, ':') !== false) { + list($namespaceAlias, $simpleClassName) = explode(':', $className); + $realClassName = $this->getFqcnFromAlias($namespaceAlias, $simpleClassName); + } else { + $realClassName = ClassUtils::getRealClass($realClassName); + } - return $this->loadedMetadata[$realClassName]; - } - } + if (isset($this->loadedMetadata[$realClassName])) { + // We do not have the alias name in the map, include it + $this->loadedMetadata[$className] = $this->loadedMetadata[$realClassName]; - if ($this->cacheDriver) { - if (($cached = $this->cacheDriver->fetch($realClassName . $this->cacheSalt)) !== false) { - $this->loadedMetadata[$realClassName] = $cached; - $this->wakeupReflection($cached, $this->getReflectionService()); - } else { - foreach ($this->loadMetadata($realClassName) as $loadedClassName) { - $this->cacheDriver->save( - $loadedClassName . $this->cacheSalt, $this->loadedMetadata[$loadedClassName], null - ); - } - } + return $this->loadedMetadata[$realClassName]; + } + + if ($this->cacheDriver) { + if (($cached = $this->cacheDriver->fetch($realClassName . $this->cacheSalt)) !== false) { + $this->loadedMetadata[$realClassName] = $cached; + $this->wakeupReflection($cached, $this->getReflectionService()); } else { - $this->loadMetadata($realClassName); + foreach ($this->loadMetadata($realClassName) as $loadedClassName) { + $this->cacheDriver->save( + $loadedClassName . $this->cacheSalt, $this->loadedMetadata[$loadedClassName], null + ); + } } + } else { + $this->loadMetadata($realClassName); + } - if ($className != $realClassName) { - // We do not have the alias name in the map, include it - $this->loadedMetadata[$className] = $this->loadedMetadata[$realClassName]; - } + if ($className != $realClassName) { + // We do not have the alias name in the map, include it + $this->loadedMetadata[$className] = $this->loadedMetadata[$realClassName]; } return $this->loadedMetadata[$className]; @@ -251,7 +267,8 @@ protected function getParentClasses($name) * is still not loaded. * * @param string $name The name of the class for which the metadata should get loaded. - * @param array $tables The metadata collection to which the loaded metadata is added. + * + * @return array */ protected function loadMetadata($name) { @@ -272,7 +289,7 @@ protected function loadMetadata($name) foreach ($parentClasses as $className) { if (isset($this->loadedMetadata[$className])) { $parent = $this->loadedMetadata[$className]; - if (isset($parent->isMappedSuperclass) && $parent->isMappedSuperclass === false) { + if ($this->isEntity($parent)) { $rootEntityFound = true; array_unshift($visited, $className); } @@ -282,13 +299,13 @@ protected function loadMetadata($name) $class = $this->newClassMetadataInstance($className); $this->initializeReflection($class, $reflService); - $this->doLoadMetadata($class, $parent, $rootEntityFound); + $this->doLoadMetadata($class, $parent, $rootEntityFound, $visited); $this->loadedMetadata[$className] = $class; $parent = $class; - if (isset($parent->isMappedSuperclass) && $class->isMappedSuperclass === false) { + if ($this->isEntity($class)) { $rootEntityFound = true; array_unshift($visited, $className); } @@ -305,11 +322,12 @@ protected function loadMetadata($name) * Actually load the metadata from the underlying metadata * * @param ClassMetadata $class - * @param ClassMetadata $parent + * @param ClassMetadata|null $parent * @param bool $rootEntityFound + * @param array $nonSuperclassParents classnames all parent classes that are not marked as mapped superclasses * @return void */ - abstract protected function doLoadMetadata($class, $parent, $rootEntityFound); + abstract protected function doLoadMetadata($class, $parent, $rootEntityFound, array $nonSuperclassParents); /** * Creates a new ClassMetadata instance for the given class name. @@ -331,6 +349,12 @@ public function isTransient($class) $this->initialize(); } + // Check for namespace alias + if (strpos($class, ':') !== false) { + list($namespaceAlias, $simpleClassName) = explode(':', $class); + $class = $this->getFqcnFromAlias($namespaceAlias, $simpleClassName); + } + return $this->getDriver()->isTransient($class); } diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/ClassMetadata.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/ClassMetadata.php index 705d59acf18e1c3f44c03593690d394303688f65..4836bf87238a23bad87abde808f39d1d22bdf37e 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/ClassMetadata.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/ClassMetadata.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -49,7 +49,7 @@ function getIdentifier(); /** * Gets the ReflectionClass instance for this mapped class. * - * @return ReflectionClass + * @return \ReflectionClass */ function getReflectionClass(); diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/ClassMetadataFactory.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/ClassMetadataFactory.php index bf27ba9aba9b274b9e85f0d9ed3f521266a9b5c1..3fa39bcb3d912fc4e301ee7752586426eab528b2 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/ClassMetadataFactory.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/ClassMetadataFactory.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/AnnotationDriver.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/AnnotationDriver.php index f52d37eee713c7c8bb1839ff637bd64957da4705..1131add5a0886b30c59244d4c1817ed305bc3be0 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/AnnotationDriver.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/AnnotationDriver.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -118,7 +118,7 @@ public function getReader() /** * Get the file extension used to look for mapping files under * - * @return void + * @return string */ public function getFileExtension() { diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/DefaultFileLocator.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/DefaultFileLocator.php index efaf545ee484e9fcab3a268a8fe8661f02f73ecb..0d61174fe777ff2aded705e40e6a3614c1b618f5 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/DefaultFileLocator.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/DefaultFileLocator.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -51,6 +51,7 @@ class DefaultFileLocator implements FileLocator * documents and operates in the specified operating mode. * * @param string|array $paths One or multiple paths where mapping documents can be found. + * @param string|null $fileExtension */ public function __construct($paths, $fileExtension = null) { @@ -81,7 +82,7 @@ public function getPaths() /** * Get the file extension used to look for mapping files under * - * @return void + * @return string */ public function getFileExtension() { @@ -166,4 +167,4 @@ public function fileExists($className) return false; } -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/FileDriver.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/FileDriver.php index 22cf117d5a2c95083166e96d1dd602a5c1c6821e..b0a7685c8ec22151d9a70339cdac01dae7bb805b 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/FileDriver.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/FileDriver.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -58,7 +58,7 @@ abstract class FileDriver implements MappingDriver * Initializes a new FileDriver that looks in the given path(s) for mapping * documents and operates in the specified operating mode. * - * @param string|array|FileLocator $paths A FileLocator or one/multiple paths where mapping documents can be found. + * @param string|array|FileLocator $locator A FileLocator or one/multiple paths where mapping documents can be found. * @param string $fileExtension */ public function __construct($locator, $fileExtension = null) @@ -70,11 +70,21 @@ public function __construct($locator, $fileExtension = null) } } + /** + * Set global basename + * + * @param string $file + */ public function setGlobalBasename($file) { $this->globalBasename = $file; } + /** + * Retrieve global basename + * + * @return string + */ public function getGlobalBasename() { return $this->globalBasename; @@ -84,7 +94,10 @@ public function getGlobalBasename() * Get the element of schema meta data for the class from the mapping file. * This will lazily load the mapping file if it is not loaded yet * - * @return array $element The element of schema meta data + * @param string $className + * + * @throws MappingException + * @return array The element of schema meta data */ public function getElement($className) { @@ -97,6 +110,9 @@ public function getElement($className) } $result = $this->loadMappingFile($this->locator->findMappingFile($className)); + if (!isset($result[$className])) { + throw MappingException::invalidMappingFile($className, str_replace('\\', '.', $className) . $this->locator->getFileExtension()); + } return $result[$className]; } @@ -175,4 +191,24 @@ protected function initialize() } } } -} \ No newline at end of file + + /** + * Retrieve the locator used to discover mapping files by className + * + * @return FileLocator + */ + public function getLocator() + { + return $this->locator; + } + + /** + * Set the locator used to discover mapping files by className + * + * @param FileLocator $locator + */ + public function setLocator(FileLocator $locator) + { + $this->locator = $locator; + } +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/FileLocator.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/FileLocator.php index a1019d71f14559c1e80a801d83887f8051db646e..ec2b60652ff0008bb470cba3e82d70798a0556ec 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/FileLocator.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/FileLocator.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -22,7 +22,7 @@ /** * Locate the file that contains the metadata information for a given class name. * - * This behavior is inpependent of the actual content of the file. It just detects + * This behavior is independent of the actual content of the file. It just detects * the file which is responsible for the given class name. * * @author Benjamin Eberlei <kontakt@beberlei.de> @@ -49,6 +49,8 @@ function getAllClassNames($globalBasename); /** * Check if a file can be found for this class name. * + * @param string $className + * * @return bool */ function fileExists($className); diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/MappingDriver.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/MappingDriver.php index c050d32337319bdc98eedd139320ce744f3e0c92..955d831dcf6edab65ee63ac2bcde235e7a4b326e 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/MappingDriver.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/MappingDriver.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -53,4 +53,4 @@ function getAllClassNames(); * @return boolean */ function isTransient($className); -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/MappingDriverChain.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/MappingDriverChain.php index c7c145270e0675c213d279cfb7650b80708aba4b..3b1049dfe2a7d2b8d372c920fc6d3b023597c438 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/MappingDriverChain.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/MappingDriverChain.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -35,15 +35,42 @@ */ class MappingDriverChain implements MappingDriver { + /** + * The default driver + * + * @var MappingDriver + */ + private $defaultDriver; + /** * @var array */ private $drivers = array(); + /** + * Get the default driver. + * + * @return MappingDriver|null + */ + public function getDefaultDriver() + { + return $this->defaultDriver; + } + + /** + * Set the default driver. + * + * @param MappingDriver $driver + */ + public function setDefaultDriver(MappingDriver $driver) + { + $this->defaultDriver = $driver; + } + /** * Add a nested driver. * - * @param Driver $nestedDriver + * @param MappingDriver $nestedDriver * @param string $namespace */ public function addDriver(MappingDriver $nestedDriver, $namespace) @@ -65,10 +92,13 @@ public function getDrivers() * Loads the metadata for the specified class into the provided container. * * @param string $className - * @param ClassMetadataInfo $metadata + * @param ClassMetadata $metadata + * + * @throws MappingException */ public function loadMetadataForClass($className, ClassMetadata $metadata) { + /* @var $driver MappingDriver */ foreach ($this->drivers as $namespace => $driver) { if (strpos($className, $namespace) === 0) { $driver->loadMetadataForClass($className, $metadata); @@ -76,6 +106,11 @@ public function loadMetadataForClass($className, ClassMetadata $metadata) } } + if (null !== $this->defaultDriver) { + $this->defaultDriver->loadMetadataForClass($className, $metadata); + return; + } + throw MappingException::classNotFoundInNamespaces($className, array_keys($this->drivers)); } @@ -88,8 +123,11 @@ public function getAllClassNames() { $classNames = array(); $driverClasses = array(); + + /* @var $driver MappingDriver */ foreach ($this->drivers AS $namespace => $driver) { $oid = spl_object_hash($driver); + if (!isset($driverClasses[$oid])) { $driverClasses[$oid] = $driver->getAllClassNames(); } @@ -100,6 +138,7 @@ public function getAllClassNames() } } } + return array_keys($classNames); } @@ -113,13 +152,17 @@ public function getAllClassNames() */ public function isTransient($className) { + /* @var $driver MappingDriver */ foreach ($this->drivers AS $namespace => $driver) { if (strpos($className, $namespace) === 0) { return $driver->isTransient($className); } } - // class isTransient, i.e. not an entity or mapped superclass + if ($this->defaultDriver !== null) { + return $this->defaultDriver->isTransient($className); + } + return true; } -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/PHPDriver.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/PHPDriver.php index 7751dae3b5588f0864d5d5bf767ca648bcc84e23..e0c861133ae6031cf16fc02d907501de88166caf 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/PHPDriver.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/PHPDriver.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -66,5 +66,7 @@ protected function loadMappingFile($file) { $metadata = $this->metadata; include $file; + + return array($metadata->getName() => $metadata); } } diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/StaticPHPDriver.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/StaticPHPDriver.php index 9103ed863bf2c8e4aeb3e3c0ebf013035a98f724..e3cea73000fb715682f0b8dc4b3fc32d7b30cfcf 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/StaticPHPDriver.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/StaticPHPDriver.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -50,11 +50,21 @@ class StaticPHPDriver implements MappingDriver */ private $classNames; + /** + * Constructor + * + * @param array|string $paths + */ public function __construct($paths) { $this->addPaths((array) $paths); } + /** + * Add paths + * + * @param array $paths + */ public function addPaths(array $paths) { $this->paths = array_unique(array_merge($this->paths, $paths)); diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/SymfonyFileLocator.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/SymfonyFileLocator.php index d338cf6079e16900cae9f86d5529bac69088a60c..9095187d27c78500f143d703fe8411d540672639 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/SymfonyFileLocator.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/SymfonyFileLocator.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -53,18 +53,34 @@ class SymfonyFileLocator implements FileLocator */ protected $fileExtension; + /** + * Constructor + * + * @param array $prefixes + * @param string|null $fileExtension + */ public function __construct(array $prefixes, $fileExtension = null) { $this->addNamespacePrefixes($prefixes); $this->fileExtension = $fileExtension; } + /** + * Add Namespace Prefixes + * + * @param array $prefixes + */ public function addNamespacePrefixes(array $prefixes) { $this->prefixes = array_merge($this->prefixes, $prefixes); $this->paths = array_merge($this->paths, array_keys($prefixes)); } + /** + * Get Namespace Prefixes + * + * @return array + */ public function getNamespacePrefixes() { return $this->prefixes; diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/MappingException.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/MappingException.php index 4ecd2ad5531fa9f0447cc5c1384049e5ec5f5a1e..c1e7ad5740294ad5646baecc09a32626e7afd177 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/MappingException.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/MappingException.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.phpdoctrine.org>. */ @@ -26,18 +26,32 @@ */ class MappingException extends \Exception { + /** + * + * @param string $className + * @param array $namespaces + * + * @return MappingException + */ public static function classNotFoundInNamespaces($className, $namespaces) { return new self("The class '" . $className . "' was not found in the ". "chain configured namespaces " . implode(", ", $namespaces)); } + /** + * @return MappingException + */ public static function pathRequired() { return new self("Specifying the paths to your entities is required ". "in the AnnotationDriver to retrieve all class names."); } + /** + * @param string|null $path + * @return MappingException + */ public static function fileMappingDriversRequireConfiguredDirectoryPath($path = null) { if ( ! empty($path)) { @@ -50,8 +64,23 @@ public static function fileMappingDriversRequireConfiguredDirectoryPath($path = ); } + /** + * @param string $entityName + * @param string $fileName + * @return MappingException + */ public static function mappingFileNotFound($entityName, $fileName) { return new self("No mapping file found named '$fileName' for class '$entityName'."); } + + /** + * @param string $entityName + * @param string $fileName + * @return MappingException + */ + public static function invalidMappingFile($entityName, $fileName) + { + return new self("Invalid mapping file '$fileName' for class '$entityName'."); + } } diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/ReflectionService.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/ReflectionService.php index 4e0e312fd440e3d71f0a313418ca8c4cb47c76df..3db85d9fff2b6dd5c8db1eeae38690ae1cc172f5 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/ReflectionService.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/ReflectionService.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -55,7 +55,7 @@ function getClassNamespace($class); * Return a reflection class instance or null * * @param string $class - * @return ReflectionClass|null + * @return \ReflectionClass|null */ function getClass($class); @@ -64,7 +64,7 @@ function getClass($class); * * @param string $class * @param string $property - * @return ReflectionProperty|null + * @return \ReflectionProperty|null */ function getAccessibleProperty($class, $property); diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/RuntimeReflectionService.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/RuntimeReflectionService.php index abcff58139efd386c82980b05ad14eef8948110b..77b9e76062579d6ac65a5569e95e4723a217ed4a 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/RuntimeReflectionService.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/RuntimeReflectionService.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/StaticReflectionService.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/StaticReflectionService.php index 2de6e761326ed55a1de36fdfab45b5e82398f146..4f6d1cfad44d1cf9f5c19bf009626996ce5f7a48 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/StaticReflectionService.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/StaticReflectionService.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectManager.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectManager.php index 6d70fc1227c63c0f27deb9f33e382b463604b656..2bb87222608c0c1b363903861a45e9ecfbc17915 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectManager.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectManager.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -68,9 +68,18 @@ function remove($object); * The object passed to merge will not become associated/managed with this ObjectManager. * * @param object $object + * @return object */ function merge($object); + /** + * Clears the ObjectManager. All objects that are currently managed + * by this ObjectManager become detached. + * + * @param string $objectName if given, only objects of this type will get detached + */ + function clear($objectName = null); + /** * Detaches an object from the ObjectManager, causing a managed object to * become detached. Unflushed changes made to the object if any @@ -119,7 +128,7 @@ function getClassMetadata($className); /** * Gets the metadata factory used to gather the metadata of classes. * - * @return Doctrine\Common\Persistence\Mapping\ClassMetadataFactory + * @return \Doctrine\Common\Persistence\Mapping\ClassMetadataFactory */ function getMetadataFactory(); diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectManagerAware.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectManagerAware.php index 015dd3dd9e5b67f54d8e48ba5d0d70d2d890b0a7..69fba78d66980ffbd36624785d2bfd9d3bc33f96 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectManagerAware.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectManagerAware.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectRepository.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectRepository.php index 22633288ee30b40a3c338817fb6fdee9e542458d..9a3e5b6f7debc325d0aba4c691c9d4710acb8c8e 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectRepository.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectRepository.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -33,7 +33,7 @@ interface ObjectRepository /** * Finds an object by its primary key / identifier. * - * @param $id The identifier. + * @param int $id The identifier. * @return object The object. */ function find($id); @@ -52,7 +52,7 @@ function findAll(); * an UnexpectedValueException if certain values of the sorting or limiting details are * not supported. * - * @throws UnexpectedValueException + * @throws \UnexpectedValueException * @param array $criteria * @param array|null $orderBy * @param int|null $limit diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/PersistentObject.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/PersistentObject.php index 4274af62461df969ac79f1d511e53671543b6c8e..9fcc4cba11e47c7ad7ffb9b287da8534314dcaf8 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/PersistentObject.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/PersistentObject.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -90,6 +90,8 @@ static public function getObjectManager() * * @param ObjectManager $objectManager * @param ClassMetadata $classMetadata + * + * @throws \RuntimeException */ public function injectObjectManager(ObjectManager $objectManager, ClassMetadata $classMetadata) { @@ -104,10 +106,11 @@ public function injectObjectManager(ObjectManager $objectManager, ClassMetadata /** * Sets a persistent fields value. * - * @throws InvalidArgumentException - When the wrong target object type is passed to an association - * @throws BadMethodCallException - When no persistent field exists by that name. * @param string $field * @param array $args + * + * @throws \BadMethodCallException - When no persistent field exists by that name. + * @throws \InvalidArgumentException - When the wrong target object type is passed to an association * @return void */ private function set($field, $args) @@ -131,8 +134,10 @@ private function set($field, $args) /** * Get persistent field value. * - * @throws BadMethodCallException - When no persistent field exists by that name. + * * @param string $field + * + * @throws \BadMethodCallException - When no persistent field exists by that name. * @return mixed */ private function get($field) @@ -169,8 +174,11 @@ private function completeOwningSide($field, $targetClass, $targetObject) /** * Add an object to a collection * - * @param type $field - * @param assoc $args + * @param string $field + * @param array $args + * + * @throws \BadMethodCallException + * @throws \InvalidArgumentException */ private function add($field, $args) { @@ -194,6 +202,7 @@ private function add($field, $args) /** * Initialize Doctrine Metadata for this class. * + * @throws \RuntimeException * @return void */ private function initializeDoctrine() @@ -214,6 +223,8 @@ private function initializeDoctrine() * * @param string $method * @param array $args + * + * @throws \BadMethodCallException * @return mixed */ public function __call($method, $args) diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Proxy.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Proxy.php index 726979fcf384333b0939083158c98ca3ecb4e1d2..e25598c670bbdb84a23f657a4fc2ff8a70f6e9e4 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Proxy.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Proxy.php @@ -14,7 +14,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/PropertyChangedListener.php b/core/vendor/doctrine/common/lib/Doctrine/Common/PropertyChangedListener.php index 87c5b413dd9c50eb12c227f5ca8951314b8ea968..1171874bc27196241d6834ac96de31c8d947db60 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/PropertyChangedListener.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/PropertyChangedListener.php @@ -15,7 +15,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/ClassFinderInterface.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/ClassFinderInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..ae696076870d60ffff7a5483389e3939f6faf34b --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/ClassFinderInterface.php @@ -0,0 +1,38 @@ +<?php +/* + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This software consists of voluntary contributions made by many individuals + * and is licensed under the MIT license. For more information, see + * <http://www.doctrine-project.org>. + */ + +namespace Doctrine\Common\Reflection; + +/** + * Finds a class in a PSR-0 structure. + * + * @author Karoly Negyesi <karoly@negyesi.net> + */ +interface ClassFinderInterface +{ + /** + * Finds a class. + * + * @param string $class The name of the class. + * + * @return + * The name of the class or NULL if not found. + */ + public function findFile($class); +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/Psr0FindFile.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/Psr0FindFile.php new file mode 100644 index 0000000000000000000000000000000000000000..b6a5fd112451bc96044b35ff2b13b385003fabed --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/Psr0FindFile.php @@ -0,0 +1,83 @@ +<?php +/* + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This software consists of voluntary contributions made by many individuals + * and is licensed under the MIT license. For more information, see + * <http://www.doctrine-project.org>. + */ + +namespace Doctrine\Common\Reflection; + +/** + * Finds a class in a PSR-0 structure. + * + * @author Karoly Negyesi <karoly@negyesi.net> + */ +class Psr0FindFile implements ClassFinderInterface +{ + /** + * The PSR-0 prefixes. + * + * @var string + */ + protected $prefixes; + + /** + * @param string $prefixes + * An array of prefixes. Each key is a PHP namespace and each value is + * a list of directories. + */ + public function __construct($prefixes) + { + $this->prefixes = $prefixes; + } + + /** + * Finds a class. + * + * @param string $class The name of the class. + * + * @return + * The name of the class or NULL if not found. + */ + public function findFile($class) + { + $lastNsPos = strrpos($class, '\\'); + if ('\\' == $class[0]) { + $class = substr($class, 1); + } + + if (false !== $lastNsPos) { + // namespaced class name + $classPath = str_replace('\\', DIRECTORY_SEPARATOR, substr($class, 0, $lastNsPos)) . DIRECTORY_SEPARATOR; + $className = substr($class, $lastNsPos + 1); + } else { + // PEAR-like class name + $classPath = null; + $className = $class; + } + + $classPath .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; + + foreach ($this->prefixes as $prefix => $dirs) { + if (0 === strpos($class, $prefix)) { + foreach ($dirs as $dir) { + if (file_exists($dir . DIRECTORY_SEPARATOR . $classPath)) { + return $dir . DIRECTORY_SEPARATOR . $classPath; + } + } + } + } + } +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/ReflectionProviderInterface.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/ReflectionProviderInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..a436a2d78a2f44f37f007a42bfcafe13b045af2c --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/ReflectionProviderInterface.php @@ -0,0 +1,45 @@ +<?php + +/* + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This software consists of voluntary contributions made by many individuals + * and is licensed under the MIT license. For more information, see + * <http://www.doctrine-project.org>. + */ + +namespace Doctrine\Common\Reflection; + +interface ReflectionProviderInterface +{ + /** + * Get the ReflectionClass equivalent for this class. + * + * @return ReflectionClass + */ + public function getReflectionClass(); + + /** + * Get the ReflectionClass equivalent for this class. + * + * @return ReflectionMethod + */ + public function getReflectionMethod($name); + + /** + * Get the ReflectionClass equivalent for this class. + * + * @return ReflectionMethod + */ + public function getReflectionProperty($name); +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionClass.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionClass.php new file mode 100644 index 0000000000000000000000000000000000000000..12e45d57d68bbe38585ea532e63440d98628711c --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionClass.php @@ -0,0 +1,112 @@ +<?php +/* + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This software consists of voluntary contributions made by many individuals + * and is licensed under the MIT license. For more information, see + * <http://www.doctrine-project.org>. + */ + +namespace Doctrine\Common\Reflection; + +use ReflectionClass; +use ReflectionException; + +class StaticReflectionClass extends ReflectionClass +{ + /** + * The static reflection parser object. + * + * @var StaticReflectionParser + */ + private $staticReflectionParser; + + public function __construct(StaticReflectionParser $staticReflectionParser) + { + $this->staticReflectionParser = $staticReflectionParser; + } + + public function getName() + { + return $this->staticReflectionParser->getClassName(); + } + + public function getDocComment() + { + return $this->staticReflectionParser->getDocComment(); + } + + public function getNamespaceName() + { + return $this->staticReflectionParser->getNamespaceName(); + } + + public function getUseStatements() + { + return $this->staticReflectionParser->getUseStatements(); + } + + public function getMethod($name) + { + return $this->staticReflectionParser->getReflectionMethod($name); + } + + public function getProperty($name) + { + return $this->staticReflectionParser->getReflectionProperty($name); + } + + public static function export($argument, $return = false) { throw new ReflectionException('Method not implemented'); } + public function getConstant($name) { throw new ReflectionException('Method not implemented'); } + public function getConstants() { throw new ReflectionException('Method not implemented'); } + public function getConstructor() { throw new ReflectionException('Method not implemented'); } + public function getDefaultProperties() { throw new ReflectionException('Method not implemented'); } + public function getEndLine() { throw new ReflectionException('Method not implemented'); } + public function getExtension() { throw new ReflectionException('Method not implemented'); } + public function getExtensionName() { throw new ReflectionException('Method not implemented'); } + public function getFileName() { throw new ReflectionException('Method not implemented'); } + public function getInterfaceNames() { throw new ReflectionException('Method not implemented'); } + public function getInterfaces() { throw new ReflectionException('Method not implemented'); } + public function getMethods($filter = NULL) { throw new ReflectionException('Method not implemented'); } + public function getModifiers() { throw new ReflectionException('Method not implemented'); } + public function getParentClass() { throw new ReflectionException('Method not implemented'); } + public function getProperties($filter = NULL) { throw new ReflectionException('Method not implemented'); } + public function getShortName() { throw new ReflectionException('Method not implemented'); } + public function getStartLine() { throw new ReflectionException('Method not implemented'); } + public function getStaticProperties() { throw new ReflectionException('Method not implemented'); } + public function getStaticPropertyValue($name, $default = '') { throw new ReflectionException('Method not implemented'); } + public function getTraitAliases() { throw new ReflectionException('Method not implemented'); } + public function getTraitNames() { throw new ReflectionException('Method not implemented'); } + public function getTraits() { throw new ReflectionException('Method not implemented'); } + public function hasConstant($name) { throw new ReflectionException('Method not implemented'); } + public function hasMethod($name) { throw new ReflectionException('Method not implemented'); } + public function hasProperty($name) { throw new ReflectionException('Method not implemented'); } + public function implementsInterface($interface) { throw new ReflectionException('Method not implemented'); } + public function inNamespace() { throw new ReflectionException('Method not implemented'); } + public function isAbstract() { throw new ReflectionException('Method not implemented'); } + public function isCloneable() { throw new ReflectionException('Method not implemented'); } + public function isFinal() { throw new ReflectionException('Method not implemented'); } + public function isInstance($object) { throw new ReflectionException('Method not implemented'); } + public function isInstantiable() { throw new ReflectionException('Method not implemented'); } + public function isInterface() { throw new ReflectionException('Method not implemented'); } + public function isInternal() { throw new ReflectionException('Method not implemented'); } + public function isIterateable() { throw new ReflectionException('Method not implemented'); } + public function isSubclassOf($class) { throw new ReflectionException('Method not implemented'); } + public function isTrait() { throw new ReflectionException('Method not implemented'); } + public function isUserDefined() { throw new ReflectionException('Method not implemented'); } + public function newInstance($args) { throw new ReflectionException('Method not implemented'); } + public function newInstanceArgs(array $args = array()) { throw new ReflectionException('Method not implemented'); } + public function newInstanceWithoutConstructor() { throw new ReflectionException('Method not implemented'); } + public function setStaticPropertyValue($name, $value) { throw new ReflectionException('Method not implemented'); } + public function __toString() { throw new ReflectionException('Method not implemented'); } +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionMethod.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionMethod.php new file mode 100644 index 0000000000000000000000000000000000000000..6482036e521713e54e66e8d9da8ccfebf0dbf4b8 --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionMethod.php @@ -0,0 +1,103 @@ +<?php +/* + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This software consists of voluntary contributions made by many individuals + * and is licensed under the MIT license. For more information, see + * <http://www.doctrine-project.org>. + */ + +namespace Doctrine\Common\Reflection; + +use ReflectionMethod; +use ReflectionException; + +class StaticReflectionMethod extends ReflectionMethod +{ + /** + * The PSR-0 parser object. + * + * @var StaticReflectionParser + */ + protected $staticReflectionParser; + + /** + * The name of the method. + * + * @var string + */ + protected $methodName; + + public function __construct(StaticReflectionParser $staticReflectionParser, $methodName) + { + $this->staticReflectionParser = $staticReflectionParser; + $this->methodName = $methodName; + } + public function getName() + { + return $this->methodName; + } + protected function getStaticReflectionParser() + { + return $this->staticReflectionParser->getStaticReflectionParserForDeclaringClass('method', $this->methodName); + } + public function getDeclaringClass() + { + return $this->getStaticReflectionParser()->getReflectionClass(); + } + public function getNamespaceName() + { + return $this->getStaticReflectionParser()->getNamespaceName(); + } + public function getDocComment() + { + return $this->getStaticReflectionParser()->getDocComment('method', $this->methodName); + } + public function getUseStatements() + { + return $this->getStaticReflectionParser()->getUseStatements(); + } + public static function export($class, $name, $return = false) { throw new ReflectionException('Method not implemented'); } + public function getClosure($object) { throw new ReflectionException('Method not implemented'); } + public function getModifiers() { throw new ReflectionException('Method not implemented'); } + public function getPrototype() { throw new ReflectionException('Method not implemented'); } + public function invoke($object, $parameter = NULL) { throw new ReflectionException('Method not implemented'); } + public function invokeArgs($object, array $args) { throw new ReflectionException('Method not implemented'); } + public function isAbstract() { throw new ReflectionException('Method not implemented'); } + public function isConstructor() { throw new ReflectionException('Method not implemented'); } + public function isDestructor() { throw new ReflectionException('Method not implemented'); } + public function isFinal() { throw new ReflectionException('Method not implemented'); } + public function isPrivate() { throw new ReflectionException('Method not implemented'); } + public function isProtected() { throw new ReflectionException('Method not implemented'); } + public function isPublic() { throw new ReflectionException('Method not implemented'); } + public function isStatic() { throw new ReflectionException('Method not implemented'); } + public function setAccessible($accessible) { throw new ReflectionException('Method not implemented'); } + public function __toString() { throw new ReflectionException('Method not implemented'); } + public function getClosureThis() { throw new ReflectionException('Method not implemented'); } + public function getEndLine() { throw new ReflectionException('Method not implemented'); } + public function getExtension() { throw new ReflectionException('Method not implemented'); } + public function getExtensionName() { throw new ReflectionException('Method not implemented'); } + public function getFileName() { throw new ReflectionException('Method not implemented'); } + public function getNumberOfParameters() { throw new ReflectionException('Method not implemented'); } + public function getNumberOfRequiredParameters() { throw new ReflectionException('Method not implemented'); } + public function getParameters() { throw new ReflectionException('Method not implemented'); } + public function getShortName() { throw new ReflectionException('Method not implemented'); } + public function getStartLine() { throw new ReflectionException('Method not implemented'); } + public function getStaticVariables() { throw new ReflectionException('Method not implemented'); } + public function inNamespace() { throw new ReflectionException('Method not implemented'); } + public function isClosure() { throw new ReflectionException('Method not implemented'); } + public function isDeprecated() { throw new ReflectionException('Method not implemented'); } + public function isInternal() { throw new ReflectionException('Method not implemented'); } + public function isUserDefined() { throw new ReflectionException('Method not implemented'); } + public function returnsReference() { throw new ReflectionException('Method not implemented'); } +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionParser.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionParser.php new file mode 100644 index 0000000000000000000000000000000000000000..7f3e41fecbf8c18874bc9950a2ef6ec2700fc72d --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionParser.php @@ -0,0 +1,282 @@ +<?php +/* + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This software consists of voluntary contributions made by many individuals + * and is licensed under the MIT license. For more information, see + * <http://www.doctrine-project.org>. + */ + +namespace Doctrine\Common\Reflection; + +use ReflectionException; +use Doctrine\Common\Annotations\TokenParser; + +/** + * Parses a file for namespaces/use/class declarations. + * + * @author Karoly Negyesi <karoly@negyesi.net> + */ +class StaticReflectionParser implements ReflectionProviderInterface +{ + + /** + * The name of the class. + * + * @var string + */ + protected $className; + + /** + * TRUE if the caller only wants class annotations. + * + * @var boolean. + */ + protected $classAnnotationOptimize; + + /** + * TRUE when the parser has ran. + * + * @var boolean + */ + protected $parsed = false; + + /** + * The namespace of the class + * + * @var string + */ + protected $namespace = ''; + + /** + * The use statements of this class. + * + * @var array + */ + protected $useStatements = array(); + + /** + * The docComment of the class. + * + * @var string + */ + protected $docComment = array( + 'class' => '', + 'property' => array(), + 'method' => array(), + ); + + /** + * The name of the class this class extends, if any. + * + * @var string + */ + protected $parentClassName = ''; + + /** + * The parent PSR-0 Parser. + * + * @var \Doctrine\Common\Annotations\StaticReflectionParser + */ + protected $parentStaticReflectionParser; + + /** + * Parses a class residing in a PSR-0 hierarchy. + * + * @param string $class + * The full, namespaced class name. + * @param ClassFinder $finder + * A ClassFinder object which finds the class. + * @param boolean $classAnnotationOptimize + * Only retrieve the class docComment. Presumes there is only one + * statement per line. + */ + public function __construct($className, $finder, $classAnnotationOptimize = false) + { + $this->className = ltrim($className, '\\'); + if ($lastNsPos = strrpos($this->className, '\\')) { + $this->namespace = substr($this->className, 0, $lastNsPos); + } + $this->finder = $finder; + $this->classAnnotationOptimize = $classAnnotationOptimize; + } + + protected function parse() + { + if ($this->parsed || !$fileName = $this->finder->findFile($this->className)) { + return; + } + $this->parsed = true; + $contents = file_get_contents($fileName); + if ($this->classAnnotationOptimize) { + if (preg_match("/(\A.*)^\s+(abstract|final)?\s+class\s+$className\s+{/sm", $contents, $matches)) { + $contents = $matches[1]; + } + } + $tokenParser = new TokenParser($contents); + $docComment = ''; + while ($token = $tokenParser->next(false)) { + if (is_array($token)) { + switch ($token[0]) { + case T_USE: + $this->useStatements = array_merge($this->useStatements, $tokenParser->parseUseStatement()); + break; + case T_DOC_COMMENT: + $docComment = $token[1]; + break; + case T_CLASS: + $this->docComment['class'] = $docComment; + $docComment = ''; + break; + case T_VAR: + case T_PRIVATE: + case T_PROTECTED: + case T_PUBLIC: + $token = $tokenParser->next(); + if ($token[0] === T_VARIABLE) { + $propertyName = substr($token[1], 1); + $this->docComment['property'][$propertyName] = $docComment; + continue 2; + } + if ($token[0] !== T_FUNCTION) { + // For example, it can be T_FINAL. + continue 2; + } + // No break. + case T_FUNCTION: + // The next string after function is the name, but + // there can be & before the function name so find the + // string. + while (($token = $tokenParser->next()) && $token[0] !== T_STRING); + $methodName = $token[1]; + $this->docComment['method'][$methodName] = $docComment; + $docComment = ''; + break; + case T_EXTENDS: + $this->parentClassName = $tokenParser->parseClass(); + $nsPos = strpos($this->parentClassName, '\\'); + $fullySpecified = false; + if ($nsPos === 0) { + $fullySpecified = true; + } else { + if ($nsPos) { + $prefix = strtolower(substr($this->parentClassName, 0, $nsPos)); + $postfix = substr($this->parentClassName, $nsPos); + } else { + $prefix = strtolower($this->parentClassName); + $postfix = ''; + } + foreach ($this->useStatements as $alias => $use) { + if ($alias == $prefix) { + $this->parentClassName = '\\' . $use . $postfix; + $fullySpecified = true; + } + } + } + if (!$fullySpecified) { + $this->parentClassName = '\\' . $this->namespace . '\\' . $this->parentClassName; + } + break; + } + } + } + } + + protected function getParentStaticReflectionParser() + { + if (empty($this->parentStaticReflectionParser)) { + $this->parentStaticReflectionParser = new static($this->parentClassName, $this->finder); + } + + return $this->parentStaticReflectionParser; + } + + public function getClassName() + { + return $this->className; + } + + public function getNamespaceName() + { + return $this->namespace; + } + + /** + * Get the ReflectionClass equivalent for this file / class. + */ + public function getReflectionClass() + { + return new StaticReflectionClass($this); + } + + /** + * Get the ReflectionMethod equivalent for the method of this file / class. + */ + public function getReflectionMethod($methodName) + { + return new StaticReflectionMethod($this, $methodName); + } + + /** + * Get the ReflectionProperty equivalent for the method of this file / class. + */ + public function getReflectionProperty($propertyName) + { + return new StaticReflectionProperty($this, $propertyName); + } + + /** + * Get the use statements from this file. + */ + public function getUseStatements() + { + $this->parse(); + + return $this->useStatements; + } + + /** + * Get docComment. + * + * @param string $type class, property or method. + * @param string $name Name of the property or method, not needed for class. + * + * @return string the doc comment or empty string if none. + */ + public function getDocComment($type = 'class', $name = '') + { + $this->parse(); + + return $name ? $this->docComment[$type][$name] : $this->docComment[$type]; + } + + /** + * Get the PSR-0 parser for the declaring class. + * + * @param string $type property or method. + * @param string $name Name of the property or method. + * + * @return StaticReflectionParser A static reflection parser for the declaring class. + */ + public function getStaticReflectionParserForDeclaringClass($type, $name) + { + $this->parse(); + if (isset($this->docComment[$type][$name])) { + return $this; + } + if (!empty($this->parentClassName)) { + return $this->getParentStaticReflectionParser()->getStaticReflectionParserForDeclaringClass($type, $name); + } + throw new ReflectionException('Invalid ' . $type . ' "' . $name . '"'); + } +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionProperty.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionProperty.php new file mode 100644 index 0000000000000000000000000000000000000000..7c6411a9d0964376c546ba34e4f49a692ec0af8c --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionProperty.php @@ -0,0 +1,77 @@ +<?php +/* + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This software consists of voluntary contributions made by many individuals + * and is licensed under the MIT license. For more information, see + * <http://www.doctrine-project.org>. + */ + +namespace Doctrine\Common\Reflection; + +use ReflectionProperty; +use ReflectionException; + +class StaticReflectionProperty extends ReflectionProperty +{ + /** + * The PSR-0 parser object. + * + * @var StaticReflectionParser + */ + protected $staticReflectionParser; + + /** + * The name of the property. + * + * @var string + */ + protected $propertyName; + + public function __construct(StaticReflectionParser $staticReflectionParser, $propertyName) + { + $this->staticReflectionParser = $staticReflectionParser; + $this->propertyName = $propertyName; + } + public function getName() + { + return $this->propertyName; + } + protected function getStaticReflectionParser() + { + return $this->staticReflectionParser->getStaticReflectionParserForDeclaringClass('property', $this->propertyName); + } + public function getDeclaringClass() + { + return $this->getStaticReflectionParser()->getReflectionClass(); + } + public function getDocComment() + { + return $this->getStaticReflectionParser()->getDocComment('property', $this->propertyName); + } + public function getUseStatements() + { + return $this->getStaticReflectionParser()->getUseStatements(); + } + public static function export ($class, $name, $return = false) { throw new ReflectionException('Method not implemented'); } + public function getModifiers() { throw new ReflectionException('Method not implemented'); } + public function getValue($object = NULL) { throw new ReflectionException('Method not implemented'); } + public function isDefault() { throw new ReflectionException('Method not implemented'); } + public function isPrivate() { throw new ReflectionException('Method not implemented'); } + public function isProtected() { throw new ReflectionException('Method not implemented'); } + public function isPublic() { throw new ReflectionException('Method not implemented'); } + public function isStatic() { throw new ReflectionException('Method not implemented'); } + public function setAccessible ($accessible) { throw new ReflectionException('Method not implemented'); } + public function setValue ($object, $value = NULL) { throw new ReflectionException('Method not implemented'); } + public function __toString() { throw new ReflectionException('Method not implemented'); } +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Util/ClassUtils.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Util/ClassUtils.php index c346278280808f28cb5897a31aeab09d7dbaa2b0..078a8dba05844209a80746450c8b76f7911b690d 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Util/ClassUtils.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Util/ClassUtils.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -71,7 +71,7 @@ public static function getParentClass($className) * Create a new reflection class * * @param string - * @return ReflectionClass + * @return \ReflectionClass */ public static function newReflectionClass($class) { @@ -82,7 +82,7 @@ public static function newReflectionClass($class) * Create a new reflection object * * @param object - * @return ReflectionObject + * @return \ReflectionObject */ public static function newReflectionObject($object) { diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Util/Debug.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Util/Debug.php index 57ae312028f267d70a2d0374a3825da1be369f28..458e5c8848b5d8901f35de1d3e88051977c65ec6 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Util/Debug.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Util/Debug.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -41,7 +41,6 @@ private function __construct() {} /** * Prints a dump of the public, protected and private properties of $var. * - * @static * @link http://xdebug.org/ * @param mixed $var * @param integer $maxDepth Maximum nesting level for object properties @@ -67,6 +66,13 @@ public static function dump($var, $maxDepth = 2, $stripTags = true) ini_set('html_errors', 'Off'); } + /** + * Export + * + * @param mixed $var + * @param int $maxDepth + * @return mixed + */ public static function export($var, $maxDepth) { $return = null; @@ -116,6 +122,12 @@ public static function export($var, $maxDepth) return $return; } + /** + * Convert to string + * + * @param object $obj + * @return string + */ public static function toString($obj) { return method_exists('__toString', $obj) ? (string) $obj : get_class($obj) . '@' . spl_object_hash($obj); diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Util/Inflector.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Util/Inflector.php index ba1eb17b2da01ce5c0a87731f08c989d79680e21..214ed5744953a27933b617f73aa19af11041b367 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Util/Inflector.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Util/Inflector.php @@ -15,7 +15,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -69,4 +69,4 @@ public static function camelize($word) { return lcfirst(self::classify($word)); } -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Version.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Version.php index b7c9a8284e560d26097d327b756df1dca968a850..e196424364feaada67ca6be4909628ebf0104ad4 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Version.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Version.php @@ -13,7 +13,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ @@ -36,7 +36,7 @@ class Version /** * Current Doctrine Version */ - const VERSION = '2.2.2'; + const VERSION = '2.3.0-RC1'; /** * Compares a Doctrine version with the current one. diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/AbstractReaderTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/AbstractReaderTest.php index 0a329a3c01d62ce9f090d0ed996c53c830fac7a1..4261e6b7a7ee47eceeaaf158128c71ce284269c8 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/AbstractReaderTest.php +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/AbstractReaderTest.php @@ -3,6 +3,8 @@ namespace Doctrine\Tests\Common\Annotations; use Doctrine\Common\Annotations\DoctrineReader; +use Doctrine\Common\Reflection\StaticReflectionParser; +use Doctrine\Common\Reflection\Psr0FindFile; use Doctrine\Common\Annotations\Annotation\IgnoreAnnotation; use Doctrine\Common\Annotations\Annotation\IgnorePhpDoc; use ReflectionClass, Doctrine\Common\Annotations\AnnotationReader; @@ -19,11 +21,26 @@ abstract class AbstractReaderTest extends \PHPUnit_Framework_TestCase { - public function testAnnotations() + public function getReflectionClass() { - $reader = $this->getReader(); + $className = 'Doctrine\Tests\Common\Annotations\DummyClass'; + $testsRoot = substr(__DIR__, 0, -strlen(__NAMESPACE__) - 1); + $paths = array( + 'Doctrine\\Tests' => array($testsRoot), + ); + $staticReflectionParser = new StaticReflectionParser($className, new Psr0FindFile($paths)); + return array( + 'native' => array(new ReflectionClass($className)), + 'static' => array($staticReflectionParser->getReflectionClass()), + ); + } - $class = new ReflectionClass('Doctrine\Tests\Common\Annotations\DummyClass'); + /** + * @dataProvider getReflectionClass + */ + public function testAnnotations($class) + { + $reader = $this->getReader(); $this->assertEquals(1, count($reader->getClassAnnotations($class))); $this->assertInstanceOf($annotName = 'Doctrine\Tests\Common\Annotations\DummyAnnotation', $annot = $reader->getClassAnnotation($class, $annotName)); $this->assertEquals("hello", $annot->dummyValue); @@ -398,44 +415,6 @@ class TestImportWithConcreteAnnotation private $field; } -/** - * A description of this class. - * - * Let's see if the parser recognizes that this @ is not really referring to an - * annotation. Also make sure that @var \ is not concated to "@var\is". - * - * @author robo - * @since 2.0 - * @DummyAnnotation(dummyValue="hello") - */ -class DummyClass { - /** - * A nice property. - * - * @var mixed - * @DummyAnnotation(dummyValue="fieldHello") - */ - private $field1; - - /** - * @DummyJoinTable(name="join_table", - * joinColumns={@DummyJoinColumn(name="col1", referencedColumnName="col2")}, - * inverseJoinColumns={ - * @DummyJoinColumn(name="col3", referencedColumnName="col4") - * }) - */ - private $field2; - - /** - * Gets the value of field1. - * - * @return mixed - * @DummyAnnotation({1,2,"three"}) - */ - public function getField1() { - } -} - /** * @ignoreAnnotation("var") */ diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/DocLexerTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/DocLexerTest.php index cb080f08203ad76fe97fad9075abeda14d37905b..03a55c8054041c80baa21caac820ce1effc29d23 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/DocLexerTest.php +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/DocLexerTest.php @@ -24,4 +24,114 @@ public function testMarkerAnnotation() $this->assertFalse($lexer->moveNext()); } + + public function testScannerTokenizesDocBlockWhitConstants() + { + $lexer = new DocLexer(); + $docblock = '@AnnotationWithConstants(PHP_EOL, ClassWithConstants::SOME_VALUE, \Doctrine\Tests\Common\Annotations\Fixtures\IntefaceWithConstants::SOME_VALUE)'; + + $tokens = array ( + array( + 'value' => '@', + 'position' => 0, + 'type' => DocLexer::T_AT, + ), + array( + 'value' => 'AnnotationWithConstants', + 'position' => 1, + 'type' => DocLexer::T_IDENTIFIER, + ), + array( + 'value' => '(', + 'position' => 24, + 'type' => DocLexer::T_OPEN_PARENTHESIS, + ), + array( + 'value' => 'PHP_EOL', + 'position' => 25, + 'type' => DocLexer::T_IDENTIFIER, + ), + array( + 'value' => ',', + 'position' => 32, + 'type' => DocLexer::T_COMMA, + ), + array( + 'value' => 'ClassWithConstants::SOME_VALUE', + 'position' => 34, + 'type' => DocLexer::T_IDENTIFIER, + ), + array( + 'value' => ',', + 'position' => 64, + 'type' => DocLexer::T_COMMA, + ), + array( + 'value' => '\\Doctrine\\Tests\\Common\\Annotations\\Fixtures\\IntefaceWithConstants::SOME_VALUE', + 'position' => 66, + 'type' => DocLexer::T_IDENTIFIER, + ), + array( + 'value' => ')', + 'position' => 143, + 'type' => DocLexer::T_CLOSE_PARENTHESIS, + ) + + ); + + $lexer->setInput($docblock); + + foreach ($tokens as $expected) { + $lexer->moveNext(); + $lookahead = $lexer->lookahead; + $this->assertEquals($expected['value'], $lookahead['value']); + $this->assertEquals($expected['type'], $lookahead['type']); + $this->assertEquals($expected['position'], $lookahead['position']); + } + + $this->assertFalse($lexer->moveNext()); + } + + + public function testScannerTokenizesDocBlockWhitInvalidIdentifier() + { + $lexer = new DocLexer(); + $docblock = '@Foo\3.42'; + + $tokens = array ( + array( + 'value' => '@', + 'position' => 0, + 'type' => DocLexer::T_AT, + ), + array( + 'value' => 'Foo', + 'position' => 1, + 'type' => DocLexer::T_IDENTIFIER, + ), + array( + 'value' => '\\', + 'position' => 4, + 'type' => DocLexer::T_NAMESPACE_SEPARATOR, + ), + array( + 'value' => 3.42, + 'position' => 5, + 'type' => DocLexer::T_FLOAT, + ) + ); + + $lexer->setInput($docblock); + + foreach ($tokens as $expected) { + $lexer->moveNext(); + $lookahead = $lexer->lookahead; + $this->assertEquals($expected['value'], $lookahead['value']); + $this->assertEquals($expected['type'], $lookahead['type']); + $this->assertEquals($expected['position'], $lookahead['position']); + } + + $this->assertFalse($lexer->moveNext()); + } + } \ No newline at end of file diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/DocParserTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/DocParserTest.php index 56cae7fd60dd297b2c96172df92879f170486a6d..b14698f8e9c369f388de552ec2014c646f6e067d 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/DocParserTest.php +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/DocParserTest.php @@ -7,6 +7,9 @@ use Doctrine\Common\Annotations\DocParser; use Doctrine\Common\Annotations\AnnotationRegistry; use Doctrine\Common\Annotations\Annotation\Target; +use Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithConstants; +use Doctrine\Tests\Common\Annotations\Fixtures\ClassWithConstants; +use Doctrine\Tests\Common\Annotations\Fixtures\IntefaceWithConstants; class DocParserTest extends \PHPUnit_Framework_TestCase { @@ -662,6 +665,93 @@ public function testAnnotationWithRequiredAttributesWithoutContructor() } + public function getConstantsProvider() + { + $provider[] = array( + '@AnnotationWithConstants(PHP_EOL)', + PHP_EOL + ); + $provider[] = array( + '@AnnotationWithConstants(AnnotationWithConstants::INTEGER)', + AnnotationWithConstants::INTEGER + ); + $provider[] = array( + '@Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithConstants(AnnotationWithConstants::STRING)', + AnnotationWithConstants::STRING + ); + $provider[] = array( + '@AnnotationWithConstants(Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithConstants::FLOAT)', + AnnotationWithConstants::FLOAT + ); + $provider[] = array( + '@AnnotationWithConstants(ClassWithConstants::SOME_VALUE)', + ClassWithConstants::SOME_VALUE + ); + $provider[] = array( + '@AnnotationWithConstants(Doctrine\Tests\Common\Annotations\Fixtures\ClassWithConstants::SOME_VALUE)', + ClassWithConstants::SOME_VALUE + ); + $provider[] = array( + '@AnnotationWithConstants(IntefaceWithConstants::SOME_VALUE)', + IntefaceWithConstants::SOME_VALUE + ); + $provider[] = array( + '@AnnotationWithConstants(\Doctrine\Tests\Common\Annotations\Fixtures\IntefaceWithConstants::SOME_VALUE)', + IntefaceWithConstants::SOME_VALUE + ); + $provider[] = array( + '@AnnotationWithConstants({AnnotationWithConstants::STRING, AnnotationWithConstants::INTEGER, AnnotationWithConstants::FLOAT})', + array(AnnotationWithConstants::STRING, AnnotationWithConstants::INTEGER, AnnotationWithConstants::FLOAT) + ); + $provider[] = array( + '@AnnotationWithConstants({ + AnnotationWithConstants::STRING = AnnotationWithConstants::INTEGER + })', + array(AnnotationWithConstants::STRING => AnnotationWithConstants::INTEGER) + ); + $provider[] = array( + '@AnnotationWithConstants({ + Doctrine\Tests\Common\Annotations\Fixtures\IntefaceWithConstants::SOME_KEY = AnnotationWithConstants::INTEGER + })', + array(IntefaceWithConstants::SOME_KEY => AnnotationWithConstants::INTEGER) + ); + $provider[] = array( + '@AnnotationWithConstants({ + \Doctrine\Tests\Common\Annotations\Fixtures\IntefaceWithConstants::SOME_KEY = AnnotationWithConstants::INTEGER + })', + array(IntefaceWithConstants::SOME_KEY => AnnotationWithConstants::INTEGER) + ); + $provider[] = array( + '@AnnotationWithConstants({ + AnnotationWithConstants::STRING = AnnotationWithConstants::INTEGER, + ClassWithConstants::SOME_KEY = ClassWithConstants::SOME_VALUE, + Doctrine\Tests\Common\Annotations\Fixtures\ClassWithConstants::SOME_KEY = IntefaceWithConstants::SOME_VALUE + })', + array( + AnnotationWithConstants::STRING => AnnotationWithConstants::INTEGER, + ClassWithConstants::SOME_KEY => ClassWithConstants::SOME_VALUE, + ClassWithConstants::SOME_KEY => IntefaceWithConstants::SOME_VALUE + ) + ); + return $provider; + } + + /** + * @dataProvider getConstantsProvider + */ + public function testSupportClassConstants($docblock, $expected) + { + $parser = $this->createTestParser(); + $parser->setImports(array( + 'classwithconstants' => 'Doctrine\Tests\Common\Annotations\Fixtures\ClassWithConstants', + 'intefacewithconstants' => 'Doctrine\Tests\Common\Annotations\Fixtures\IntefaceWithConstants', + 'annotationwithconstants' => 'Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithConstants' + )); + + $result = $parser->parse($docblock); + $this->assertInstanceOf('\Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithConstants', $annotation = $result[0]); + $this->assertEquals($expected, $annotation->value); + } /** * @expectedException Doctrine\Common\Annotations\AnnotationException @@ -1045,9 +1135,9 @@ public function testArrayWithColon() /** * @expectedException Doctrine\Common\Annotations\AnnotationException - * @expectedExceptionMessage [Syntax Error] Expected PlainValue, got 'foo:' at position 6. + * @expectedExceptionMessage [Semantical Error] Couldn't find constant foo. */ - public function testColonNotAllowedOnTopLevel() + public function testInvalidContantName() { $parser = $this->createTestParser(); $parser->parse('@Name(foo: "bar")'); diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/DummyClass.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/DummyClass.php new file mode 100644 index 0000000000000000000000000000000000000000..17223f68adf59a20ad89404bf78fd2b37f02c67f --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/DummyClass.php @@ -0,0 +1,48 @@ +<?php + +namespace Doctrine\Tests\Common\Annotations; + +use Doctrine\Tests\Common\Annotations\DummyAnnotation; +use Doctrine\Tests\Common\Annotations\Name; +use Doctrine\Tests\Common\Annotations\DummyJoinTable; +use Doctrine\Tests\Common\Annotations\DummyJoinColumn; + +/** + * A description of this class. + * + * Let's see if the parser recognizes that this @ is not really referring to an + * annotation. Also make sure that @var \ is not concated to "@var\is". + * + * @author robo + * @since 2.0 + * @DummyAnnotation(dummyValue="hello") + */ +class DummyClass +{ + /** + * A nice property. + * + * @var mixed + * @DummyAnnotation(dummyValue="fieldHello") + */ + private $field1; + + /** + * @DummyJoinTable(name="join_table", + * joinColumns={@DummyJoinColumn(name="col1", referencedColumnName="col2")}, + * inverseJoinColumns={ + * @DummyJoinColumn(name="col3", referencedColumnName="col4") + * }) + */ + private $field2; + + /** + * Gets the value of field1. + * + * @return mixed + * @DummyAnnotation({1,2,"three"}) + */ + public function getField1() + { + } +} diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/Fixtures/AnnotationWithConstants.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/Fixtures/AnnotationWithConstants.php new file mode 100644 index 0000000000000000000000000000000000000000..9c94558be3ef4bca47b5dd546355b74250b8d09a --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/Fixtures/AnnotationWithConstants.php @@ -0,0 +1,20 @@ +<?php + +namespace Doctrine\Tests\Common\Annotations\Fixtures; + +/** + * @Annotation + * @Target("ALL") + */ +final class AnnotationWithConstants +{ + + const INTEGER = 1; + const FLOAT = 1.2; + const STRING = '1.2.3'; + + /** + * @var mixed + */ + public $value; +} \ No newline at end of file diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/Fixtures/ClassWithClosure.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/Fixtures/ClassWithClosure.php new file mode 100644 index 0000000000000000000000000000000000000000..4629507dd333c34cd74423a7c48f0bf25c72fb2f --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/Fixtures/ClassWithClosure.php @@ -0,0 +1,52 @@ +<?php + +namespace Doctrine\Tests\Common\Annotations\Fixtures; + +use Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAll; +use Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAnnotation; + +/** + * @AnnotationTargetAll("Foo") + */ +final class ClassWithClosure +{ + + /** + * @AnnotationTargetAll(@AnnotationTargetAnnotation) + * @var string + */ + public $value; + + /** + * @AnnotationTargetAll(@AnnotationTargetAnnotation) + * + * @param \Closure $callback + * @return \Closure + */ + public function methodName(\Closure $callback) + { + $self = $this; + return function() use ($self, $callback) { + return $callback; + }; + } + + /** + * @param integer $year + * @param integer $month + * @param integer $day + * @return \Doctrine\Common\Collections\ArrayCollection + */ + public function getEventsForDate($year, $month, $day){ + $extractEvents = null; // check if date of item is inside day given + $extractEvents = $this->events->filter(function ($item) use ($year, $month, $day) { + $leftDate = new \DateTime($year.'-'.$month.'-'.$day.' 00:00'); + $rigthDate = new \DateTime($year.'-'.$month.'-'.$day.' +1 day 00:00'); + return ( ( $leftDate <= $item->getDateStart() ) && ( $item->getDateStart() < $rigthDate ) ); + + } + ); + return $extractEvents; + } + +} \ No newline at end of file diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/Fixtures/ClassWithConstants.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/Fixtures/ClassWithConstants.php new file mode 100644 index 0000000000000000000000000000000000000000..055e245c08af967ba84e5cc635db0a9d1bed7b71 --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/Fixtures/ClassWithConstants.php @@ -0,0 +1,10 @@ +<?php + +namespace Doctrine\Tests\Common\Annotations\Fixtures; + +class ClassWithConstants +{ + + const SOME_VALUE = 'ClassWithConstants.SOME_VALUE'; + const SOME_KEY = 'ClassWithConstants.SOME_KEY'; +} \ No newline at end of file diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/Fixtures/IntefaceWithConstants.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/Fixtures/IntefaceWithConstants.php new file mode 100644 index 0000000000000000000000000000000000000000..d375b201a5ed5eb46583db450342742edb4df82d --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/Fixtures/IntefaceWithConstants.php @@ -0,0 +1,10 @@ +<?php + +namespace Doctrine\Tests\Common\Annotations\Fixtures; + +interface IntefaceWithConstants +{ + + const SOME_VALUE = 'IntefaceWithConstants.SOME_VALUE'; + const SOME_KEY = 'IntefaceWithConstants.SOME_KEY'; +} \ No newline at end of file diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/PhpParserTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/PhpParserTest.php index 8de4aabf42dc1713b39ccc5825d2f814333d4156..cf81116c6720408e8db02c685847cf58ec6ba8ac 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/PhpParserTest.php +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/PhpParserTest.php @@ -176,4 +176,19 @@ public function testIfPointerResetsOnMultipleParsingTries() 'template' => __NAMESPACE__ . '\Fixtures\Annotation\Template', ), $parser->parseClass($class)); } + + /** + * @group DCOM-97 + * @group regression + */ + public function testClassWithClosure() + { + $parser = new PhpParser(); + $class = new ReflectionClass(__NAMESPACE__ . '\Fixtures\ClassWithClosure'); + + $this->assertEquals(array( + 'annotationtargetall' => __NAMESPACE__ . '\Fixtures\AnnotationTargetAll', + 'annotationtargetannotation' => __NAMESPACE__ . '\Fixtures\AnnotationTargetAnnotation', + ), $parser->parseClass($class)); + } } \ No newline at end of file diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/ArrayCacheTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/ArrayCacheTest.php index 719271747d09a33544c928cf126cbd32cc980015..6cad8915b6cd6fae3bfb885256dc0f79ed4009da 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/ArrayCacheTest.php +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/ArrayCacheTest.php @@ -10,4 +10,12 @@ protected function _getCacheDriver() { return new ArrayCache(); } + + public function testGetStats() + { + $cache = $this->_getCacheDriver(); + $stats = $cache->getStats(); + + $this->assertNull($stats); + } } \ No newline at end of file diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/CacheTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/CacheTest.php index 2ae15f2aff537760a535fce03f2553bb651b6448..1bbc1650535adc383c5db12488fdb0bd78f11bca 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/CacheTest.php +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/CacheTest.php @@ -25,6 +25,15 @@ public function testBasics() $this->assertFalse($cache->contains('test_key2')); } + public function testObjects() + { + $cache = $this->_getCacheDriver(); + + // Fetch/save test with objects (Is cache driver serializes/unserializes objects correctly ?) + $cache->save('test_object_key', new \ArrayObject()); + $this->assertTrue($cache->fetch('test_object_key') instanceof \ArrayObject); + } + public function testDeleteAll() { $cache = $this->_getCacheDriver(); @@ -65,14 +74,9 @@ public function testNamespace() */ public function testGetStats() { - if ($this instanceof ArrayCacheTest || $this instanceof ZendDataCacheTest ) { - $this->markTestSkipped("Statistics are not available for this driver"); - } - $cache = $this->_getCacheDriver(); $stats = $cache->getStats(); - $this->assertArrayHasKey(Cache::STATS_HITS, $stats); $this->assertArrayHasKey(Cache::STATS_MISSES, $stats); $this->assertArrayHasKey(Cache::STATS_UPTIME, $stats); @@ -84,4 +88,4 @@ public function testGetStats() * @return \Doctrine\Common\Cache\CacheProvider */ abstract protected function _getCacheDriver(); -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/FilesystemCacheTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/FilesystemCacheTest.php new file mode 100644 index 0000000000000000000000000000000000000000..f782e3c00211f3a693bf6d1a50ad3af06ab1db77 --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/FilesystemCacheTest.php @@ -0,0 +1,97 @@ +<?php + +namespace Doctrine\Tests\Common\Cache; + +use Doctrine\Common\Cache\FilesystemCache; + +/** + * @group DCOM-101 + */ +class FilesystemCacheTest extends CacheTest +{ + /** + * @var \Doctrine\Common\Cache\FilesystemCache + */ + private $driver; + + protected function _getCacheDriver() + { + $dir = sys_get_temp_dir() . "/doctrine_cache_". uniqid(); + $this->assertFalse(is_dir($dir)); + + $this->driver = new FilesystemCache($dir); + $this->assertTrue(is_dir($dir)); + + return $this->driver; + } + + public function testLifetime() + { + $cache = $this->_getCacheDriver(); + + // Test save + $cache->save('test_key', 'testing this out', 10); + + // Test contains to test that save() worked + $this->assertTrue($cache->contains('test_key')); + + // Test fetch + $this->assertEquals('testing this out', $cache->fetch('test_key')); + + // access private methods + $getFilename = new \ReflectionMethod($cache, 'getFilename'); + $getNamespacedId = new \ReflectionMethod($cache, 'getNamespacedId'); + + $getFilename->setAccessible(true); + $getNamespacedId->setAccessible(true); + + $id = $getNamespacedId->invoke($cache, 'test_key'); + $filename = $getFilename->invoke($cache, $id); + + $data = ''; + $lifetime = 0; + $resource = fopen($filename, "r"); + + if (false !== ($line = fgets($resource))) { + $lifetime = (integer) $line; + } + + while (false !== ($line = fgets($resource))) { + $data .= $line; + } + + $this->assertNotEquals(0, $lifetime, "previous lifetime could not be loaded"); + + // update lifetime + $lifetime = $lifetime - 20; + file_put_contents($filename, $lifetime . PHP_EOL . $data); + + // test expired data + $this->assertFalse($cache->contains('test_key')); + $this->assertFalse($cache->fetch('test_key')); + } + + public function testGetStats() + { + $cache = $this->_getCacheDriver(); + $stats = $cache->getStats(); + + $this->assertNull($stats); + } + + public function tearDown() + { + $dir = $this->driver->getDirectory(); + $ext = $this->driver->getExtension(); + $iterator = new \RecursiveDirectoryIterator($dir); + + foreach (new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::CHILD_FIRST) as $file) { + if ($file->isFile()) { + @unlink($file->getRealPath()); + } else { + @rmdir($file->getRealPath()); + } + } + } + +} \ No newline at end of file diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/MemcacheCacheTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/MemcacheCacheTest.php index 362ff69a30ef08daf2f1bf1d785acb7889c4f34f..36c180c93557a6fc3b8e3d8bdda204c3507d89d7 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/MemcacheCacheTest.php +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/MemcacheCacheTest.php @@ -28,6 +28,13 @@ public function testNoExpire() { $this->assertTrue($cache->contains('noexpire'), 'Memcache provider should support no-expire'); } + public function testLongLifetime() + { + $cache = $this->_getCacheDriver(); + $cache->save('key', 'value', 30 * 24 * 3600 + 1); + $this->assertTrue($cache->contains('key'), 'Memcache provider should support TTL > 30 days'); + } + protected function _getCacheDriver() { $driver = new MemcacheCache(); diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/MemcachedCacheTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/MemcachedCacheTest.php index 947ba75265c503a79b6e5403139e92b79607382c..ecbe5a60012652fe97cbf98cd4b726bb3c8854ee 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/MemcachedCacheTest.php +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/MemcachedCacheTest.php @@ -31,6 +31,14 @@ public function testNoExpire() { $this->assertTrue($cache->contains('noexpire'), 'Memcache provider should support no-expire'); } + public function testLongLifetime() + { + $cache = $this->_getCacheDriver(); + $cache->save('key', 'value', 30 * 24 * 3600 + 1); + + $this->assertTrue($cache->contains('key'), 'Memcached provider should support TTL > 30 days'); + } + protected function _getCacheDriver() { $driver = new MemcachedCache(); diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/PhpFileCacheTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/PhpFileCacheTest.php new file mode 100644 index 0000000000000000000000000000000000000000..5085f46640ac81dab6d6f040f815c55e01e011ea --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/PhpFileCacheTest.php @@ -0,0 +1,149 @@ +<?php + +namespace Doctrine\Tests\Common\Cache; + +use Doctrine\Common\Cache\PhpFileCache; + +/** + * @group DCOM-101 + */ +class PhpFileCacheTest extends CacheTest +{ + /** + * @var \Doctrine\Common\Cache\PhpFileCache + */ + private $driver; + + protected function _getCacheDriver() + { + $dir = sys_get_temp_dir() . "/doctrine_cache_". uniqid(); + $this->assertFalse(is_dir($dir)); + + $this->driver = new PhpFileCache($dir); + $this->assertTrue(is_dir($dir)); + + return $this->driver; + } + + public function testObjects() + { + $this->markTestSkipped('PhpFileCache does not support saving objects that dont implement __set_state()'); + } + + public function testLifetime() + { + $cache = $this->_getCacheDriver(); + + // Test save + $cache->save('test_key', 'testing this out', 10); + + // Test contains to test that save() worked + $this->assertTrue($cache->contains('test_key')); + + // Test fetch + $this->assertEquals('testing this out', $cache->fetch('test_key')); + + // access private methods + $getFilename = new \ReflectionMethod($cache, 'getFilename'); + $getNamespacedId = new \ReflectionMethod($cache, 'getNamespacedId'); + + $getFilename->setAccessible(true); + $getNamespacedId->setAccessible(true); + + $id = $getNamespacedId->invoke($cache, 'test_key'); + $path = $getFilename->invoke($cache, $id); + $value = include $path; + + // update lifetime + $value['lifetime'] = $value['lifetime'] - 20; + file_put_contents($path, '<?php return unserialize(' . var_export(serialize($value), true) . ');'); + + // test expired data + $this->assertFalse($cache->contains('test_key')); + $this->assertFalse($cache->fetch('test_key')); + } + + public function testImplementsSetState() + { + $cache = $this->_getCacheDriver(); + + // Test save + $cache->save('test_set_state', new SetStateClass(array(1,2,3))); + + //Test __set_state call + $this->assertCount(0, SetStateClass::$values); + + // Test fetch + $value = $cache->fetch('test_set_state'); + $this->assertInstanceOf('Doctrine\Tests\Common\Cache\SetStateClass', $value); + $this->assertEquals(array(1,2,3), $value->getValue()); + + //Test __set_state call + $this->assertCount(1, SetStateClass::$values); + + // Test contains + $this->assertTrue($cache->contains('test_set_state')); + } + + public function testNotImplementsSetState() + { + $cache = $this->_getCacheDriver(); + + $this->setExpectedException('InvalidArgumentException'); + $cache->save('test_not_set_state', new NotSetStateClass(array(1,2,3))); + } + + public function testGetStats() + { + $cache = $this->_getCacheDriver(); + $stats = $cache->getStats(); + + $this->assertNull($stats); + } + + public function tearDown() + { + if (!$this->driver) { + return; + } + + $dir = $this->driver->getDirectory(); + $ext = $this->driver->getExtension(); + $iterator = new \RecursiveDirectoryIterator($dir); + + foreach (new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::CHILD_FIRST) as $file) { + if ($file->isFile()) { + @unlink($file->getRealPath()); + } else { + @rmdir($file->getRealPath()); + } + } + } + +} + +class NotSetStateClass +{ + private $value; + + public function __construct($value) + { + $this->value = $value; + } + + public function getValue() + { + return $this->value; + } +} + +class SetStateClass extends NotSetStateClass +{ + public static $values = array(); + + public static function __set_state($data) + { + self::$values = $data; + return new self($data['value']); + } +} diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/RedisCacheTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/RedisCacheTest.php new file mode 100644 index 0000000000000000000000000000000000000000..45bbc752af25680d1b314842435091fb70882f2a --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/RedisCacheTest.php @@ -0,0 +1,30 @@ +<?php + +namespace Doctrine\Tests\Common\Cache; + +use Doctrine\Common\Cache\RedisCache; + +class RedisCacheTest extends CacheTest +{ + private $_redis; + + public function setUp() + { + if (extension_loaded('redis')) { + $this->_redis = new \Redis(); + $ok = @$this->_redis->connect('127.0.0.1'); + if (!$ok) { + $this->markTestSkipped('The ' . __CLASS__ .' requires the use of redis'); + } + } else { + $this->markTestSkipped('The ' . __CLASS__ .' requires the use of redis'); + } + } + + protected function _getCacheDriver() + { + $driver = new RedisCache(); + $driver->setRedis($this->_redis); + return $driver; + } +} diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/ZendDataCacheTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/ZendDataCacheTest.php index 27dcf359a0eb883eceba8c1d25a9d88647af484b..cd66e1578f3ef39d5717f557632f7bc5d024631f 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/ZendDataCacheTest.php +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/ZendDataCacheTest.php @@ -13,6 +13,14 @@ public function setUp() } } + public function testGetStats() + { + $cache = $this->_getCacheDriver(); + $stats = $cache->getStats(); + + $this->assertNull($stats); + } + protected function _getCacheDriver() { return new ZendDataCache(); diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Collections/ClosureExpressionVisitorTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Collections/ClosureExpressionVisitorTest.php new file mode 100644 index 0000000000000000000000000000000000000000..e40afba7c28a06567877249b437ecd38726804e5 --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Collections/ClosureExpressionVisitorTest.php @@ -0,0 +1,198 @@ +<?php +/* + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This software consists of voluntary contributions made by many individuals + * and is licensed under the LGPL. For more information, see + * <http://www.doctrine-project.org>. + */ + +namespace Doctrine\Tests\Common\Collections; + +use Doctrine\Common\Collections\Expr\ClosureExpressionVisitor; +use Doctrine\Common\Collections\ExpressionBuilder; + +/** + * @group DDC-1637 + */ +class ClosureExpressionVisitorTest extends \PHPUnit_Framework_TestCase +{ + private $visitor; + private $builder; + + public function setUp() + { + $this->visitor = new ClosureExpressionVisitor(); + $this->builder = new ExpressionBuilder(); + } + + public function testWalkEqualsComparison() + { + $closure = $this->visitor->walkComparison($this->builder->eq("foo", 1)); + + $this->assertTrue($closure(new TestObject(1))); + $this->assertFalse($closure(new TestObject(2))); + } + + public function testWalkNotEqualsComparison() + { + $closure = $this->visitor->walkComparison($this->builder->neq("foo", 1)); + + $this->assertFalse($closure(new TestObject(1))); + $this->assertTrue($closure(new TestObject(2))); + } + + public function testWalkLessThanComparison() + { + $closure = $this->visitor->walkComparison($this->builder->lt("foo", 1)); + + $this->assertFalse($closure(new TestObject(1))); + $this->assertTrue($closure(new TestObject(0))); + } + + public function testWalkLessThanEqualsComparison() + { + $closure = $this->visitor->walkComparison($this->builder->lte("foo", 1)); + + $this->assertFalse($closure(new TestObject(2))); + $this->assertTrue($closure(new TestObject(1))); + $this->assertTrue($closure(new TestObject(0))); + } + + public function testWalkGreaterThanEqualsComparison() + { + $closure = $this->visitor->walkComparison($this->builder->gte("foo", 1)); + + $this->assertTrue($closure(new TestObject(2))); + $this->assertTrue($closure(new TestObject(1))); + $this->assertFalse($closure(new TestObject(0))); + } + + public function testWalkGreaterThanComparison() + { + $closure = $this->visitor->walkComparison($this->builder->gt("foo", 1)); + + $this->assertTrue($closure(new TestObject(2))); + $this->assertFalse($closure(new TestObject(1))); + $this->assertFalse($closure(new TestObject(0))); + } + + public function testWalkInComparison() + { + $closure = $this->visitor->walkComparison($this->builder->in("foo", array(1, 2, 3))); + + $this->assertTrue($closure(new TestObject(2))); + $this->assertTrue($closure(new TestObject(1))); + $this->assertFalse($closure(new TestObject(0))); + } + + public function testWalkNotInComparison() + { + $closure = $this->visitor->walkComparison($this->builder->notIn("foo", array(1, 2, 3))); + + $this->assertFalse($closure(new TestObject(1))); + $this->assertFalse($closure(new TestObject(2))); + $this->assertTrue($closure(new TestObject(0))); + $this->assertTrue($closure(new TestObject(4))); + } + + public function testWalkAndCompositeExpression() + { + $closure = $this->visitor->walkCompositeExpression( + $this->builder->andX( + $this->builder->eq("foo", 1), + $this->builder->eq("bar", 1) + ) + ); + + $this->assertTrue($closure(new TestObject(1, 1))); + $this->assertFalse($closure(new TestObject(1, 0))); + $this->assertFalse($closure(new TestObject(0, 1))); + $this->assertFalse($closure(new TestObject(0, 0))); + } + + public function testWalkOrCompositeExpression() + { + $closure = $this->visitor->walkCompositeExpression( + $this->builder->orX( + $this->builder->eq("foo", 1), + $this->builder->eq("bar", 1) + ) + ); + + $this->assertTrue($closure(new TestObject(1, 1))); + $this->assertTrue($closure(new TestObject(1, 0))); + $this->assertTrue($closure(new TestObject(0, 1))); + $this->assertFalse($closure(new TestObject(0, 0))); + } + + public function testSortByFieldAscending() + { + $objects = array(new TestObject("b"), new TestObject("a"), new TestObject("c")); + $sort = ClosureExpressionVisitor::sortByField("foo"); + + usort($objects, $sort); + + $this->assertEquals("a", $objects[0]->getFoo()); + $this->assertEquals("b", $objects[1]->getFoo()); + $this->assertEquals("c", $objects[2]->getFoo()); + } + + public function testSortByFieldDescending() + { + $objects = array(new TestObject("b"), new TestObject("a"), new TestObject("c")); + $sort = ClosureExpressionVisitor::sortByField("foo", -1); + + usort($objects, $sort); + + $this->assertEquals("c", $objects[0]->getFoo()); + $this->assertEquals("b", $objects[1]->getFoo()); + $this->assertEquals("a", $objects[2]->getFoo()); + } + + public function testSortDelegate() + { + $objects = array(new TestObject("a", "c"), new TestObject("a", "b"), new TestObject("a", "a")); + $sort = ClosureExpressionVisitor::sortByField("bar", 1); + $sort = ClosureExpressionVisitor::sortByField("foo", 1, $sort); + + usort($objects, $sort); + + $this->assertEquals("a", $objects[0]->getBar()); + $this->assertEquals("b", $objects[1]->getBar()); + $this->assertEquals("c", $objects[2]->getBar()); + } +} + +class TestObject +{ + private $foo; + private $bar; + + public function __construct($foo = null, $bar = null) + { + $this->foo = $foo; + $this->bar = $bar; + } + + public function getFoo() + { + return $this->foo; + } + + public function getBar() + { + return $this->bar; + } +} + diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Collections/CollectionTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Collections/CollectionTest.php index 8c2bb3c1825ede4e3bd71cc97bbcccd198de6918..58979fad9dff0b868f45a196a3244c80f2c2c0b0 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Collections/CollectionTest.php +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Collections/CollectionTest.php @@ -3,6 +3,7 @@ namespace Doctrine\Tests\Common\Collections; use Doctrine\Tests; +use Doctrine\Common\Collections\Criteria; class CollectionTest extends \Doctrine\Tests\DoctrineTestCase { @@ -192,4 +193,59 @@ public function testSlice() $slice = $this->_coll->slice(1, 1); $this->assertEquals(array(1 => 'two'), $slice); } -} \ No newline at end of file + + public function fillMatchingFixture() + { + $std1 = new \stdClass(); + $std1->foo = "bar"; + $this->_coll[] = $std1; + + $std2 = new \stdClass(); + $std2->foo = "baz"; + $this->_coll[] = $std2; + } + + /** + * @group DDC-1637 + */ + public function testMatching() + { + $this->fillMatchingFixture(); + + $col = $this->_coll->matching(new Criteria($this->_coll->expr()->eq("foo", "bar"))); + $this->assertInstanceOf('Doctrine\Common\Collections\Collection', $col); + $this->assertNotSame($col, $this->_coll); + $this->assertEquals(1, count($col)); + } + + /** + * @group DDC-1637 + */ + public function testMatchingOrdering() + { + $this->fillMatchingFixture(); + + $col = $this->_coll->matching(new Criteria(null, array('foo' => 'DESC'))); + + $this->assertInstanceOf('Doctrine\Common\Collections\Collection', $col); + $this->assertNotSame($col, $this->_coll); + $this->assertEquals(2, count($col)); + $this->assertEquals('baz', $col[0]->foo); + $this->assertEquals('bar', $col[1]->foo); + } + + /** + * @group DDC-1637 + */ + public function testMatchingSlice() + { + $this->fillMatchingFixture(); + + $col = $this->_coll->matching(new Criteria(null, null, 1, 1)); + + $this->assertInstanceOf('Doctrine\Common\Collections\Collection', $col); + $this->assertNotSame($col, $this->_coll); + $this->assertEquals(1, count($col)); + $this->assertEquals('baz', $col[0]->foo); + } +} diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Collections/CriteriaTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Collections/CriteriaTest.php new file mode 100644 index 0000000000000000000000000000000000000000..a7415f23ac21ad8bed9857be2f01760916d17abd --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Collections/CriteriaTest.php @@ -0,0 +1,38 @@ +<?php +namespace Doctrine\Tests\Common\Collections; + +use Doctrine\Common\Collections\Criteria; +use Doctrine\Common\Collections\Expr\Comparison; + +class CriteriaTest extends \PHPUnit_Framework_TestCase +{ + public function testConstructor() + { + $expr = new Comparison("field", "=", "value"); + $criteria = new Criteria($expr, array("foo" => "ASC"), 10, 20); + + $this->assertSame($expr, $criteria->getWhereExpression()); + $this->assertEquals(array("foo" => "ASC"), $criteria->getOrderings()); + $this->assertEquals(10, $criteria->getFirstResult()); + $this->assertEquals(20, $criteria->getMaxResults()); + } + + public function testWhere() + { + $expr = new Comparison("field", "=", "value"); + $criteria = new Criteria(); + + $criteria->where($expr); + + $this->assertSame($expr, $criteria->getWhereExpression()); + } + + public function testOrderings() + { + $criteria = new Criteria(); + + $criteria->orderBy(array("foo" => "ASC")); + + $this->assertEquals(array("foo" => "ASC"), $criteria->getOrderings()); + } +} diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Collections/ExpressionBuilderTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Collections/ExpressionBuilderTest.php new file mode 100644 index 0000000000000000000000000000000000000000..68896b37f7a302925ce3a6ca56f70d30c17d2935 --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Collections/ExpressionBuilderTest.php @@ -0,0 +1,114 @@ +<?php +namespace Doctrine\Tests\Common\Collections; + +use Doctrine\Common\Collections\ExpressionBuilder; +use Doctrine\Common\Collections\Expr\Comparison; +use Doctrine\Common\Collections\Expr\CompositeExpression; + +/** + * @group DDC-1637 + */ +class ExpressionBuilderTest extends \PHPUnit_Framework_TestCase +{ + private $builder; + + public function setUp() + { + $this->builder = new ExpressionBuilder(); + } + + public function testAndX() + { + $expr = $this->builder->andX($this->builder->eq("a", "b")); + + $this->assertInstanceOf("Doctrine\Common\Collections\Expr\CompositeExpression", $expr); + $this->assertEquals(CompositeExpression::TYPE_AND, $expr->getType()); + } + + public function testOrX() + { + $expr = $this->builder->orX($this->builder->eq("a", "b")); + + $this->assertInstanceOf("Doctrine\Common\Collections\Expr\CompositeExpression", $expr); + $this->assertEquals(CompositeExpression::TYPE_OR, $expr->getType()); + } + + public function testInvalidAndXArgument() + { + $this->setExpectedException("RuntimeException"); + $this->builder->andX("foo"); + } + + public function testEq() + { + $expr = $this->builder->eq("a", "b"); + + $this->assertInstanceOf("Doctrine\Common\Collections\Expr\Comparison", $expr); + $this->assertEquals(Comparison::EQ, $expr->getOperator()); + } + + public function testNeq() + { + $expr = $this->builder->neq("a", "b"); + + $this->assertInstanceOf("Doctrine\Common\Collections\Expr\Comparison", $expr); + $this->assertEquals(Comparison::NEQ, $expr->getOperator()); + } + + public function testLt() + { + $expr = $this->builder->lt("a", "b"); + + $this->assertInstanceOf("Doctrine\Common\Collections\Expr\Comparison", $expr); + $this->assertEquals(Comparison::LT, $expr->getOperator()); + } + + public function testGt() + { + $expr = $this->builder->gt("a", "b"); + + $this->assertInstanceOf("Doctrine\Common\Collections\Expr\Comparison", $expr); + $this->assertEquals(Comparison::GT, $expr->getOperator()); + } + + public function testGte() + { + $expr = $this->builder->gte("a", "b"); + + $this->assertInstanceOf("Doctrine\Common\Collections\Expr\Comparison", $expr); + $this->assertEquals(Comparison::GTE, $expr->getOperator()); + } + + public function testLte() + { + $expr = $this->builder->lte("a", "b"); + + $this->assertInstanceOf("Doctrine\Common\Collections\Expr\Comparison", $expr); + $this->assertEquals(Comparison::LTE, $expr->getOperator()); + } + + public function testIn() + { + $expr = $this->builder->in("a", array("b")); + + $this->assertInstanceOf("Doctrine\Common\Collections\Expr\Comparison", $expr); + $this->assertEquals(Comparison::IN, $expr->getOperator()); + } + + public function testNotIn() + { + $expr = $this->builder->notIn("a", array("b")); + + $this->assertInstanceOf("Doctrine\Common\Collections\Expr\Comparison", $expr); + $this->assertEquals(Comparison::NIN, $expr->getOperator()); + } + + public function testIsNull() + { + $expr = $this->builder->isNull("a"); + + $this->assertInstanceOf("Doctrine\Common\Collections\Expr\Comparison", $expr); + $this->assertEquals(Comparison::IS, $expr->getOperator()); + } +} + diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/ChainDriverTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/ChainDriverTest.php index e1825ae2b591356cd1ef6772108332720f369be8..66ad7629ca763b9b4f55b7e0a934172a19332280 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/ChainDriverTest.php +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/ChainDriverTest.php @@ -86,6 +86,42 @@ public function testIsTransient() $this->assertTrue($chain->isTransient('stdClass'), "stdClass isTransient"); } + + /** + * @group DDC-1412 + */ + public function testDefaultDriver() + { + $companyDriver = $this->getMock('Doctrine\Common\Persistence\Mapping\Driver\MappingDriver'); + $dafaultDriver = $this->getMock('Doctrine\Common\Persistence\Mapping\Driver\MappingDriver'); + $entityClassName = 'Doctrine\Tests\ORM\Mapping\DriverChainEntity'; + $managerClassName = 'Doctrine\Tests\Models\Company\CompanyManager'; + $chain = new MappingDriverChain(); + + $companyDriver->expects($this->never()) + ->method('loadMetadataForClass'); + $companyDriver->expects($this->once()) + ->method('isTransient') + ->with($this->equalTo($managerClassName)) + ->will($this->returnValue(false)); + + $dafaultDriver->expects($this->never()) + ->method('loadMetadataForClass'); + $dafaultDriver->expects($this->once()) + ->method('isTransient') + ->with($this->equalTo($entityClassName)) + ->will($this->returnValue(true)); + + $this->assertNull($chain->getDefaultDriver()); + + $chain->setDefaultDriver($dafaultDriver); + $chain->addDriver($companyDriver, 'Doctrine\Tests\Models\Company'); + + $this->assertSame($dafaultDriver, $chain->getDefaultDriver()); + + $this->assertTrue($chain->isTransient($entityClassName)); + $this->assertFalse($chain->isTransient($managerClassName)); + } } class DriverChainEntity diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/ClassMetadataFactoryTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/ClassMetadataFactoryTest.php index 9fe329944cf1dd0461b5199b28432c47849635a9..bc1559af14fa26b0e3994a9d140c4e3de83d6b7e 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/ClassMetadataFactoryTest.php +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/ClassMetadataFactoryTest.php @@ -90,7 +90,7 @@ public function __construct($driver, $metadata) $this->metadata = $metadata; } - protected function doLoadMetadata($class, $parent, $rootEntityFound) + protected function doLoadMetadata($class, $parent, $rootEntityFound, array $nonSuperclassParents) { } @@ -121,6 +121,11 @@ protected function wakeupReflection(ClassMetadata $class, ReflectionService $ref protected function initializeReflection(ClassMetadata $class, ReflectionService $reflService) { } + + protected function isEntity(ClassMetadata $class) + { + return true; + } } class RootEntity diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/DefaultFileLocatorTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/DefaultFileLocatorTest.php index 3c600c406a241ce27676673844dad6fb2e92fb46..37072de6ace123a4d827e47e04a22bb49008cc3a 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/DefaultFileLocatorTest.php +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/DefaultFileLocatorTest.php @@ -40,7 +40,7 @@ public function testFindMappingFile() $locator = new DefaultFileLocator(array($path), ".yml"); - $this->assertEquals(__DIR__ . '/_files/stdClass.yml', $locator->findMappingFile('stdClass')); + $this->assertEquals(__DIR__ . '/_files' . DIRECTORY_SEPARATOR . 'stdClass.yml', $locator->findMappingFile('stdClass')); } public function testFindMappingFileNotFound() diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Reflection/DeeperNamespaceParent.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Reflection/DeeperNamespaceParent.php new file mode 100644 index 0000000000000000000000000000000000000000..72faa778137cf4f3fbad4f0cc1473b97b1a4b1dd --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Reflection/DeeperNamespaceParent.php @@ -0,0 +1,7 @@ +<?php + +namespace Doctrine\Tests\Common\Reflection; + +class SameNamespaceParent extends Dummies\NoParent +{ +} diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Reflection/Dummies/NoParent.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Reflection/Dummies/NoParent.php new file mode 100644 index 0000000000000000000000000000000000000000..f0e8dc9e6552c3bd23e41c48c6150cecbf95106d --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Reflection/Dummies/NoParent.php @@ -0,0 +1,8 @@ +<?php + +namespace Doctrine\Tests\Common\Reflection\Dummies; + +class NoParent +{ + public $test; +} diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Reflection/FullyClassifiedParent.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Reflection/FullyClassifiedParent.php new file mode 100644 index 0000000000000000000000000000000000000000..09a2641081004b05f9a44ea5ad876d25c91fe446 --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Reflection/FullyClassifiedParent.php @@ -0,0 +1,7 @@ +<?php + +namespace Doctrine\Tests\Common\Reflection; + +class FullyClassifiedParent extends \Doctrine\Tests\Common\Reflection\NoParent +{ +} diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Reflection/NoParent.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Reflection/NoParent.php new file mode 100644 index 0000000000000000000000000000000000000000..f6a98cb49543e09631334c2f9e204317362dacfd --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Reflection/NoParent.php @@ -0,0 +1,8 @@ +<?php + +namespace Doctrine\Tests\Common\Reflection; + +class NoParent +{ + public $test; +} diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Reflection/SameNamespaceParent.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Reflection/SameNamespaceParent.php new file mode 100644 index 0000000000000000000000000000000000000000..844d4a55e76ce8cfb35aa6cf6ad4fb4cb112feeb --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Reflection/SameNamespaceParent.php @@ -0,0 +1,7 @@ +<?php + +namespace Doctrine\Tests\Common\Reflection; + +class SameNamespaceParent extends NoParent +{ +} diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Reflection/StaticReflectionParserTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Reflection/StaticReflectionParserTest.php new file mode 100644 index 0000000000000000000000000000000000000000..374fdc48ecc6d2dddec91e7433cf0baff0717a20 --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Reflection/StaticReflectionParserTest.php @@ -0,0 +1,45 @@ +<?php + +namespace Doctrine\Tests\Common\Reflection; + +use Doctrine\Tests\DoctrineTestCase; +use Doctrine\Common\Reflection\StaticReflectionParser; +use Doctrine\Common\Reflection\Psr0FindFile; + +class StaticReflectionParserTest extends DoctrineTestCase +{ + public function testParentClass() + { + $testsRoot = substr(__DIR__, 0, -strlen(__NAMESPACE__) - 1); + $paths = array( + 'Doctrine\\Tests' => array($testsRoot), + ); + $noParentClassName = 'Doctrine\\Tests\\Common\\Reflection\\NoParent'; + $staticReflectionParser = new StaticReflectionParser($noParentClassName, new Psr0FindFile($paths)); + $declaringClassName = $staticReflectionParser->getStaticReflectionParserForDeclaringClass('property', 'test')->getClassName(); + $this->assertEquals($noParentClassName, $declaringClassName); + + $className = 'Doctrine\\Tests\\Common\\Reflection\\FullyClassifiedParent'; + $staticReflectionParser = new StaticReflectionParser($className, new Psr0FindFile($paths)); + $declaringClassName = $staticReflectionParser->getStaticReflectionParserForDeclaringClass('property', 'test')->getClassName(); + $this->assertEquals($noParentClassName, $declaringClassName); + + $className = 'Doctrine\\Tests\\Common\\Reflection\\SameNamespaceParent'; + $staticReflectionParser = new StaticReflectionParser($className, new Psr0FindFile($paths)); + $declaringClassName = $staticReflectionParser->getStaticReflectionParserForDeclaringClass('property', 'test')->getClassName(); + $this->assertEquals($noParentClassName, $declaringClassName); + + $dummyParentClassName = 'Doctrine\\Tests\\Common\\Reflection\\Dummies\\NoParent'; + + $className = 'Doctrine\\Tests\\Common\\Reflection\\DeeperNamespaceParent'; + $staticReflectionParser = new StaticReflectionParser($className, new Psr0FindFile($paths)); + $declaringClassName = $staticReflectionParser->getStaticReflectionParserForDeclaringClass('property', 'test')->getClassName(); + $this->assertEquals($dummyParentClassName, $declaringClassName); + + $className = 'Doctrine\\Tests\\Common\\Reflection\\UseParent'; + $staticReflectionParser = new StaticReflectionParser($className, new Psr0FindFile($paths)); + $declaringClassName = $staticReflectionParser->getStaticReflectionParserForDeclaringClass('property', 'test')->getClassName(); + $this->assertEquals($dummyParentClassName, $declaringClassName); + + } +} diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Reflection/UseParent.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Reflection/UseParent.php new file mode 100644 index 0000000000000000000000000000000000000000..dd512d4d65398b9b03d237e8d21003ee762b92a0 --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Reflection/UseParent.php @@ -0,0 +1,9 @@ +<?php + +namespace Doctrine\Tests\Common\Reflection; + +use Doctrine\Tests\Common\Reflection\Dummies\NoParent as Test; + +class UseParent extends Test +{ +} 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 04104a159761b286215257408b31abbb9d236af3..0c99e6ad3d95c0aea151f5c8e2629101778632d6 100644 --- a/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ApcClassLoader.php +++ b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ApcClassLoader.php @@ -55,7 +55,7 @@ class ApcClassLoader public function __construct($prefix, $classFinder) { if (!extension_loaded('apc')) { - throw new \RuntimeException('Unable to use ApcUniversalClassLoader as APC is not enabled.'); + throw new \RuntimeException('Unable to use ApcClassLoader as APC is not enabled.'); } if (!method_exists($classFinder, 'findFile')) { diff --git a/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ClassCollectionLoader.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ClassCollectionLoader.php index 47588f76c43e5018665ea5f7f2be59ce9b452781..7f5bdd1e475489bc0545acacca432498648f9d00 100644 --- a/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ClassCollectionLoader.php +++ b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ClassCollectionLoader.php @@ -18,7 +18,8 @@ */ class ClassCollectionLoader { - static private $loaded; + private static $loaded; + private static $seen; /** * Loads a list of classes and caches them in one big file. @@ -32,7 +33,7 @@ class ClassCollectionLoader * * @throws \InvalidArgumentException When class can't be loaded */ - static public function load($classes, $cacheDir, $name, $autoReload, $adaptive = false, $extension = '.php') + public static function load($classes, $cacheDir, $name, $autoReload, $adaptive = false, $extension = '.php') { // each $name can only be loaded once per PHP process if (isset(self::$loaded[$name])) { @@ -41,14 +42,21 @@ static public function load($classes, $cacheDir, $name, $autoReload, $adaptive = self::$loaded[$name] = true; + $declared = array_merge(get_declared_classes(), get_declared_interfaces()); + if (function_exists('get_declared_traits')) { + $declared = array_merge($declared, get_declared_traits()); + } + if ($adaptive) { // don't include already declared classes - $classes = array_diff($classes, get_declared_classes(), get_declared_interfaces()); + $classes = array_diff($classes, $declared); // the cache is different depending on which classes are already declared $name = $name.'-'.substr(md5(implode('|', $classes)), 0, 5); } + $classes = array_unique($classes); + $cache = $cacheDir.'/'.$name.$extension; // auto-reload @@ -61,6 +69,9 @@ static public function load($classes, $cacheDir, $name, $autoReload, $adaptive = $time = filemtime($cache); $meta = unserialize(file_get_contents($metadata)); + sort($meta[1]); + sort($classes); + if ($meta[1] != $classes) { $reload = true; } else { @@ -83,18 +94,17 @@ static public function load($classes, $cacheDir, $name, $autoReload, $adaptive = $files = array(); $content = ''; - foreach ($classes as $class) { - if (!class_exists($class) && !interface_exists($class) && (!function_exists('trait_exists') || !trait_exists($class))) { - throw new \InvalidArgumentException(sprintf('Unable to load class "%s"', $class)); + foreach (self::getOrderedClasses($classes) as $class) { + if (in_array($class->getName(), $declared)) { + continue; } - $r = new \ReflectionClass($class); - $files[] = $r->getFileName(); + $files[] = $class->getFileName(); - $c = preg_replace(array('/^\s*<\?php/', '/\?>\s*$/'), '', file_get_contents($r->getFileName())); + $c = preg_replace(array('/^\s*<\?php/', '/\?>\s*$/'), '', file_get_contents($class->getFileName())); // add namespace declaration for global code - if (!$r->inNamespace()) { + if (!$class->inNamespace()) { $c = "\nnamespace\n{\n".self::stripComments($c)."\n}\n"; } else { $c = self::fixNamespaceDeclarations('<?php '.$c); @@ -123,7 +133,7 @@ static public function load($classes, $cacheDir, $name, $autoReload, $adaptive = * * @return string Namespaces with brackets */ - static public function fixNamespaceDeclarations($source) + public static function fixNamespaceDeclarations($source) { if (!function_exists('token_get_all')) { return $source; @@ -178,7 +188,7 @@ static public function fixNamespaceDeclarations($source) * * @throws \RuntimeException when a cache file cannot be written */ - static private function writeCacheFile($file, $content) + private static function writeCacheFile($file, $content) { $tmpFile = tempnam(dirname($file), basename($file)); if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $file)) { @@ -200,7 +210,7 @@ static private function writeCacheFile($file, $content) * * @return string The PHP string with the comments removed */ - static private function stripComments($source) + private static function stripComments($source) { if (!function_exists('token_get_all')) { return $source; @@ -220,4 +230,91 @@ static private function stripComments($source) return $output; } + + /** + * Gets an ordered array of passed classes including all their dependencies. + * + * @param array $classes + * + * @return array An array of sorted \ReflectionClass instances (dependencies added if needed) + * + * @throws \InvalidArgumentException When a class can't be loaded + */ + private static function getOrderedClasses(array $classes) + { + $map = array(); + self::$seen = array(); + foreach ($classes as $class) { + try { + $reflectionClass = new \ReflectionClass($class); + } catch (\ReflectionException $e) { + throw new \InvalidArgumentException(sprintf('Unable to load class "%s"', $class)); + } + + $map = array_merge($map, self::getClassHierarchy($reflectionClass)); + } + + return $map; + } + + private static function getClassHierarchy(\ReflectionClass $class) + { + if (isset(self::$seen[$class->getName()])) { + return array(); + } + + self::$seen[$class->getName()] = true; + + $classes = array($class); + $parent = $class; + while (($parent = $parent->getParentClass()) && $parent->isUserDefined() && !isset(self::$seen[$parent->getName()])) { + self::$seen[$parent->getName()] = true; + + array_unshift($classes, $parent); + } + + if (function_exists('get_declared_traits')) { + foreach ($classes as $c) { + foreach (self::getTraits($c) as $trait) { + self::$seen[$trait->getName()] = true; + + array_unshift($classes, $trait); + } + } + } + + return array_merge(self::getInterfaces($class), $classes); + } + + private static function getInterfaces(\ReflectionClass $class) + { + $classes = array(); + + foreach ($class->getInterfaces() as $interface) { + $classes = array_merge($classes, self::getInterfaces($interface)); + } + + if ($class->isUserDefined() && $class->isInterface() && !isset(self::$seen[$class->getName()])) { + self::$seen[$class->getName()] = true; + + $classes[] = $class; + } + + return $classes; + } + + private static function getTraits(\ReflectionClass $class) + { + $traits = $class->getTraits(); + $classes = array(); + while ($trait = array_pop($traits)) { + if ($trait->isUserDefined() && !isset(self::$seen[$trait->getName()])) { + $classes[] = $trait; + + $traits = array_merge($traits, $trait->getTraits()); + } + } + + return $classes; + } } diff --git a/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ClassMapGenerator.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ClassMapGenerator.php index 91ea9afa592289a5034b967b0ada8da538f7317b..b0e6580df66a281732768cda1df5d777a902d005 100644 --- a/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ClassMapGenerator.php +++ b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ClassMapGenerator.php @@ -24,7 +24,7 @@ class ClassMapGenerator * @param array|string $dirs Directories or a single path to search in * @param string $file The name of the class map file */ - static public function dump($dirs, $file) + public static function dump($dirs, $file) { $dirs = (array) $dirs; $maps = array(); @@ -43,7 +43,7 @@ static public function dump($dirs, $file) * * @return array A class map array */ - static public function createMap($dir) + public static function createMap($dir) { if (is_string($dir)) { $dir = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dir)); @@ -80,7 +80,7 @@ static public function createMap($dir) * * @return array The found classes */ - static private function findClasses($path) + private static function findClasses($path) { $contents = file_get_contents($path); $tokens = token_get_all($contents); 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 da7d289df2959e03ce3243635fe46dcb848a16cb..dbfb5ab1e303c45af6e484c372461ad34cf07f23 100644 --- a/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/DebugClassLoader.php +++ b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/DebugClassLoader.php @@ -42,7 +42,7 @@ public function __construct($classFinder) /** * Replaces all autoloaders implementing a findFile method by a DebugClassLoader wrapper. */ - static public function enable() + public static function enable() { if (!is_array($functions = spl_autoload_functions())) { return; diff --git a/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/DebugUniversalClassLoader.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/DebugUniversalClassLoader.php index 8cc6747fb2f183cd6059c310b6fb1e2a4185a1e5..96c6290fc23093ce0a7b7c3f381269c6efa63bb9 100644 --- a/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/DebugUniversalClassLoader.php +++ b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/DebugUniversalClassLoader.php @@ -21,7 +21,7 @@ class DebugUniversalClassLoader extends UniversalClassLoader /** * Replaces all regular UniversalClassLoader instances by a DebugUniversalClassLoader ones. */ - static public function enable() + public static function enable() { if (!is_array($functions = spl_autoload_functions())) { return; diff --git a/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php index 5f4db1f06e33e738bf751049a804bc97f5b809af..90eca1dedad196a62c7a4d4bfe58b9295e6d2bff 100644 --- a/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php +++ b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php @@ -13,8 +13,110 @@ use Symfony\Component\ClassLoader\ClassCollectionLoader; +require_once __DIR__.'/Fixtures/ClassesWithParents/GInterface.php'; +require_once __DIR__.'/Fixtures/ClassesWithParents/CInterface.php'; +require_once __DIR__.'/Fixtures/ClassesWithParents/B.php'; +require_once __DIR__.'/Fixtures/ClassesWithParents/A.php'; + class ClassCollectionLoaderTest extends \PHPUnit_Framework_TestCase { + /** + * @dataProvider getDifferentOrders + */ + public function testClassReordering(array $classes) + { + $expected = array( + 'ClassesWithParents\\GInterface', + 'ClassesWithParents\\CInterface', + 'ClassesWithParents\\B', + 'ClassesWithParents\\A', + ); + + $r = new \ReflectionClass('Symfony\Component\ClassLoader\ClassCollectionLoader'); + $m = $r->getMethod('getOrderedClasses'); + $m->setAccessible(true); + + $ordered = $m->invoke('Symfony\Component\ClassLoader\ClassCollectionLoader', $classes); + + $this->assertEquals($expected, array_map(function ($class) { return $class->getName(); }, $ordered)); + } + + public function getDifferentOrders() + { + return array( + array(array( + 'ClassesWithParents\\A', + 'ClassesWithParents\\CInterface', + 'ClassesWithParents\\GInterface', + 'ClassesWithParents\\B', + )), + array(array( + 'ClassesWithParents\\B', + 'ClassesWithParents\\A', + 'ClassesWithParents\\CInterface', + )), + array(array( + 'ClassesWithParents\\CInterface', + 'ClassesWithParents\\B', + 'ClassesWithParents\\A', + )), + array(array( + 'ClassesWithParents\\A', + )), + ); + } + + /** + * @dataProvider getDifferentOrdersForTraits + */ + public function testClassWithTraitsReordering(array $classes) + { + if (version_compare(phpversion(), '5.4.0', '<')) { + $this->markTestSkipped('Requires PHP > 5.4.0.'); + + return; + } + + require_once __DIR__.'/Fixtures/ClassesWithParents/ATrait.php'; + require_once __DIR__.'/Fixtures/ClassesWithParents/BTrait.php'; + require_once __DIR__.'/Fixtures/ClassesWithParents/CTrait.php'; + require_once __DIR__.'/Fixtures/ClassesWithParents/D.php'; + require_once __DIR__.'/Fixtures/ClassesWithParents/E.php'; + + $expected = array( + 'ClassesWithParents\\GInterface', + 'ClassesWithParents\\CInterface', + 'ClassesWithParents\\CTrait', + 'ClassesWithParents\\ATrait', + 'ClassesWithParents\\BTrait', + 'ClassesWithParents\\B', + 'ClassesWithParents\\A', + 'ClassesWithParents\\D', + 'ClassesWithParents\\E', + ); + + $r = new \ReflectionClass('Symfony\Component\ClassLoader\ClassCollectionLoader'); + $m = $r->getMethod('getOrderedClasses'); + $m->setAccessible(true); + + $ordered = $m->invoke('Symfony\Component\ClassLoader\ClassCollectionLoader', $classes); + + $this->assertEquals($expected, array_map(function ($class) { return $class->getName(); }, $ordered)); + } + + public function getDifferentOrdersForTraits() + { + return array( + array(array( + 'ClassesWithParents\\E', + 'ClassesWithParents\\ATrait', + )), + array(array( + 'ClassesWithParents\\E', + )), + ); + } + public function testFixNamespaceDeclarations() { $source = <<<EOF diff --git a/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/ClassesWithParents/A.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/ClassesWithParents/A.php new file mode 100644 index 0000000000000000000000000000000000000000..dff891dcb79a6dca068c1aa8ad58127c114ada61 --- /dev/null +++ b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/ClassesWithParents/A.php @@ -0,0 +1,5 @@ +<?php + +namespace ClassesWithParents; + +class A extends B {} diff --git a/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/ClassesWithParents/ATrait.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/ClassesWithParents/ATrait.php new file mode 100644 index 0000000000000000000000000000000000000000..b02d1859bcbf848f004b5cd7f155644774c32fb1 --- /dev/null +++ b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/ClassesWithParents/ATrait.php @@ -0,0 +1,7 @@ +<?php + +namespace ClassesWithParents; + +trait ATrait +{ +} diff --git a/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/ClassesWithParents/B.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/ClassesWithParents/B.php new file mode 100644 index 0000000000000000000000000000000000000000..196bf7a2d31b44c39beac08177ee882a3716b750 --- /dev/null +++ b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/ClassesWithParents/B.php @@ -0,0 +1,5 @@ +<?php + +namespace ClassesWithParents; + +class B implements CInterface {} diff --git a/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/ClassesWithParents/BTrait.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/ClassesWithParents/BTrait.php new file mode 100644 index 0000000000000000000000000000000000000000..7242a9f1f2e055ff2bbe52bc5ba76c104e9549d5 --- /dev/null +++ b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/ClassesWithParents/BTrait.php @@ -0,0 +1,8 @@ +<?php + +namespace ClassesWithParents; + +trait BTrait +{ + use ATrait; +} diff --git a/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/ClassesWithParents/CInterface.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/ClassesWithParents/CInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..8eec389be46ebd74ce86f94847555fd2156b7dd6 --- /dev/null +++ b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/ClassesWithParents/CInterface.php @@ -0,0 +1,7 @@ +<?php + +namespace ClassesWithParents; + +interface CInterface extends GInterface +{ +} diff --git a/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/ClassesWithParents/CTrait.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/ClassesWithParents/CTrait.php new file mode 100644 index 0000000000000000000000000000000000000000..110c624965fef800b0c12ae34b214f51e1d77089 --- /dev/null +++ b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/ClassesWithParents/CTrait.php @@ -0,0 +1,7 @@ +<?php + +namespace ClassesWithParents; + +trait CTrait +{ +} diff --git a/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/ClassesWithParents/D.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/ClassesWithParents/D.php new file mode 100644 index 0000000000000000000000000000000000000000..28514d73758f5e7ee2bd1c9a682419caec94b651 --- /dev/null +++ b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/ClassesWithParents/D.php @@ -0,0 +1,8 @@ +<?php + +namespace ClassesWithParents; + +class D extends A +{ + use BTrait; +} diff --git a/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/ClassesWithParents/E.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/ClassesWithParents/E.php new file mode 100644 index 0000000000000000000000000000000000000000..6dc603589834dbd99ce92189dce4fa5a780f676d --- /dev/null +++ b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/ClassesWithParents/E.php @@ -0,0 +1,8 @@ +<?php + +namespace ClassesWithParents; + +class E extends D +{ + use CTrait; +} diff --git a/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/ClassesWithParents/GInterface.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/ClassesWithParents/GInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..208a19d6d80f506290c499a5dbf8e2db1d37b957 --- /dev/null +++ b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/ClassesWithParents/GInterface.php @@ -0,0 +1,7 @@ +<?php + +namespace ClassesWithParents; + +interface GInterface +{ +} diff --git a/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/composer.json b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/composer.json index a4b32ec2b595554bb8676d78d1e1281819620e87..6e3b3b8e2e88dfe522612eb3b1f4ddd1c9944fe7 100644 --- a/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/composer.json +++ b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/composer.json @@ -15,6 +15,7 @@ "homepage": "http://symfony.com/contributors" } ], + "minimum-stability": "dev", "require": { "php": ">=5.3.3" }, 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 96839e9660c664df436f8e0b7d44a0017f0fe270..8f5d6b32c8b8dbeeb13a952b6f2757fbc65aefd8 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/CHANGELOG.md +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/CHANGELOG.md @@ -10,3 +10,6 @@ CHANGELOG * added Definition::clearTag() * component exceptions that inherit base SPL classes are now used exclusively (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/CompilerPassInterface.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/CompilerPassInterface.php index 1ae8bb9b78c74261ead8fd70701fd1c8be367931..beacda9dc7c3c26d61dd9503d58b471053423737 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/CompilerPassInterface.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/CompilerPassInterface.php @@ -29,5 +29,5 @@ interface CompilerPassInterface * * @api */ - function process(ContainerBuilder $container); + public function process(ContainerBuilder $container); } diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php index 9e21972215ab5cd0aea3bc60466e63a1e414d7ac..70592dfda3350d550b63c21d5c44c4147d892040 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php @@ -81,7 +81,7 @@ private function inlineArguments(ContainerBuilder $container, array $arguments) continue; } - if ($this->isInlinableDefinition($container, $id, $definition = $container->getDefinition($id))) { + if ($this->isInlineableDefinition($container, $id, $definition = $container->getDefinition($id))) { $this->compiler->addLogMessage($this->formatter->formatInlineService($this, $id, $this->currentId)); if (ContainerInterface::SCOPE_PROTOTYPE !== $definition->getScope()) { @@ -109,7 +109,7 @@ private function inlineArguments(ContainerBuilder $container, array $arguments) * * @return Boolean If the definition is inlineable */ - private function isInlinableDefinition(ContainerBuilder $container, $id, Definition $definition) + private function isInlineableDefinition(ContainerBuilder $container, $id, Definition $definition) { if (ContainerInterface::SCOPE_PROTOTYPE === $definition->getScope()) { return true; diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/LoggingFormatter.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/LoggingFormatter.php index 0c6c90dbb3d955afa9a0d80f83b5474190d3355b..6bd6161ceb441a0d159db0f8125fa608509d0409 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/LoggingFormatter.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/LoggingFormatter.php @@ -11,7 +11,6 @@ namespace Symfony\Component\DependencyInjection\Compiler; - /** * Used to format logging messages during the compilation. * diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/RepeatablePassInterface.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/RepeatablePassInterface.php index 81209c389342a2423da57afe854a26d7addfe75c..d60ae35bc8f0b2b69b95b96fa201678a95a2e9bb 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/RepeatablePassInterface.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/RepeatablePassInterface.php @@ -24,5 +24,5 @@ interface RepeatablePassInterface extends CompilerPassInterface * * @param RepeatedPass $repeatedPass */ - function setRepeatedPass(RepeatedPass $repeatedPass); + public function setRepeatedPass(RepeatedPass $repeatedPass); } 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 85006446559d8a237ae1befe27872160e79fc7cf..88e1f26ecde07341aab620bb3709578d66735c3d 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Container.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Container.php @@ -220,8 +220,8 @@ public function has($id) /** * Gets a service. * - * If a service is both defined through a set() method and - * with a set*Service() method, the former has always precedence. + * If a service is defined both through a set() method and + * with a get{$id}Service() method, the former has always precedence. * * @param string $id The service identifier * @param integer $invalidBehavior The behavior when the service does not exist @@ -448,7 +448,7 @@ public function isScopeActive($name) * * @return string The camelized string */ - static public function camelize($id) + public static function camelize($id) { return preg_replace_callback('/(^|_|\.)+(.)/', function ($match) { return ('.' === $match[1] ? '_' : '').strtoupper($match[2]); }, $id); } @@ -460,7 +460,7 @@ static public function camelize($id) * * @return string The underscored string */ - static public function underscore($id) + public static function underscore($id) { return strtolower(preg_replace(array('/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'), array('\\1_\\2', '\\1_\\2'), strtr($id, '_', '.'))); } diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerAwareInterface.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerAwareInterface.php index 1879ec06178a9fd492695b1428bf5d4c495f5685..eb96632c66555c94071a59d08de5adf7b79da72b 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerAwareInterface.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerAwareInterface.php @@ -27,5 +27,5 @@ interface ContainerAwareInterface * * @api */ - function setContainer(ContainerInterface $container = null); + public function setContainer(ContainerInterface $container = null); } 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 a706229db4bb7145bf528dc0d651af2ff0790d91..5bf7ead9fb45dc5a40ee3de66085a323edffcd66 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php @@ -560,7 +560,7 @@ public function getAliases() * * @param string $id The service identifier * - * @return string The aliased service identifier + * @return Alias An Alias instance * * @throws InvalidArgumentException if the alias does not exist * @@ -728,24 +728,28 @@ public function findDefinition($id) */ private function createService(Definition $definition, $id) { + $parameterBag = $this->getParameterBag(); + if (null !== $definition->getFile()) { - require_once $this->getParameterBag()->resolveValue($definition->getFile()); + require_once $parameterBag->resolveValue($definition->getFile()); } - $arguments = $this->resolveServices($this->getParameterBag()->resolveValue($definition->getArguments())); + $arguments = $this->resolveServices( + $parameterBag->unescapeValue($parameterBag->resolveValue($definition->getArguments())) + ); if (null !== $definition->getFactoryMethod()) { if (null !== $definition->getFactoryClass()) { - $factory = $this->getParameterBag()->resolveValue($definition->getFactoryClass()); + $factory = $parameterBag->resolveValue($definition->getFactoryClass()); } elseif (null !== $definition->getFactoryService()) { - $factory = $this->get($this->getParameterBag()->resolveValue($definition->getFactoryService())); + $factory = $this->get($parameterBag->resolveValue($definition->getFactoryService())); } else { throw new RuntimeException('Cannot create service from factory method without a factory service or factory class.'); } $service = call_user_func_array(array($factory, $definition->getFactoryMethod()), $arguments); } else { - $r = new \ReflectionClass($this->getParameterBag()->resolveValue($definition->getClass())); + $r = new \ReflectionClass($parameterBag->resolveValue($definition->getClass())); $service = null === $r->getConstructor() ? $r->newInstance() : $r->newInstanceArgs($arguments); } @@ -774,11 +778,11 @@ private function createService(Definition $definition, $id) } if ($ok) { - call_user_func_array(array($service, $call[0]), $this->resolveServices($this->getParameterBag()->resolveValue($call[1]))); + call_user_func_array(array($service, $call[0]), $this->resolveServices($parameterBag->resolveValue($call[1]))); } } - $properties = $this->resolveServices($this->getParameterBag()->resolveValue($definition->getProperties())); + $properties = $this->resolveServices($parameterBag->resolveValue($definition->getProperties())); foreach ($properties as $name => $value) { $service->$name = $value; } @@ -787,7 +791,7 @@ private function createService(Definition $definition, $id) if (is_array($callable) && is_object($callable[0]) && $callable[0] instanceof Reference) { $callable[0] = $this->get((string) $callable[0]); } elseif (is_array($callable)) { - $callable[0] = $this->getParameterBag()->resolveValue($callable[0]); + $callable[0] = $parameterBag->resolveValue($callable[0]); } if (!is_callable($callable)) { @@ -850,7 +854,7 @@ public function findTaggedServiceIds($name) * * @return array An array of Service conditionals */ - static public function getServiceConditionals($value) + public static function getServiceConditionals($value) { $services = array(); diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerInterface.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerInterface.php index 6a5988eb11d3861f48cccea5d4728b3e1f84d0dc..d5e07a06a864dff25baf795c921db875f996ad9c 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerInterface.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerInterface.php @@ -38,7 +38,7 @@ interface ContainerInterface * * @api */ - function set($id, $service, $scope = self::SCOPE_CONTAINER); + public function set($id, $service, $scope = self::SCOPE_CONTAINER); /** * Gets a service. @@ -54,7 +54,7 @@ function set($id, $service, $scope = self::SCOPE_CONTAINER); * * @api */ - function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE); + public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE); /** * Returns true if the given service is defined. @@ -65,7 +65,7 @@ function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE); * * @api */ - function has($id); + public function has($id); /** * Gets a parameter. @@ -78,7 +78,7 @@ function has($id); * * @api */ - function getParameter($name); + public function getParameter($name); /** * Checks if a parameter exists. @@ -89,7 +89,7 @@ function getParameter($name); * * @api */ - function hasParameter($name); + public function hasParameter($name); /** * Sets a parameter. @@ -99,7 +99,7 @@ function hasParameter($name); * * @api */ - function setParameter($name, $value); + public function setParameter($name, $value); /** * Enters the given scope @@ -108,7 +108,7 @@ function setParameter($name, $value); * * @api */ - function enterScope($name); + public function enterScope($name); /** * Leaves the current scope, and re-enters the parent scope @@ -117,7 +117,7 @@ function enterScope($name); * * @api */ - function leaveScope($name); + public function leaveScope($name); /** * Adds a scope to the container @@ -126,7 +126,7 @@ function leaveScope($name); * * @api */ - function addScope(ScopeInterface $scope); + public function addScope(ScopeInterface $scope); /** * Whether this container has the given scope @@ -137,7 +137,7 @@ function addScope(ScopeInterface $scope); * * @api */ - function hasScope($name); + public function hasScope($name); /** * Determines whether the given scope is currently active. @@ -150,5 +150,5 @@ function hasScope($name); * * @api */ - function isScopeActive($name); + public function isScopeActive($name); } diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/DumperInterface.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/DumperInterface.php index 6972cbf8fc7ec7ca9e1b4e70bf9007568b99d407..ba146f61c0dde3a461de70d68a354c148ae7d63f 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/DumperInterface.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/DumperInterface.php @@ -29,5 +29,5 @@ interface DumperInterface * * @api */ - function dump(array $options = array()); + public function dump(array $options = array()); } diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php index 113a24201944718da6a4bc0f9b9cf929dc129dcd..d8791ce196808cadd6fba4fa3d76b03c6f792951 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php @@ -281,7 +281,7 @@ private function escape($arguments) * * @param mixed $value Value to convert */ - static public function phpToXml($value) + public static function phpToXml($value) { switch (true) { case null === $value: 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 4f33a9bc4c4b11c3b7df1ab798f5d2f7c74bcfcc..1d96d240f4bd1061aaf13a76fc24c015f1c73d86 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 @@ -28,5 +28,5 @@ interface ConfigurationExtensionInterface * * @return ConfigurationInterface|null The configuration or null */ - function getConfiguration(array $config, ContainerBuilder $container); + public function getConfiguration(array $config, ContainerBuilder $container); } diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Extension/ExtensionInterface.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Extension/ExtensionInterface.php index 09ebcd84fd700b750f1d75d8631ec9be7c49a629..fc015e1459b47ace7575d98a0cddd3e709af0905 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Extension/ExtensionInterface.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Extension/ExtensionInterface.php @@ -32,7 +32,7 @@ interface ExtensionInterface * * @api */ - function load(array $config, ContainerBuilder $container); + public function load(array $config, ContainerBuilder $container); /** * Returns the namespace to be used for this extension (XML namespace). @@ -41,7 +41,7 @@ function load(array $config, ContainerBuilder $container); * * @api */ - function getNamespace(); + public function getNamespace(); /** * Returns the base path for the XSD files. @@ -50,7 +50,7 @@ function getNamespace(); * * @api */ - function getXsdValidationBasePath(); + public function getXsdValidationBasePath(); /** * Returns the recommended alias to use in XML. @@ -61,5 +61,5 @@ function getXsdValidationBasePath(); * * @api */ - function getAlias(); + public function getAlias(); } diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/IntrospectableContainerInterface.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/IntrospectableContainerInterface.php index 0ffc7297bb800764aca8cb673682fd5bb7517fad..34d6cada9a7a88121b391e20766e3513f52c3623 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/IntrospectableContainerInterface.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/IntrospectableContainerInterface.php @@ -28,6 +28,6 @@ interface IntrospectableContainerInterface extends ContainerInterface * @return Boolean true if the service has been initialized, false otherwise * */ - function initialized($id); + public function initialized($id); } 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 3a27d372de111f70720c284cee2eece81903c9ae..75250277a1a33219bfa727a92b7b086ba75180a7 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 @@ -345,7 +345,7 @@ private function validateSchema(\DOMDocument $dom, $file) ; $current = libxml_use_internal_errors(true); - $valid = $dom->schemaValidateSource($source); + $valid = @$dom->schemaValidateSource($source); foreach ($tmpfiles as $tmpfile) { @unlink($tmpfile); } @@ -448,7 +448,7 @@ private function loadFromExtensions(SimpleXMLElement $xml) * * @return array A PHP array */ - static public function convertDomElementToArray(\DomElement $element) + public static function convertDomElementToArray(\DomElement $element) { $empty = true; $config = array(); diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php index a83f1fcaf446cbf7190d1992473614483bfaea67..908e2a146fa2f623d2370bfd02206073438c96c1 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php @@ -253,7 +253,28 @@ public function isResolved() return $this->resolved; } - private function unescapeValue($value) + /** + * {@inheritDoc} + */ + public function escapeValue($value) + { + if (is_string($value)) { + return str_replace('%', '%%', $value); + } + + if (is_array($value)) { + $result = array(); + foreach ($value as $k => $v) { + $result[$k] = $this->escapeValue($v); + } + + return $result; + } + + return $value; + } + + public function unescapeValue($value) { if (is_string($value)) { return str_replace('%%', '%', $value); diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ParameterBag/ParameterBagInterface.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ParameterBag/ParameterBagInterface.php index da83cbe92c01cd44b0d151ff4cecd72fdc3838a6..a26d6aee1724631675ecb108e3985c9f6d1285c6 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ParameterBag/ParameterBagInterface.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ParameterBag/ParameterBagInterface.php @@ -27,7 +27,7 @@ interface ParameterBagInterface * * @api */ - function clear(); + public function clear(); /** * Adds parameters to the service container parameters. @@ -36,7 +36,7 @@ function clear(); * * @api */ - function add(array $parameters); + public function add(array $parameters); /** * Gets the service container parameters. @@ -45,7 +45,7 @@ function add(array $parameters); * * @api */ - function all(); + public function all(); /** * Gets a service container parameter. @@ -58,7 +58,7 @@ function all(); * * @api */ - function get($name); + public function get($name); /** * Sets a service container parameter. @@ -68,7 +68,7 @@ function get($name); * * @api */ - function set($name, $value); + public function set($name, $value); /** * Returns true if a parameter name is defined. @@ -79,12 +79,12 @@ function set($name, $value); * * @api */ - function has($name); + public function has($name); /** * Replaces parameter placeholders (%name%) by their values for all parameters. */ - function resolve(); + public function resolve(); /** * Replaces parameter placeholders (%name%) by their values. @@ -93,5 +93,23 @@ function resolve(); * * @throws ParameterNotFoundException if a placeholder references a parameter that does not exist */ - function resolveValue($value); + public function resolveValue($value); + + /** + * Escape parameter placeholders % + * + * @param mixed $value + * + * @return mixed + */ + public function escapeValue($value); + + /** + * Unescape parameter placeholders % + * + * @param mixed $value + * + * @return mixed + */ + public function unescapeValue($value); } diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ScopeInterface.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ScopeInterface.php index 44b8c5d9a7001e5a59c8452cad930b1cf6b4888c..81ac67cc4d57ef447e4f11a85a30cab83e95fb2c 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ScopeInterface.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ScopeInterface.php @@ -23,10 +23,10 @@ interface ScopeInterface /** * @api */ - function getName(); + public function getName(); /** * @api */ - function getParentName(); + public function getParentName(); } 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 457d54fa1c5309ac4a9d6aa034a28b9d649bd157..d154602fd330dd0a6ebb91703a6437e0c741668d 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/SimpleXMLElement.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/SimpleXMLElement.php @@ -99,7 +99,7 @@ public function getArgumentsAsPhp($name, $lowercase = true) * * @return mixed */ - static public function phpize($value) + public static function phpize($value) { $value = (string) $value; $lowercaseValue = strtolower($value); diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/TaggedContainerInterface.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/TaggedContainerInterface.php index 81adb2096df6d647d278731a9bada3eb96b0ca93..3b4881703ccd00ba6ce8cbe25e83ea0546d5c4dc 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/TaggedContainerInterface.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/TaggedContainerInterface.php @@ -29,5 +29,5 @@ interface TaggedContainerInterface extends ContainerInterface * * @api */ - function findTaggedServiceIds($name); + public function findTaggedServiceIds($name); } 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 bedcecb7fcb3106c21c54b1ad2343d79dc9b8639..c9e6b07847dc0e5fabfdcd4d0ddc258693a6ad06 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 @@ -251,9 +251,9 @@ public function testCreateServiceArguments() { $builder = new ContainerBuilder(); $builder->register('bar', 'stdClass'); - $builder->register('foo1', 'FooClass')->addArgument(array('foo' => '%value%', '%value%' => 'foo', new Reference('bar'))); + $builder->register('foo1', 'FooClass')->addArgument(array('foo' => '%value%', '%value%' => 'foo', new Reference('bar'), '%%unescape_it%%')); $builder->setParameter('value', 'bar'); - $this->assertEquals(array('foo' => 'bar', 'bar' => 'foo', $builder->get('bar')), $builder->get('foo1')->arguments, '->createService() replaces parameters and service references in the arguments provided by the service definition'); + $this->assertEquals(array('foo' => 'bar', 'bar' => 'foo', $builder->get('bar'), '%unescape_it%'), $builder->get('foo1')->arguments, '->createService() replaces parameters and service references in the arguments provided by the service definition'); } /** @@ -550,5 +550,4 @@ public function testThrowsExceptionWhenSetDefinitionOnAFrozenContainer() } } - 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 557c207c363216782c49dd625b0a0421ce7ce510..ec82cc1e803b0e707e13f16e21ecd325985d6eb8 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 @@ -16,7 +16,7 @@ class CrossCheckTest extends \PHPUnit_Framework_TestCase { - static protected $fixturesPath; + protected static $fixturesPath; protected function setUp() { @@ -25,7 +25,7 @@ protected function setUp() } } - static public function setUpBeforeClass() + public static function setUpBeforeClass() { self::$fixturesPath = __DIR__.'/Fixtures/'; 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 69e775d26c02ebfe821b370f9bc1844ea36b0a6f..d3b93fdee8cd08483371fd44fd4635d407a1c569 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 @@ -16,7 +16,7 @@ class GraphvizDumperTest extends \PHPUnit_Framework_TestCase { - static protected $fixturesPath; + protected static $fixturesPath; protected function setUp() { @@ -25,7 +25,7 @@ protected function setUp() } } - static public function setUpBeforeClass() + 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 a072356064d8ad2b0298c28434c72bd5d79b0fcf..c1e2070a98d93cbaf0df1883bca4db9a788b2222 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 @@ -19,7 +19,7 @@ class PhpDumperTest extends \PHPUnit_Framework_TestCase { - static protected $fixturesPath; + protected static $fixturesPath; protected function setUp() { @@ -28,7 +28,7 @@ protected function setUp() } } - static public function setUpBeforeClass() + public static function setUpBeforeClass() { self::$fixturesPath = realpath(__DIR__.'/../Fixtures/'); } 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 6618982e07bd2b224daf40d713487965a43d9a49..b2cddb593de7e237e8657e1816d95d2d8a699737 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 @@ -16,7 +16,7 @@ class XmlDumperTest extends \PHPUnit_Framework_TestCase { - static protected $fixturesPath; + protected static $fixturesPath; protected function setUp() { @@ -25,7 +25,7 @@ protected function setUp() } } - static public function setUpBeforeClass() + 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 2dcb3b8212ae576cd02f26c3833f4bdfb954febd..47cc4bea1e0c2bbc1a3acd04add636743918d814 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 @@ -16,7 +16,7 @@ class YamlDumperTest extends \PHPUnit_Framework_TestCase { - static protected $fixturesPath; + protected static $fixturesPath; protected function setUp() { @@ -25,7 +25,7 @@ protected function setUp() } } - static public function setUpBeforeClass() + public static function setUpBeforeClass() { self::$fixturesPath = realpath(__DIR__.'/../Fixtures/'); } diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php index 3c27376591c527b31fe8841c171c95b146ceda58..514df23e5104cc1f4d79e0ce443e095a91f95bb5 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php @@ -16,17 +16,17 @@ public function configure($instance) $instance->configure(); } - static public function getInstance() + public static function getInstance() { return new self(); } - static public function configureStatic($instance) + public static function configureStatic($instance) { $instance->configure(); } - static public function configureStatic1() + public static function configureStatic1() { } } diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/foo.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/foo.php index 2c53122756da549b8035f4c44400e26a1b786235..180bb384a3de6d4c1c26eb535635299c0394808d 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/foo.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/foo.php @@ -11,7 +11,7 @@ public function __construct($arguments = array()) $this->arguments = $arguments; } - static public function getInstance($arguments = array()) + public static function getInstance($arguments = array()) { $obj = new self($arguments); $obj->called = true; diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php index 448934c48d9128137147a27f3f4e577aae2eb3bc..bba9c8c85feb978fe3738ae13b18b35720b1020f 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php @@ -17,12 +17,12 @@ class IniFileLoaderTest extends \PHPUnit_Framework_TestCase { - static protected $fixturesPath; + protected static $fixturesPath; protected $container; protected $loader; - static public function setUpBeforeClass() + public static function setUpBeforeClass() { self::$fixturesPath = realpath(__DIR__.'/../Fixtures/'); } 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 1a157e6dcf192b2f317ab788b87055ae16e26485..12109c2b497659ef8ec8ca45574dfe302e8347ec 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 @@ -25,7 +25,7 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase { - static protected $fixturesPath; + protected static $fixturesPath; protected function setUp() { @@ -34,7 +34,7 @@ protected function setUp() } } - static public function setUpBeforeClass() + public static function setUpBeforeClass() { self::$fixturesPath = realpath(__DIR__.'/../Fixtures/'); require_once self::$fixturesPath.'/includes/foo.php'; diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php index 35b59853b0d003a4b73e15a84065fd304b0a9335..e655d3bd8981aca44e0bfe6cb776561ea49338f7 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php @@ -23,7 +23,7 @@ class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase { - static protected $fixturesPath; + protected static $fixturesPath; protected function setUp() { @@ -36,7 +36,7 @@ protected function setUp() } } - static public function setUpBeforeClass() + public static function setUpBeforeClass() { self::$fixturesPath = realpath(__DIR__.'/../Fixtures/'); require_once self::$fixturesPath.'/includes/foo.php'; diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ParameterBag/ParameterBagTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ParameterBag/ParameterBagTest.php index 29d238090981c4ac6b14f09adb658c6064d096ed..46fb3583715247e44d631d8bd0f87a469a8ab27e 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ParameterBag/ParameterBagTest.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ParameterBag/ParameterBagTest.php @@ -201,6 +201,22 @@ public function testResolveUnescapesValue() $this->assertEquals(array('bar' => array('ding' => 'I\'m a bar %foo %bar')), $bag->get('foo'), '->resolveValue() supports % escaping by doubling it'); } + /** + * @covers Symfony\Component\DependencyInjection\ParameterBag\ParameterBag::escapeValue + */ + public function testEscapeValue() + { + $bag = new ParameterBag(); + + $bag->add(array( + 'foo' => $bag->escapeValue(array('bar' => array('ding' => 'I\'m a bar %foo %bar', 'zero' => null))), + 'bar' => $bag->escapeValue('I\'m a %foo%'), + )); + + $this->assertEquals('I\'m a %%foo%%', $bag->get('bar'), '->escapeValue() escapes % by doubling it'); + $this->assertEquals(array('bar' => array('ding' => 'I\'m a bar %%foo %%bar', 'zero' => null)), $bag->get('foo'), '->escapeValue() escapes % by doubling it'); + } + /** * @covers Symfony\Component\DependencyInjection\ParameterBag\ParameterBag::resolve * @dataProvider stringsWithSpacesProvider diff --git a/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/CHANGELOG.md b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/CHANGELOG.md index 9f8c8129e204faa399c35e972df392ee40e88df4..536c5ac729812f028180eaa50e9c7e8345049852 100644 --- a/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/CHANGELOG.md +++ b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/CHANGELOG.md @@ -13,4 +13,4 @@ CHANGELOG * added GenericEvent event class * added the possibility for subscribers to subscribe several times for the same event - * added UnmodifiableEventDispatcher + * added ImmutableEventDispatcher diff --git a/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcherInterface.php b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcherInterface.php index 0a538765bd359abd5ba99e52c25e3d8dfc3f2a13..a67a979014f9be5409e5c2cac86a3b0fac7b6242 100644 --- a/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcherInterface.php +++ b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcherInterface.php @@ -21,12 +21,12 @@ interface TraceableEventDispatcherInterface * * @return array An array of called listeners */ - function getCalledListeners(); + public function getCalledListeners(); /** * Gets the not called listeners. * * @return array An array of not called listeners */ - function getNotCalledListeners(); + public function getNotCalledListeners(); } diff --git a/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcherInterface.php b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcherInterface.php index e53d71d0e5a2a09d1d63b5cc74de68257e7ba103..7aead23b0d9259f9fa8fbe9d211aff3d6d64bfec 100644 --- a/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcherInterface.php +++ b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcherInterface.php @@ -35,7 +35,7 @@ interface EventDispatcherInterface * * @api */ - function dispatch($eventName, Event $event = null); + public function dispatch($eventName, Event $event = null); /** * Adds an event listener that listens on the specified events. @@ -47,7 +47,7 @@ function dispatch($eventName, Event $event = null); * * @api */ - function addListener($eventName, $listener, $priority = 0); + public function addListener($eventName, $listener, $priority = 0); /** * Adds an event subscriber. @@ -59,7 +59,7 @@ function addListener($eventName, $listener, $priority = 0); * * @api */ - function addSubscriber(EventSubscriberInterface $subscriber); + public function addSubscriber(EventSubscriberInterface $subscriber); /** * Removes an event listener from the specified events. @@ -67,14 +67,14 @@ function addSubscriber(EventSubscriberInterface $subscriber); * @param string|array $eventName The event(s) to remove a listener from * @param callable $listener The listener to remove */ - function removeListener($eventName, $listener); + public function removeListener($eventName, $listener); /** * Removes an event subscriber. * * @param EventSubscriberInterface $subscriber The subscriber */ - function removeSubscriber(EventSubscriberInterface $subscriber); + public function removeSubscriber(EventSubscriberInterface $subscriber); /** * Gets the listeners of a specific event or all listeners. @@ -83,7 +83,7 @@ function removeSubscriber(EventSubscriberInterface $subscriber); * * @return array The event listeners for the specified event, or all event listeners by event name */ - function getListeners($eventName = null); + public function getListeners($eventName = null); /** * Checks whether an event has any registered listeners. @@ -92,5 +92,5 @@ function getListeners($eventName = null); * * @return Boolean true if the specified event has any listeners, false otherwise */ - function hasListeners($eventName = null); + public function hasListeners($eventName = null); } diff --git a/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventSubscriberInterface.php b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventSubscriberInterface.php index 1e85b988bfdc0ec2469c8bd9430250fc126e61a6..080f892fdf60a5c47655f2a107ce8bd825c9e968 100644 --- a/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventSubscriberInterface.php +++ b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventSubscriberInterface.php @@ -46,5 +46,5 @@ interface EventSubscriberInterface * * @api */ - static function getSubscribedEvents(); + public static function getSubscribedEvents(); } diff --git a/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/UnmodifiableEventDispatcher.php b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/ImmutableEventDispatcher.php similarity index 96% rename from core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/UnmodifiableEventDispatcher.php rename to core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/ImmutableEventDispatcher.php index c7097aa4298733909e2ed5b57c780f4b057d6685..b70b81a8b2ed79b8001cef0c4932b9bf741cdcc2 100644 --- a/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/UnmodifiableEventDispatcher.php +++ b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/ImmutableEventDispatcher.php @@ -16,7 +16,7 @@ * * @author Bernhard Schussek <bschussek@gmail.com> */ -class UnmodifiableEventDispatcher implements EventDispatcherInterface +class ImmutableEventDispatcher implements EventDispatcherInterface { /** * The proxied dispatcher. diff --git a/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/ContainerAwareEventDispatcherTest.php b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/ContainerAwareEventDispatcherTest.php index c62fc10bad4d74ddc871c93df98cdf375ffb8b36..71f3ad05215ecdf15117050fef95b6d3e2e75ea6 100644 --- a/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/ContainerAwareEventDispatcherTest.php +++ b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/ContainerAwareEventDispatcherTest.php @@ -235,14 +235,14 @@ public function testRemoveBeforeDispatch() class Service { - function onEvent(Event $e) + public function onEvent(Event $e) { } } class SubscriberService implements EventSubscriberInterface { - static function getSubscribedEvents() + public static function getSubscribedEvents() { return array( 'onEvent' => 'onEvent', @@ -251,7 +251,7 @@ static function getSubscribedEvents() ); } - function onEvent(Event $e) + public function onEvent(Event $e) { } } diff --git a/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/EventTest.php b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/EventTest.php index cbc3910a14e3099824c28d808e3b8bd2d5e904ec..52aa9ad68a8f431320f23210fb7d87343b56c38f 100644 --- a/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/EventTest.php +++ b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/EventTest.php @@ -29,7 +29,6 @@ class EventTest extends \PHPUnit_Framework_TestCase */ protected $dispatcher; - /** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. diff --git a/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/UnmodifiableEventDispatcherTest.php b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/ImmutableEventDispatcherTest.php similarity index 91% rename from core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/UnmodifiableEventDispatcherTest.php rename to core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/ImmutableEventDispatcherTest.php index d2502b1957c5d484d7a4eb674f0e09cfd27acc35..6402f89fa5fd4bc8822b4e6d57025b4619e6c796 100644 --- a/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/UnmodifiableEventDispatcherTest.php +++ b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/ImmutableEventDispatcherTest.php @@ -12,13 +12,13 @@ namespace Symfony\Component\EventDispatcher\Tests; use Symfony\Component\EventDispatcher\Event; -use Symfony\Component\EventDispatcher\UnmodifiableEventDispatcher; +use Symfony\Component\EventDispatcher\ImmutableEventDispatcher; use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** * @author Bernhard Schussek <bschussek@gmail.com> */ -class UnmodifiableEventDispatcherTest extends \PHPUnit_Framework_TestCase +class ImmutableEventDispatcherTest extends \PHPUnit_Framework_TestCase { /** * @var \PHPUnit_Framework_MockObject_MockObject @@ -26,14 +26,14 @@ class UnmodifiableEventDispatcherTest extends \PHPUnit_Framework_TestCase private $innerDispatcher; /** - * @var UnmodifiableEventDispatcher + * @var ImmutableEventDispatcher */ private $dispatcher; protected function setUp() { $this->innerDispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); - $this->dispatcher = new UnmodifiableEventDispatcher($this->innerDispatcher); + $this->dispatcher = new ImmutableEventDispatcher($this->innerDispatcher); } public function testDispatchDelegates() diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/CHANGELOG.md b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/CHANGELOG.md index d8664e60bcf5a3995dfc91d3bb90ec049c93a947..4a00207e6700430a91292d8e6fcbc9ce5dcd37f8 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/CHANGELOG.md +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/CHANGELOG.md @@ -4,6 +4,7 @@ CHANGELOG 2.1.0 ----- + * added Request::getSchemeAndHttpHost() and Request::getUserInfo() * added a fluent interface to the Response class * added Request::isProxyTrusted() * added JsonResponse @@ -21,7 +22,8 @@ CHANGELOG * [BC BREAK] Moved all session related classes and interfaces into own namespace, as `Symfony\Component\HttpFoundation\Session` and renamed classes accordingly. Session handlers are located in the subnamespace `Symfony\Component\HttpFoundation\Session\Handler`. - * SessionHandlers must implement `\SessionHandlerInterface`. + * SessionHandlers must implement `\SessionHandlerInterface` or extend from the + `Symfony\Component\HttpFoundation\Storage\Handler\NativeSessionHandler` base class. * Added internal storage driver proxy mechanism for forward compatibility with PHP 5.4 `\SessionHandler` class. * Added session handlers for custom Memcache, Memcached and Null session save handlers. @@ -52,8 +54,8 @@ CHANGELOG * Added `FlashBag`. Flashes expire when retrieved by `get()` or `all()`. This implementation is ESI compatible. * Added `AutoExpireFlashBag` (default) to replicate Symfony 2.0.x auto expire - behaviour of messages auto expiring. - after one page page load. Messages must be retrieved by `get()` or `all()`. + behaviour of messages auto expiring after one page page load. Messages must + be retrieved by `get()` or `all()`. * Added `Symfony\Component\HttpFoundation\Attribute\AttributeBag` to replicate attributes storage behaviour from 2.0.x (default). * Added `Symfony\Component\HttpFoundation\Attribute\NamespacedAttributeBag` for 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 47c2199f2bb4c6b09a0b8237a8a12800bd21e8a4..fe3a4cff42b69daa34768f2b5361f40b277d6c95 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Cookie.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Cookie.php @@ -72,6 +72,11 @@ public function __construct($name, $value = null, $expire = 0, $path = '/', $dom $this->httpOnly = (Boolean) $httpOnly; } + /** + * Returns the cookie as a string. + * + * @return string The cookie + */ public function __toString() { $str = urlencode($this->getName()).'='; diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesser.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesser.php index dcea613b2057ffb56728e10fca904af002abe3e5..d5715f6f5506ad3f642515abac0bbb598d986b74 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesser.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesser.php @@ -30,12 +30,14 @@ class ExtensionGuesser implements ExtensionGuesserInterface { /** * The singleton instance + * * @var ExtensionGuesser */ - static private $instance = null; + private static $instance = null; /** * All registered ExtensionGuesserInterface instances + * * @var array */ protected $guessers = array(); @@ -45,7 +47,7 @@ class ExtensionGuesser implements ExtensionGuesserInterface * * @return ExtensionGuesser */ - static public function getInstance() + public static function getInstance() { if (null === self::$instance) { self::$instance = new self(); @@ -83,7 +85,7 @@ public function register(ExtensionGuesserInterface $guesser) * value. * * @param string $mimeType The mime type - * @return string The guessed extension or NULL, if none could be guessed + * @return string The guessed extension or NULL, if none could be guessed */ public function guess($mimeType) { diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesserInterface.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesserInterface.php index e8db065724850c60f03c27a1364081bb9389772c..83736969765ed167c53fd682cd583174f940cbb1 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesserInterface.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesserInterface.php @@ -20,7 +20,7 @@ interface ExtensionGuesserInterface * Makes a best guess for a file extension, given a mime type * * @param string $mimeType The mime type - * @return string The guessed extension or NULL, if none could be guessed + * @return string The guessed extension or NULL, if none could be guessed */ - function guess($mimeType); + public function guess($mimeType); } diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php index 0761c26267d8181d44ece69f1b58581104c198fc..3da63dd4834c652135c210e8e705aa57ecb1d57a 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php @@ -43,15 +43,13 @@ public function __construct($cmd = 'file -b --mime %s 2>/dev/null') * * @return Boolean */ - static public function isSupported() + public static function isSupported() { return !defined('PHP_WINDOWS_VERSION_BUILD'); } /** - * Guesses the mime type of the file with the given path - * - * @see MimeTypeGuesserInterface::guess() + * {@inheritdoc} */ public function guess($path) { diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php index 873b94b66be604ea31d65483332aaf45ab5a0bdc..09a0d7ed198ff721a562162cc31bc8f6ecb96b41 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php @@ -26,15 +26,13 @@ class FileinfoMimeTypeGuesser implements MimeTypeGuesserInterface * * @return Boolean */ - static public function isSupported() + public static function isSupported() { return function_exists('finfo_open'); } /** - * Guesses the mime type of the file with the given path - * - * @see MimeTypeGuesserInterface::guess() + * {@inheritdoc} */ public function guess($path) { diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php index 805f223c4644458a681ceae84fad756edd312f52..13fe4a2fdc8d899a98acf06a2d736db4e12f4560 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Symfony\Component\HttpFoundation\File\Mimetype; +namespace Symfony\Component\HttpFoundation\File\MimeType; /** * Provides a best-guess mapping of mime type to file extension. @@ -542,6 +542,7 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface 'application/x-pkcs7-certificates' => 'p7b', 'application/x-pkcs7-certreqresp' => 'p7r', 'application/x-rar-compressed' => 'rar', + 'application/x-rar' => 'rar', 'application/x-sh' => 'sh', 'application/x-shar' => 'shar', 'application/x-shockwave-flash' => 'swf', @@ -730,11 +731,7 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface ); /** - * Returns the extension based on the mime type. - * - * If the mime type is unknown, returns null. - * - * @return string|null The guessed extension or null if it cannot be guessed + * {@inheritdoc} */ public function guess($mimeType) { 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 84bd4ce29100f503f64529acfc1622e85dc714b9..a8247ab46f947e7a5570b455c6fc7b46c975128e 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,6 +11,7 @@ namespace Symfony\Component\HttpFoundation\File\MimeType; +use Symfony\Component\HttpFoundation\File\Exception\FileException; use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException; @@ -34,12 +35,14 @@ class MimeTypeGuesser implements MimeTypeGuesserInterface { /** * The singleton instance + * * @var MimeTypeGuesser */ - static private $instance = null; + private static $instance = null; /** * All registered MimeTypeGuesserInterface instances + * * @var array */ protected $guessers = array(); @@ -49,7 +52,7 @@ class MimeTypeGuesser implements MimeTypeGuesserInterface * * @return MimeTypeGuesser */ - static public function getInstance() + public static function getInstance() { if (null === self::$instance) { self::$instance = new self(); diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesserInterface.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesserInterface.php index 40e8ffd72d26f9ee30814365c16b2ae95e875663..87ea20ff6fa1b33271e2d74496a1f1d926d82fd7 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesserInterface.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesserInterface.php @@ -11,6 +11,9 @@ namespace Symfony\Component\HttpFoundation\File\MimeType; +use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; +use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException; + /** * Guesses the mime type of a file * @@ -28,5 +31,5 @@ interface MimeTypeGuesserInterface * @throws FileNotFoundException If the file does not exist * @throws AccessDeniedException If the file could not be read */ - function guess($path); + public function guess($path); } 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 7e57b0274a36542d5e2444b75c11f4d08264005d..6d6dda1bb1a45de14dd5858509741a1115028ce2 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 @@ -199,9 +199,9 @@ public function move($directory, $name = null) /** * Returns the maximum size of an uploaded file as configured in php.ini * - * @return type The maximum size of an uploaded file in bytes + * @return int The maximum size of an uploaded file in bytes */ - static public function getMaxFilesize() + public static function getMaxFilesize() { $max = trim(ini_get('upload_max_filesize')); diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/FileBag.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/FileBag.php index 0f85eb05b334e984b087c000559d2aa1704cef12..b2775efb2fb0f6d5742bf6311be100dbb7900f80 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/FileBag.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/FileBag.php @@ -23,7 +23,7 @@ */ class FileBag extends ParameterBag { - static private $fileKeys = array('error', 'name', 'size', 'tmp_name', 'type'); + private static $fileKeys = array('error', 'name', 'size', 'tmp_name', 'type'); /** * Constructor. @@ -38,8 +38,7 @@ public function __construct(array $parameters = array()) } /** - * (non-PHPdoc) - * @see Symfony\Component\HttpFoundation\ParameterBag::replace() + * {@inheritdoc} * * @api */ @@ -50,23 +49,21 @@ public function replace(array $files = array()) } /** - * (non-PHPdoc) - * @see Symfony\Component\HttpFoundation\ParameterBag::set() + * {@inheritdoc} * * @api */ public function set($key, $value) { - if (is_array($value) || $value instanceof UploadedFile) { - parent::set($key, $this->convertFileInformation($value)); - } else { + if (!is_array($value) && !$value instanceof UploadedFile) { throw new \InvalidArgumentException('An uploaded file must be an array or an instance of UploadedFile.'); } + + parent::set($key, $this->convertFileInformation($value)); } /** - * (non-PHPdoc) - * @see Symfony\Component\HttpFoundation\ParameterBag::add() + * {@inheritdoc} * * @api */ 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 734628ffe8fb3e33a252c80f145151c2b2deaead..43ade8ffaf6fedfc759cb8af87fa04ef67d31d29 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/JsonResponse.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/JsonResponse.php @@ -38,7 +38,7 @@ public function __construct($data = array(), $status = 200, $headers = array()) /** * {@inheritDoc} */ - static public function create($data = array(), $status = 200, $headers = array()) + public static function create($data = array(), $status = 200, $headers = array()) { return new static($data, $status, $headers); } @@ -52,7 +52,7 @@ static public function create($data = array(), $status = 200, $headers = array() */ public function setCallback($callback = null) { - if ($callback) { + if (null !== $callback) { // taken from http://www.geekality.net/2011/08/03/valid-javascript-identifier/ $pattern = '/^[$_\p{L}][$_\p{L}\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*+$/u'; $parts = explode('.', $callback); @@ -95,7 +95,7 @@ public function setData($data = array()) */ protected function update() { - if ($this->callback) { + if (null !== $this->callback) { // Not using application/javascript for compatibility reasons with older browsers. $this->headers->set('Content-Type', 'text/javascript', true); 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 a39756eb6f3c96501b96328cd2aba8b47face6fd..0273d933c044f904cff6c5fc2240152013d69338 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ParameterBag.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ParameterBag.php @@ -94,6 +94,8 @@ public function add(array $parameters = array()) * @param mixed $default The default value if the parameter key does not exist * @param boolean $deep If true, a path like foo[bar] will find deeper items * + * @return mixed + * * @api */ public function get($path, $default = null, $deep = false) 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 27676ec0d5147dd63d85c9f499e84ca336bc15cf..a9d98e6b3a9097f824a65025ad031833f0dbff39 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RedirectResponse.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RedirectResponse.php @@ -39,24 +39,9 @@ public function __construct($url, $status = 302, $headers = array()) throw new \InvalidArgumentException('Cannot redirect to an empty URL.'); } - $this->targetUrl = $url; - - parent::__construct( - sprintf('<!DOCTYPE html> -<html> - <head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <meta http-equiv="refresh" content="1;url=%1$s" /> + parent::__construct('', $status, $headers); - <title>Redirecting to %1$s</title> - </head> - <body> - Redirecting to <a href="%1$s">%1$s</a>. - </body> -</html>', htmlspecialchars($url, ENT_QUOTES, 'UTF-8')), - $status, - array_merge($headers, array('Location' => $url)) - ); + $this->setTargetUrl($url); if (!$this->isRedirect()) { throw new \InvalidArgumentException(sprintf('The HTTP status code is not a redirect ("%s" given).', $status)); @@ -66,7 +51,7 @@ public function __construct($url, $status = 302, $headers = array()) /** * {@inheritDoc} */ - static public function create($url = '', $status = 302, $headers = array()) + public static function create($url = '', $status = 302, $headers = array()) { return new static($url, $status, $headers); } @@ -80,4 +65,38 @@ public function getTargetUrl() { return $this->targetUrl; } + + /** + * Sets the redirect target of this response. + * + * @param string $url The URL to redirect to + * + * @return RedirectResponse The current response. + */ + public function setTargetUrl($url) + { + if (empty($url)) { + throw new \InvalidArgumentException('Cannot redirect to an empty URL.'); + } + + $this->targetUrl = $url; + + $this->setContent( + sprintf('<!DOCTYPE html> +<html> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + <meta http-equiv="refresh" content="1;url=%1$s" /> + + <title>Redirecting to %1$s</title> + </head> + <body> + Redirecting to <a href="%1$s">%1$s</a>. + </body> +</html>', htmlspecialchars($url, ENT_QUOTES, 'UTF-8'))); + + $this->headers->set('Location', $url); + + return $this; + } } 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 581b4c999a91d22dbea4cbeb85f307852f94553e..848c3d118ab9cdc842a9b4eae34b293f4c3b0e27 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Request.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Request.php @@ -30,7 +30,7 @@ */ class Request { - static protected $trustProxy = false; + protected static $trustProxy = false; /** * @var \Symfony\Component\HttpFoundation\ParameterBag @@ -87,17 +87,17 @@ class Request protected $content; /** - * @var string + * @var array */ protected $languages; /** - * @var string + * @var array */ protected $charsets; /** - * @var string + * @var array */ protected $acceptableContentTypes; @@ -147,9 +147,9 @@ class Request protected $defaultLocale = 'en'; /** - * @var string + * @var array */ - static protected $formats; + protected static $formats; /** * Constructor. @@ -213,7 +213,7 @@ public function initialize(array $query = array(), array $request = array(), arr * * @api */ - static public function createFromGlobals() + public static function createFromGlobals() { $request = new static($_GET, $_POST, array(), $_COOKIE, $_FILES, $_SERVER); @@ -232,7 +232,7 @@ static public function createFromGlobals() * * @param string $uri The URI * @param string $method The HTTP method - * @param array $parameters The request (GET) or query (POST) parameters + * @param array $parameters The query (GET) or request (POST) parameters * @param array $cookies The request cookies ($_COOKIE) * @param array $files The request files ($_FILES) * @param array $server The server parameters ($_SERVER) @@ -242,7 +242,7 @@ static public function createFromGlobals() * * @api */ - static public function create($uri, $method = 'GET', $parameters = array(), $cookies = array(), $files = array(), $server = array(), $content = null) + public static function create($uri, $method = 'GET', $parameters = array(), $cookies = array(), $files = array(), $server = array(), $content = null) { $defaults = array( 'SERVER_NAME' => 'localhost', @@ -305,15 +305,12 @@ static public function create($uri, $method = 'GET', $parameters = array(), $coo } if (isset($components['query'])) { - $queryString = html_entity_decode($components['query']); - parse_str($queryString, $qs); - if (is_array($qs)) { - $query = array_replace($qs, $query); - } + parse_str(html_entity_decode($components['query']), $qs); + $query = array_replace($qs, $query); } - $queryString = http_build_query($query); + $queryString = http_build_query($query, '', '&'); - $uri = $components['path'].($queryString ? '?'.$queryString : ''); + $uri = $components['path'].('' !== $queryString ? '?'.$queryString : ''); $server = array_replace($defaults, $server, array( 'REQUEST_METHOD' => strtoupper($method), @@ -335,6 +332,8 @@ static public function create($uri, $method = 'GET', $parameters = array(), $coo * @param array $files The FILES parameters * @param array $server The SERVER parameters * + * @return Request The duplicated request + * * @api */ public function duplicate(array $query = null, array $request = null, array $attributes = null, array $cookies = null, array $files = null, array $server = null) @@ -405,7 +404,8 @@ public function __toString() /** * Overrides the PHP global variables according to this request instance. * - * It overrides $_GET, $_POST, $_REQUEST, $_SERVER, $_COOKIE, and $_FILES. + * It overrides $_GET, $_POST, $_REQUEST, $_SERVER, $_COOKIE. + * $_FILES is never override, see rfc1867 * * @api */ @@ -415,7 +415,6 @@ public function overrideGlobals() $_POST = $this->request->all(); $_SERVER = $this->server->all(); $_COOKIE = $this->cookies->all(); - // FIXME: populate $_FILES foreach ($this->headers->all() as $key => $value) { $key = strtoupper(str_replace('-', '_', $key)); @@ -426,9 +425,15 @@ public function overrideGlobals() } } - // FIXME: should read variables_order and request_order - // to know which globals to merge and in which order - $_REQUEST = array_merge($_GET, $_POST); + $request = array('g' => $_GET, 'p' => $_POST, 'c' => $_COOKIE); + + $requestOrder = ini_get('request_order') ?: ini_get('variable_order'); + $requestOrder = preg_replace('#[^cgp]#', '', strtolower($requestOrder)) ?: 'gp'; + + $_REQUEST = array(); + foreach (str_split($requestOrder) as $order) { + $_REQUEST = array_merge($_REQUEST, $request[$order]); + } } /** @@ -439,7 +444,7 @@ public function overrideGlobals() * * @api */ - static public function trustProxyData() + public static function trustProxyData() { self::$trustProxy = true; } @@ -450,11 +455,54 @@ static public function trustProxyData() * * @return boolean */ - static public function isProxyTrusted() + public static function isProxyTrusted() { return self::$trustProxy; } + /** + * Normalizes a query string. + * + * It builds a normalized query string, where keys/value pairs are alphabetized, + * have consistent escaping and unneeded delimiters are removed. + * + * @param string $qs Query string + * + * @return string A normalized query string for the Request + */ + public static function normalizeQueryString($qs) + { + if ('' == $qs) { + return ''; + } + + $parts = array(); + $order = array(); + + foreach (explode('&', $qs) as $param) { + if ('' === $param || '=' === $param[0]) { + // Ignore useless delimiters, e.g. "x=y&". + // Also ignore pairs with empty key, even if there was a value, e.g. "=value", as such nameless values cannot be retrieved anyway. + // PHP also does not include them when building _GET. + continue; + } + + $keyValuePair = explode('=', $param, 2); + + // GET parameters, that are submitted from a HTML form, encode spaces as "+" by default (as defined in enctype application/x-www-form-urlencoded). + // PHP also converts "+" to spaces when filling the global _GET or when using the function parse_str. This is why we use urldecode and then normalize to + // RFC 3986 with rawurlencode. + $parts[] = isset($keyValuePair[1]) ? + rawurlencode(urldecode($keyValuePair[0])).'='.rawurlencode(urldecode($keyValuePair[1])) : + rawurlencode(urldecode($keyValuePair[0])); + $order[] = urldecode($keyValuePair[0]); + } + + array_multisort($order, SORT_ASC, $parts); + + return implode('&', $parts); + } + /** * Gets a "parameter" value. * @@ -467,12 +515,12 @@ static public function isProxyTrusted() * * slow * * prefer to get from a "named" source * - * It is better to explicity get request parameters from the appropriate + * It is better to explicitly get request parameters from the appropriate * public property instead (query, request, attributes, ...). * - * @param string $key the key - * @param mixed $default the default value - * @param type $deep is parameter deep in multidimensional array + * @param string $key the key + * @param mixed $default the default value + * @param Boolean $deep is parameter deep in multidimensional array * * @return mixed */ @@ -504,9 +552,7 @@ public function getSession() public function hasPreviousSession() { // the check for $this->session avoids malicious users trying to fake a session cookie with proper name - $sessionName = $this->hasSession() ? $this->session->getName() : null; - - return $this->cookies->has($sessionName) && $this->hasSession(); + return $this->hasSession() && $this->cookies->has($this->session->getName()); } /** @@ -555,6 +601,7 @@ public function getClientIp() return $cleanIpAddress; } } + return ''; } } @@ -691,6 +738,23 @@ public function getPassword() return $this->server->get('PHP_AUTH_PW'); } + /** + * Gets the user info. + * + * @return string A user name and, optionally, scheme-specific information about how to gain authorization to access the server + */ + public function getUserInfo() + { + $userinfo = $this->getUser(); + + $pass = $this->getPassword(); + if ('' != $pass) { + $userinfo .= ":$pass"; + } + + return $userinfo; + } + /** * Returns the HTTP host being requested. * @@ -728,6 +792,16 @@ public function getRequestUri() return $this->requestUri; } + /** + * Gets the scheme and HTTP host. + * + * @return string The scheme and HTTP host + */ + public function getSchemeAndHttpHost() + { + return $this->getScheme().'://'.(('' != $auth = $this->getUserInfo()) ? $auth.'@' : '').$this->getHttpHost(); + } + /** * Generates a normalized URI for the Request. * @@ -744,20 +818,7 @@ public function getUri() $qs = '?'.$qs; } - $auth = ''; - if ($user = $this->getUser()) { - $auth = $user; - } - - if ($pass = $this->getPassword()) { - $auth .= ":$pass"; - } - - if ('' !== $auth) { - $auth .= '@'; - } - - return $this->getScheme().'://'.$auth.$this->getHttpHost().$this->getBaseUrl().$this->getPathInfo().$qs; + return $this->getSchemeAndHttpHost().$this->getBaseUrl().$this->getPathInfo().$qs; } /** @@ -771,7 +832,7 @@ public function getUri() */ public function getUriForPath($path) { - return $this->getScheme().'://'.$this->getHttpHost().$this->getBaseUrl().$path; + return $this->getSchemeAndHttpHost().$this->getBaseUrl().$path; } /** @@ -786,26 +847,9 @@ public function getUriForPath($path) */ public function getQueryString() { - if (!$qs = $this->server->get('QUERY_STRING')) { - return null; - } - - $parts = array(); - $order = array(); - - foreach (explode('&', $qs) as $segment) { - if (false === strpos($segment, '=')) { - $parts[] = $segment; - $order[] = $segment; - } else { - $tmp = explode('=', rawurldecode($segment), 2); - $parts[] = rawurlencode($tmp[0]).'='.rawurlencode($tmp[1]); - $order[] = $tmp[0]; - } - } - array_multisort($order, SORT_ASC, $parts); + $qs = static::normalizeQueryString($this->server->get('QUERY_STRING')); - return implode('&', $parts); + return '' === $qs ? null : $qs; } /** @@ -881,7 +925,7 @@ public function getMethod() if (null === $this->method) { $this->method = strtoupper($this->server->get('REQUEST_METHOD', 'GET')); if ('POST' === $this->method) { - $this->method = strtoupper($this->headers->get('X-HTTP-METHOD-OVERRIDE', $this->request->get('_method', 'POST'))); + $this->method = strtoupper($this->headers->get('X-HTTP-METHOD-OVERRIDE', $this->request->get('_method', $this->query->get('_method', 'POST')))); } } @@ -911,7 +955,7 @@ public function getMimeType($format) * * @param string $mimeType The associated mime type * - * @return string The format (null if not found) + * @return string|null The format (null if not found) * * @api */ @@ -990,7 +1034,7 @@ public function setRequestFormat($format) /** * Gets the format associated with the request. * - * @return string The format (null if no content type is present) + * @return string|null The format (null if no content type is present) * * @api */ @@ -1093,6 +1137,9 @@ public function getETags() return preg_split('/\s*,\s*/', $this->headers->get('if_none_match'), null, PREG_SPLIT_NO_EMPTY); } + /** + * @return Boolean + */ public function isNoCache() { return $this->headers->hasCacheControlDirective('no-cache') || 'no-cache' == $this->headers->get('Pragma'); @@ -1268,14 +1315,14 @@ protected function prepareRequestUri() } elseif ($this->server->has('REQUEST_URI')) { $requestUri = $this->server->get('REQUEST_URI'); // HTTP proxy reqs setup request uri with scheme and host [and port] + the url path, only use url path - $schemeAndHttpHost = $this->getScheme().'://'.$this->getHttpHost(); + $schemeAndHttpHost = $this->getSchemeAndHttpHost(); if (strpos($requestUri, $schemeAndHttpHost) === 0) { $requestUri = substr($requestUri, strlen($schemeAndHttpHost)); } } elseif ($this->server->has('ORIG_PATH_INFO')) { // IIS 5.0, PHP as CGI $requestUri = $this->server->get('ORIG_PATH_INFO'); - if ($this->server->get('QUERY_STRING')) { + if ('' != $this->server->get('QUERY_STRING')) { $requestUri .= '?'.$this->server->get('QUERY_STRING'); } } @@ -1408,7 +1455,7 @@ protected function preparePathInfo() /** * Initializes HTTP request formats. */ - static protected function initializeFormats() + protected static function initializeFormats() { static::$formats = array( 'html' => array('text/html', 'application/xhtml+xml'), 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 09c548c0650d93bdf187ac00061b26071b742e96..2982952c028017d3d1419d9a2dd0d9b761495e72 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RequestMatcher.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RequestMatcher.php @@ -31,7 +31,7 @@ class RequestMatcher implements RequestMatcherInterface private $host; /** - * @var string + * @var array */ private $methods; @@ -202,7 +202,16 @@ protected function checkIp6($requestIp, $ip) throw new \RuntimeException('Unable to check Ipv6. Check that PHP was not compiled with option "disable-ipv6".'); } - list($address, $netmask) = explode('/', $ip, 2); + if (false !== strpos($ip, '/')) { + list($address, $netmask) = explode('/', $ip, 2); + + if ($netmask < 1 || $netmask > 128) { + return false; + } + } else { + $address = $ip; + $netmask = 128; + } $bytesAddr = unpack("n*", inet_pton($address)); $bytesTest = unpack("n*", inet_pton($requestIp)); diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RequestMatcherInterface.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RequestMatcherInterface.php index 0ee161c884c8d0ce52afb3d6e033d22c6b97e723..695fd21788d5205be25ac97100fe6d510ba674c4 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RequestMatcherInterface.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RequestMatcherInterface.php @@ -29,5 +29,5 @@ interface RequestMatcherInterface * * @api */ - function matches(Request $request); + public function matches(Request $request); } diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Resources/stubs/SessionHandlerInterface.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Resources/stubs/SessionHandlerInterface.php index 11fcf3bc18efb5dc8ca1ebd9b5f7897ee7f80d4f..1d2106e2a1d711ae0ab7802bbe4101c1d9fd514b 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Resources/stubs/SessionHandlerInterface.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Resources/stubs/SessionHandlerInterface.php @@ -36,7 +36,7 @@ interface SessionHandlerInterface * * @return boolean */ - function open($savePath, $sessionName); + public function open($savePath, $sessionName); /** * Close session. @@ -45,7 +45,7 @@ function open($savePath, $sessionName); * * @return boolean */ - function close(); + public function close(); /** * Read session. @@ -56,7 +56,7 @@ function close(); * * @return string String as stored in persistent storage or empty string in all other cases. */ - function read($sessionId); + public function read($sessionId); /** * Commit session to storage. @@ -68,7 +68,7 @@ function read($sessionId); * * @return boolean */ - function write($sessionId, $data); + public function write($sessionId, $data); /** * Destroys this session. @@ -81,7 +81,7 @@ function write($sessionId, $data); * * @return boolean */ - function destroy($sessionId); + public function destroy($sessionId); /** * Garbage collection for storage. @@ -94,5 +94,5 @@ function destroy($sessionId); * * @return boolean */ - function gc($lifetime); + public function gc($lifetime); } 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 882ac4d36561d7ce41c0b7598c2c3d54ad51a5c5..dbc82d1b61bc0fbebdf4e9411c6ee6856042cda5 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Response.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Response.php @@ -61,7 +61,7 @@ class Response * * @var array */ - static public $statusTexts = array( + public static $statusTexts = array( 100 => 'Continue', 101 => 'Switching Protocols', 102 => 'Processing', // RFC2518 @@ -158,7 +158,7 @@ public function __construct($content = '', $status = 200, $headers = array()) * * @return Response */ - static public function create($content = '', $status = 200, $headers = array()) + public static function create($content = '', $status = 200, $headers = array()) { return new static($content, $status, $headers); } @@ -299,6 +299,18 @@ public function send() if (function_exists('fastcgi_finish_request')) { fastcgi_finish_request(); + } elseif ('cli' !== PHP_SAPI) { + // ob_get_level() never returns 0 on some Windows configurations, so if + // the level is the same two times in a row, the loop should be stopped. + $previous = null; + $obStatus = ob_get_status(1); + while (($level = ob_get_level()) > 0 && $level !== $previous) { + $previous = $level; + if ($obStatus[$level - 1] && isset($obStatus[$level - 1]['del']) && $obStatus[$level - 1]['del']) { + ob_end_flush(); + } + } + flush(); } return $this; @@ -370,7 +382,10 @@ public function getProtocolVersion() * Sets the response status code. * * @param integer $code HTTP status code - * @param string $text HTTP status text + * @param mixed $text HTTP status text + * + * If the status text is null it will be automatically populated for the known + * status codes and left empty otherwise. * * @return Response * @@ -380,12 +395,24 @@ public function getProtocolVersion() */ public function setStatusCode($code, $text = null) { - $this->statusCode = (int) $code; + $this->statusCode = $code = (int) $code; if ($this->isInvalid()) { throw new \InvalidArgumentException(sprintf('The HTTP status code "%s" is not valid.', $code)); } - $this->statusText = false === $text ? '' : (null === $text ? self::$statusTexts[$this->statusCode] : $text); + if (null === $text) { + $this->statusText = isset(self::$statusTexts[$code]) ? self::$statusTexts[$code] : ''; + + return $this; + } + + if (false === $text) { + $this->statusText = ''; + + return $this; + } + + $this->statusText = $text; return $this; } @@ -706,7 +733,7 @@ public function setSharedMaxAge($value) * When the responses TTL is <= 0, the response may not be served from cache without first * revalidating with the origin. * - * @return integer The TTL in seconds + * @return integer|null The TTL in seconds * * @api */ @@ -965,6 +992,10 @@ public function setVary($headers, $replace = true) */ public function isNotModified(Request $request) { + if (!$request->isMethodSafe()) { + return false; + } + $lastModified = $request->headers->get('If-Modified-Since'); $notModified = false; if ($etags = $request->getEtags()) { diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ResponseHeaderBag.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ResponseHeaderBag.php index 11615b96cdef12a3c7cd71ae3e0972a32fbafdda..c27d8116083ab147175433a7c00bae53b036865c 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ResponseHeaderBag.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ResponseHeaderBag.php @@ -231,7 +231,7 @@ public function makeDisposition($disposition, $filename, $filenameFallback = '') throw new \InvalidArgumentException(sprintf('The disposition must be either "%s" or "%s".', self::DISPOSITION_ATTACHMENT, self::DISPOSITION_INLINE)); } - if (!$filenameFallback) { + if ('' == $filenameFallback) { $filenameFallback = $filename; } @@ -246,14 +246,14 @@ public function makeDisposition($disposition, $filename, $filenameFallback = '') } // path separators aren't allowed in either. - if (preg_match('#[/\\\\]#', $filename) || preg_match('#[/\\\\]#', $filenameFallback)) { + if (false !== strpos($filename, '/') || false !== strpos($filename, '\\') || false !== strpos($filenameFallback, '/') || false !== strpos($filenameFallback, '\\')) { throw new \InvalidArgumentException('The filename and the fallback cannot contain the "/" and "\\" characters.'); } - $output = sprintf('%s; filename="%s"', $disposition, str_replace(array('\\', '"'), array('\\\\', '\\"'), $filenameFallback)); + $output = sprintf('%s; filename="%s"', $disposition, str_replace('"', '\\"', $filenameFallback)); - if ($filename != $filenameFallback) { - $output .= sprintf("; filename*=utf-8''%s", str_replace(array("'", '(', ')', '*'), array('%27', '%28', '%29', '%2A'), urlencode($filename))); + if ($filename !== $filenameFallback) { + $output .= sprintf("; filename*=utf-8''%s", rawurlencode($filename)); } return $output; diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBagInterface.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBagInterface.php index ec6d93c0255556e98b0527837ba33bf88a60edfa..5f1f37be25c31410ce47f68fabcd6d208eb34f24 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBagInterface.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBagInterface.php @@ -27,7 +27,7 @@ interface AttributeBagInterface extends SessionBagInterface * * @return Boolean true if the attribute is defined, false otherwise */ - function has($name); + public function has($name); /** * Returns an attribute. @@ -37,7 +37,7 @@ function has($name); * * @return mixed */ - function get($name, $default = null); + public function get($name, $default = null); /** * Sets an attribute. @@ -45,21 +45,21 @@ function get($name, $default = null); * @param string $name * @param mixed $value */ - function set($name, $value); + public function set($name, $value); /** * Returns attributes. * * @return array Attributes */ - function all(); + public function all(); /** * Sets attributes. * * @param array $attributes Attributes */ - function replace(array $attributes); + public function replace(array $attributes); /** * Removes an attribute. @@ -68,5 +68,5 @@ function replace(array $attributes); * * @return mixed The removed value */ - function remove($name); + public function remove($name); } diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Flash/AutoExpireFlashBag.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Flash/AutoExpireFlashBag.php index b47962fc2696a4db5be4167bb16f9a358ee6f050..c6e41de62e287141550a92f8f31e9510b8461095 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Flash/AutoExpireFlashBag.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Flash/AutoExpireFlashBag.php @@ -93,7 +93,7 @@ public function peek($type, array $default = array()) */ public function peekAll() { - return array_key_exists('display', $this->flashes) ? (array)$this->flashes['display'] : array(); + return array_key_exists('display', $this->flashes) ? (array) $this->flashes['display'] : array(); } /** @@ -139,7 +139,7 @@ public function setAll(array $messages) */ public function set($type, $messages) { - $this->flashes['new'][$type] = (array)$messages; + $this->flashes['new'][$type] = (array) $messages; } /** diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Flash/FlashBagInterface.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Flash/FlashBagInterface.php index 2fab8bddb80bef14292235981b65abb2a59e272a..9ae5a3dd63acd3a70e43132f9a001c357792b475 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Flash/FlashBagInterface.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Flash/FlashBagInterface.php @@ -26,7 +26,7 @@ interface FlashBagInterface extends SessionBagInterface * @param string $type * @param string $message */ - function add($type, $message); + public function add($type, $message); /** * Registers a message for a given type. @@ -34,7 +34,7 @@ function add($type, $message); * @param string $type * @param string $message */ - function set($type, $message); + public function set($type, $message); /** * Gets flash message for a given type. @@ -44,14 +44,14 @@ function set($type, $message); * * @return string */ - function peek($type, array $default = array()); + public function peek($type, array $default = array()); /** * Gets all flash messages. * * @return array */ - function peekAll(); + public function peekAll(); /** * Gets and clears flash from the stack. @@ -61,19 +61,19 @@ function peekAll(); * * @return string */ - function get($type, array $default = array()); + public function get($type, array $default = array()); /** * Gets and clears flashes from the stack. * * @return array */ - function all(); + public function all(); /** * Sets all flash messages. */ - function setAll(array $messages); + public function setAll(array $messages); /** * Has flash messages for a given type? @@ -82,12 +82,12 @@ function setAll(array $messages); * * @return boolean */ - function has($type); + public function has($type); /** * Returns a list of all defined types. * * @return array */ - function keys(); + public function keys(); } 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 b70a334f6ae23fc2256e76c9cf63c267571ef18e..ee987c67e583eeb0d12a513fa03491d1ac6ebf6e 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 @@ -130,6 +130,14 @@ public function clear() $this->storage->getBag($this->attributeName)->clear(); } + /** + * {@inheritdoc} + */ + public function isStarted() + { + return $this->storage->isStarted(); + } + /** * Returns an iterator for attributes. * diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/SessionBagInterface.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/SessionBagInterface.php index 50c2d4bd0cb5133ce26fcd70c8e5310b235e5e59..f8d3d32712294e37e4a0caaf9edf060bbbb81b6f 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/SessionBagInterface.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/SessionBagInterface.php @@ -23,26 +23,26 @@ interface SessionBagInterface * * @return string */ - function getName(); + public function getName(); /** * Initializes the Bag * * @param array $array */ - function initialize(array &$array); + public function initialize(array &$array); /** * Gets the storage key for this bag. * * @return string */ - function getStorageKey(); + public function getStorageKey(); /** * Clears out data from bag. * * @return mixed Whatever data was contained. */ - function clear(); + public function clear(); } diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/SessionInterface.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/SessionInterface.php index 833dd9cf84267477d07150f2f03982b0c24eec47..a94fad00d6f0facc1ab260ff830aca7ceb2f94d6 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/SessionInterface.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/SessionInterface.php @@ -11,6 +11,8 @@ namespace Symfony\Component\HttpFoundation\Session; +use Symfony\Component\HttpFoundation\Session\Storage\MetadataBag; + /** * Interface for the session. * @@ -27,7 +29,7 @@ interface SessionInterface * * @api */ - function start(); + public function start(); /** * Returns the session ID. @@ -36,7 +38,7 @@ function start(); * * @api */ - function getId(); + public function getId(); /** * Sets the session ID @@ -45,7 +47,7 @@ function getId(); * * @api */ - function setId($id); + public function setId($id); /** * Returns the session name. @@ -54,7 +56,7 @@ function setId($id); * * @api */ - function getName(); + public function getName(); /** * Sets the session name. @@ -63,7 +65,7 @@ function getName(); * * @api */ - function setName($name); + public function setName($name); /** * Invalidates the current session. @@ -80,7 +82,7 @@ function setName($name); * * @api */ - function invalidate($lifetime = null); + public function invalidate($lifetime = null); /** * Migrates the current session to a new session id while maintaining all @@ -96,7 +98,7 @@ function invalidate($lifetime = null); * * @api */ - function migrate($destroy = false, $lifetime = null); + public function migrate($destroy = false, $lifetime = null); /** * Force the session to be saved and closed. @@ -105,7 +107,7 @@ function migrate($destroy = false, $lifetime = null); * the session will be automatically saved at the end of * code execution. */ - function save(); + public function save(); /** * Checks if an attribute is defined. @@ -116,7 +118,7 @@ function save(); * * @api */ - function has($name); + public function has($name); /** * Returns an attribute. @@ -128,7 +130,7 @@ function has($name); * * @api */ - function get($name, $default = null); + public function get($name, $default = null); /** * Sets an attribute. @@ -138,7 +140,7 @@ function get($name, $default = null); * * @api */ - function set($name, $value); + public function set($name, $value); /** * Returns attributes. @@ -147,14 +149,14 @@ function set($name, $value); * * @api */ - function all(); + public function all(); /** * Sets attributes. * * @param array $attributes Attributes */ - function replace(array $attributes); + public function replace(array $attributes); /** * Removes an attribute. @@ -165,21 +167,28 @@ function replace(array $attributes); * * @api */ - function remove($name); + public function remove($name); /** * Clears all attributes. * * @api */ - function clear(); + public function clear(); + + /** + * Checks if the session was started. + * + * @return Boolean + */ + public function isStarted(); /** * Registers a SessionBagInterface with the session. * * @param SessionBagInterface $bag */ - function registerBag(SessionBagInterface $bag); + public function registerBag(SessionBagInterface $bag); /** * Gets a bag instance by name. @@ -188,12 +197,12 @@ function registerBag(SessionBagInterface $bag); * * @return SessionBagInterface */ - function getBag($name); + public function getBag($name); /** * Gets session meta. * * @return MetadataBag */ - function getMetadataBag(); + public function getMetadataBag(); } diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/FileSessionHandler.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/FileSessionHandler.php deleted file mode 100644 index 1417b5ad8c2c93b7637c7ebcc04b1db5fa043f40..0000000000000000000000000000000000000000 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/FileSessionHandler.php +++ /dev/null @@ -1,115 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; - -/** - * FileSessionHandler. - * - * @author Drak <drak@zikula.org> - */ -class FileSessionHandler implements \SessionHandlerInterface -{ - /** - * @var string - */ - private $savePath; - - /** - * @var string - */ - private $prefix; - - /** - * Constructor. - * - * @param string $savePath Path of directory to save session files. - */ - public function __construct($savePath = null, $prefix = 'sess_') - { - if (null === $savePath) { - $savePath = sys_get_temp_dir(); - } - - $this->savePath = $savePath; - if (false === is_dir($this->savePath)) { - mkdir($this->savePath, 0777, true); - } - - $this->prefix = $prefix; - } - - /** - * {@inheritdoc] - */ - public function open($savePath, $sessionName) - { - return true; - } - - /** - * {@inheritdoc] - */ - public function close() - { - return true; - } - - /** - * {@inheritdoc] - */ - public function read($id) - { - $file = $this->getPath().$id; - - return is_readable($file) ? file_get_contents($file) : ''; - } - - /** - * {@inheritdoc] - */ - public function write($id, $data) - { - return false === file_put_contents($this->getPath().$id, $data) ? false : true; - } - - /** - * {@inheritdoc] - */ - public function destroy($id) - { - $file = $this->getPath().$id; - if (is_file($file)) { - unlink($file); - } - - return true; - } - - /** - * {@inheritdoc] - */ - public function gc($maxlifetime) - { - foreach (glob($this->getPath().'*') as $file) { - if ((filemtime($file) + $maxlifetime) < time()) { - unlink($file); - } - } - - return true; - } - - private function getPath() - { - return $this->savePath.'/'.$this->prefix; - } -} diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php index b666199a453d9cc1013982b60314024c44eddc2f..b3ca0bd3cdcf9e9315c1827c5165f7d308328bc4 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php @@ -33,7 +33,6 @@ class MemcachedSessionHandler implements \SessionHandlerInterface */ private $ttl; - /** * @var string Key prefix for shared environments. */ diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeFileSessionHandler.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeFileSessionHandler.php new file mode 100644 index 0000000000000000000000000000000000000000..f39235cbfb6a5acaaa1cfab37d4a74b3aec01740 --- /dev/null +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeFileSessionHandler.php @@ -0,0 +1,58 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; + +/** + * NativeFileSessionHandler. + * + * Native session handler using PHP's built in file storage. + * + * @author Drak <drak@zikula.org> + */ +class NativeFileSessionHandler extends NativeSessionHandler +{ + /** + * Constructor. + * + * @param string $savePath Path of directory to save session files. + * Default null will leave setting as defined by PHP. + * '/path', 'N;/path', or 'N;octal-mode;/path + * + * @see http://php.net/session.configuration.php#ini.session.save-path for further details. + * + * @throws \InvalidArgumentException On invalid $savePath + */ + public function __construct($savePath = null) + { + if (null === $savePath) { + $savePath = ini_get('session.save_path'); + } + + $baseDir = $savePath; + + if ($count = substr_count($savePath, ';')) { + if ($count > 2) { + throw new \InvalidArgumentException(sprintf('Invalid argument $savePath \'%s\'', $savePath)); + } + + // characters after last ';' are the path + $baseDir = ltrim(strrchr($savePath, ';'), ';'); + } + + if ($baseDir && !is_dir($baseDir)) { + mkdir($baseDir, 0777, true); + } + + ini_set('session.save_path', $savePath); + ini_set('session.save_handler', 'files'); + } +} diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSessionHandler.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSessionHandler.php new file mode 100644 index 0000000000000000000000000000000000000000..1260ad0d295a9f16bc4d201ee0a8bef265770df4 --- /dev/null +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSessionHandler.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\HttpFoundation\Session\Storage\Handler; + +/** + * Adds SessionHandler functionality if available. + * + * @see http://php.net/sessionhandler + */ + +if (version_compare(phpversion(), '5.4.0', '>=')) { + class NativeSessionHandler extends \SessionHandler {} +} else { + class NativeSessionHandler {} +} 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 45725522e826aa2f3e7d937492d6125e25dd6346..b18d071d9540f0245ceaa3a3fd5f28cfbb949429 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 @@ -58,6 +58,11 @@ class MockArraySessionStorage implements SessionStorageInterface */ protected $metadataBag; + /** + * @var array + */ + protected $bags; + /** * Constructor. * @@ -199,6 +204,14 @@ public function getBag($name) return $this->bags[$name]; } + /** + * {@inheritdoc} + */ + public function isStarted() + { + return $this->started; + } + /** * Sets the MetadataBag. * 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 23b86b3b7f99cb530d93739945bf9476d32b6661..80aa44b06bc4ec572abcb0c8b997d470d170aafd 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 @@ -11,9 +11,6 @@ namespace Symfony\Component\HttpFoundation\Session\Storage; -use Symfony\Component\HttpFoundation\Session\Storage\Handler\FileSessionHandler; -use Symfony\Component\HttpFoundation\Session\Storage\MetadataBag; - /** * MockFileSessionStorage is used to mock sessions for * functional testing when done in a single PHP process. @@ -28,27 +25,35 @@ class MockFileSessionStorage extends MockArraySessionStorage { /** - * @var FileSessionHandler + * @var string + */ + private $savePath; + + /** + * @var array */ - private $handler; + private $sessionData; /** * Constructor. * - * @param string $savePath Path of directory to save session files. - * @param string $name Session name. - * @param FileSessionHandler $handler Save handler - * @param MetadataBag $metaData Metadatabag + * @param string $savePath Path of directory to save session files. + * @param string $name Session name. + * @param MetadataBag $metaBag MetadataBag instance. */ - public function __construct($savePath = null, $name = 'MOCKSESSID', FileSessionHandler $handler = null, MetadataBag $metaData = null) + public function __construct($savePath = null, $name = 'MOCKSESSID', MetadataBag $metaBag = null) { - if (null == $handler) { - $handler = new FileSessionHandler($savePath, 'mocksess_'); + if (null === $savePath) { + $savePath = sys_get_temp_dir(); } - $this->handler = $handler; + if (!is_dir($savePath)) { + mkdir($savePath, 0777, true); + } + + $this->savePath = $savePath; - parent::__construct($name, $metaData); + parent::__construct($name, $metaBag); } /** @@ -92,7 +97,7 @@ public function regenerate($destroy = false, $lifetime = null) */ public function save() { - $this->handler->write($this->id, serialize($this->data)); + file_put_contents($this->getFilePath(), serialize($this->data)); // this is needed for Silex, where the session object is re-used across requests // in functional tests. In Symfony, the container is rebooted, so we don't have @@ -106,7 +111,19 @@ public function save() */ private function destroy() { - $this->handler->destroy($this->id); + if (is_file($this->getFilePath())) { + unlink($this->getFilePath()); + } + } + + /** + * Calculate path to file. + * + * @return string File path + */ + private function getFilePath() + { + return $this->savePath.'/'.$this->id.'.mocksess'; } /** @@ -114,8 +131,8 @@ private function destroy() */ private function read() { - $data = $this->handler->read($this->id); - $this->data = $data ? unserialize($data) : array(); + $filePath = $this->getFilePath(); + $this->data = is_readable($filePath) && is_file($filePath) ? unserialize(file_get_contents($filePath)) : array(); $this->loadSession(); } diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php index 7a9d77531e7d37ae8a019a17c6c83b2d42da8224..ecc68adfdebaf6b6ed4d690a4e98a6c784da6a6d 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php @@ -61,7 +61,9 @@ class NativeSessionStorage implements SessionStorageInterface * @see http://php.net/session.configuration for options * but we omit 'session.' from the beginning of the keys for convenience. * - * auto_start, "0" + * ("auto_start", is not supported as it tells PHP to start a session before + * PHP starts to execute user-land code. Setting during runtime has no effect). + * * cache_limiter, "nocache" (use "0" to prevent headers from being sent entirely). * cookie_domain, "" * cookie_httponly, "" @@ -91,12 +93,10 @@ class NativeSessionStorage implements SessionStorageInterface * * @param array $options Session configuration options. * @param object $handler SessionHandlerInterface. - * @param MetadataBag $handler MetadataBag. + * @param MetadataBag $metaBag MetadataBag. */ public function __construct(array $options = array(), $handler = null, MetadataBag $metaBag = null) { - // sensible defaults - ini_set('session.auto_start', 0); // by default we prefer to explicitly start the session using the class. ini_set('session.cache_limiter', ''); // disable by default because it's managed by HeaderBag (if used) ini_set('session.use_cookies', 1); @@ -173,7 +173,7 @@ public function getId() */ public function setId($id) { - return $this->saveHandler->setId($id); + $this->saveHandler->setId($id); } /** @@ -256,10 +256,10 @@ public function getBag($name) throw new \InvalidArgumentException(sprintf('The SessionBagInterface %s is not registered.', $name)); } - if (ini_get('session.auto_start') && !$this->started) { - $this->start(); - } elseif ($this->saveHandler->isActive() && !$this->started) { + if ($this->saveHandler->isActive() && !$this->started) { $this->loadSession(); + } elseif (!$this->started) { + $this->start(); } return $this->bags[$name]; @@ -289,6 +289,14 @@ public function getMetadataBag() return $this->metadataBag; } + /** + * {@inheritdoc} + */ + public function isStarted() + { + return $this->started; + } + /** * Sets session.* ini variables. * @@ -302,7 +310,7 @@ public function getMetadataBag() public function setOptions(array $options) { $validOptions = array_flip(array( - 'auto_start', 'cache_limiter', 'cookie_domain', 'cookie_httponly', + 'cache_limiter', 'cookie_domain', 'cookie_httponly', 'cookie_lifetime', 'cookie_path', 'cookie_secure', 'entropy_file', 'entropy_length', 'gc_divisor', 'gc_maxlifetime', 'gc_probability', 'hash_bits_per_character', 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 09f9efa091dc74f9a2a64a8a03be45a012523b43..0d4cb8b6a999bd1a4251753330469f697f064a75 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 @@ -58,7 +58,7 @@ public function isSessionHandlerInterface() /** * Returns true if this handler wraps an internal PHP session save handler using \SessionHandler. * - * @return bool + * @return Boolean */ public function isWrapper() { @@ -68,7 +68,7 @@ public function isWrapper() /** * Has a session started? * - * @return bool + * @return Boolean */ public function isActive() { @@ -78,7 +78,7 @@ public function isActive() /** * Sets the active flag. * - * @param bool $flag + * @param Boolean $flag */ public function setActive($flag) { diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Proxy/NativeProxy.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Proxy/NativeProxy.php index 5bb2c712e32ae9444fa4e3ae5f7e8e6c174aeccf..23eebb3281ae85955a72141e875fcf14f795d929 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Proxy/NativeProxy.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Proxy/NativeProxy.php @@ -32,7 +32,7 @@ public function __construct() /** * Returns true if this handler wraps an internal PHP session save handler using \SessionHandler. * - * @return bool False. + * @return Boolean False. */ public function isWrapper() { diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php index e925d628df4a7d8acc74b86fc3a4e91cfe269eac..e1f4fff1fa2aeb1f361afae57c7a274c17cbbe8c 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php @@ -42,7 +42,7 @@ public function __construct(\SessionHandlerInterface $handler) */ public function open($savePath, $sessionName) { - $return = (bool)$this->handler->open($savePath, $sessionName); + $return = (bool) $this->handler->open($savePath, $sessionName); if (true === $return) { $this->active = true; 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 c07ed7fb6f786dec93920fd34792ff5457d6e892..26a741829b3b890b7693816fd254b72e49f9753a 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 @@ -33,7 +33,14 @@ interface SessionStorageInterface * * @api */ - function start(); + public function start(); + + /** + * Checks if the session is started. + * + * @return boolean True if started, false otherwise. + */ + public function isStarted(); /** * Returns the session ID @@ -42,7 +49,7 @@ function start(); * * @api */ - function getId(); + public function getId(); /** * Sets the session ID @@ -51,7 +58,7 @@ function getId(); * * @api */ - function setId($id); + public function setId($id); /** * Returns the session name @@ -60,7 +67,7 @@ function setId($id); * * @api */ - function getName(); + public function getName(); /** * Sets the session name @@ -69,7 +76,7 @@ function getName(); * * @api */ - function setName($name); + public function setName($name); /** * Regenerates id that represents this storage. @@ -94,7 +101,7 @@ function setName($name); * * @api */ - function regenerate($destroy = false, $lifetime = null); + public function regenerate($destroy = false, $lifetime = null); /** * Force the session to be saved and closed. @@ -104,12 +111,12 @@ function regenerate($destroy = false, $lifetime = null); * a real PHP session would interfere with testing, in which case it * it should actually persist the session data if required. */ - function save(); + public function save(); /** * Clear all session data in memory. */ - function clear(); + public function clear(); /** * Gets a SessionBagInterface by name. @@ -120,17 +127,17 @@ function clear(); * * @throws \InvalidArgumentException If the bag does not exist */ - function getBag($name); + public function getBag($name); /** * Registers a SessionBagInterface for use. * * @param SessionBagInterface $bag */ - function registerBag(SessionBagInterface $bag); + public function registerBag(SessionBagInterface $bag); /** * @return MetadataBag */ - function getMetadataBag(); + public function getMetadataBag(); } 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 599170fae8f61e6a808c0081d07928107ac66713..5dcb1c315a9b08ef42dea46cba1f46314d4ee7ca 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/StreamedResponse.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/StreamedResponse.php @@ -72,11 +72,11 @@ public function setCallback($callback) } /** - * @{inheritdoc} + * {@inheritdoc} */ public function prepare(Request $request) { - if ('1.0' != $request->server->get('SERVER_PROTOCOL')) { + if ('HTTP/1.0' != $request->server->get('SERVER_PROTOCOL')) { $this->setProtocolVersion('1.1'); } @@ -86,7 +86,7 @@ public function prepare(Request $request) } /** - * @{inheritdoc} + * {@inheritdoc} * * This method only sends the content once. */ @@ -106,7 +106,7 @@ public function sendContent() } /** - * @{inheritdoc} + * {@inheritdoc} * * @throws \LogicException when the content is not null */ @@ -118,7 +118,7 @@ public function setContent($content) } /** - * @{inheritdoc} + * {@inheritdoc} * * @return false */ 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 f79096f53a40843db6ae77d4df76a368e29a15f7..b42a3fc89cb46a7e5b54c6da2c9046bb207f4709 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 @@ -132,7 +132,6 @@ public function testMoveLocalFileIsAllowedInTestMode() @unlink($targetPath); } - public function testGetClientOriginalNameSanitizeFilename() { $file = new UploadedFile( @@ -207,7 +206,6 @@ public function testIsInvalidOnUploadError($error) $this->assertFalse($file->isValid()); } - public function uploadedFileErrorProvider() { return array( diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php index d96e00bef1ea2624c644b4e87b0bcb0fabc6d26c..c3c0b16bfd5a651de482a9ecf676783f26d3b806 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php @@ -200,7 +200,6 @@ public function testFilter() $this->assertEquals(array('bang'), $bag->filter('array', '', false), '->filter() gets a value of parameter as an array'); - } /** diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/RedirectResponseTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/RedirectResponseTest.php index 179ee5a3e258dba098ad468b21b1a15838fb0c2d..b55c3b63d72cf92804dba4edccf9f1bfdc5a32f8 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/RedirectResponseTest.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/RedirectResponseTest.php @@ -40,6 +40,14 @@ public function testGetTargetUrl() $this->assertEquals('foo.bar', $response->getTargetUrl()); } + public function testSetTargetUrl() + { + $response = new RedirectResponse('foo.bar'); + $response->setTargetUrl('baz.beep'); + + $this->assertEquals('baz.beep', $response->getTargetUrl()); + } + public function testCreate() { $response = RedirectResponse::create('foo', 301); diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/RequestMatcherTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/RequestMatcherTest.php index 069d8b4af235e3e3c84bf964d1087b2166fd6375..32ca1e5246f4df8374a41843e97d1b3bdea1f292 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/RequestMatcherTest.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/RequestMatcherTest.php @@ -11,8 +11,6 @@ namespace Symfony\Component\HttpFoundation\Tests; - - use Symfony\Component\HttpFoundation\RequestMatcher; use Symfony\Component\HttpFoundation\Request; @@ -64,6 +62,9 @@ public function testIpv6Provider() return array( array(true, '2a01:198:603:0:396e:4789:8e99:890f', '2a01:198:603:0::/65'), array(false, '2a00:198:603:0:396e:4789:8e99:890f', '2a01:198:603:0::/65'), + array(false, '2a01:198:603:0:396e:4789:8e99:890f', '::1'), + array(true, '0:0:0:0:0:0:0:1', '::1'), + array(false, '0:0:603:0:396e:4789:8e99:0001', '::1'), ); } 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 9d943ef0d48f2df5c9ba29085c19b722396604ab..1e447c52f02b160ea2bd64cc2f288ab139b73099 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 @@ -11,7 +11,6 @@ namespace Symfony\Component\HttpFoundation\Tests; - use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Component\HttpFoundation\Request; @@ -336,7 +335,17 @@ public function testGetUri() 'http://hostname:8080/ba%20se/index_dev.php/foo%20bar/in+fo?query=string', $request->getUri() ); - } + + // with user info + + $server['PHP_AUTH_USER'] = 'fabien'; + $request->initialize(array(), array(), array(), array(), array(), $server); + $this->assertEquals('http://fabien@hostname:8080/ba%20se/index_dev.php/foo%20bar/in+fo?query=string', $request->getUri()); + + $server['PHP_AUTH_PW'] = 'symfony'; + $request->initialize(array(), array(), array(), array(), array(), $server); + $this->assertEquals('http://fabien:symfony@hostname:8080/ba%20se/index_dev.php/foo%20bar/in+fo?query=string', $request->getUri()); + } /** * @covers Symfony\Component\HttpFoundation\Request::getUriForPath @@ -436,35 +445,111 @@ public function testGetUriForPath() $this->assertEquals('http://servername/some/path', $request->getUriForPath('/some/path'), '->getUriForPath() with rewrite, default port without HOST_HEADER'); $this->assertEquals('servername', $request->getHttpHost()); + + // with user info + + $server['PHP_AUTH_USER'] = 'fabien'; + $request->initialize(array(), array(), array(), array(), array(), $server); + $this->assertEquals('http://fabien@servername/some/path', $request->getUriForPath('/some/path')); + + $server['PHP_AUTH_PW'] = 'symfony'; + $request->initialize(array(), array(), array(), array(), array(), $server); + $this->assertEquals('http://fabien:symfony@servername/some/path', $request->getUriForPath('/some/path')); } /** - * @covers Symfony\Component\HttpFoundation\Request::getQueryString + * @covers Symfony\Component\HttpFoundation\Request::getUserInfo */ - public function testGetQueryString() + public function testGetUserInfo() { $request = new Request(); - $request->server->set('QUERY_STRING', 'foo'); - $this->assertEquals('foo', $request->getQueryString(), '->getQueryString() works with valueless parameters'); + $server['PHP_AUTH_USER'] = 'fabien'; + $request->initialize(array(), array(), array(), array(), array(), $server); + $this->assertEquals('fabien', $request->getUserInfo()); - $request->server->set('QUERY_STRING', 'foo='); - $this->assertEquals('foo=', $request->getQueryString(), '->getQueryString() includes a dangling equal sign'); + $server['PHP_AUTH_USER'] = '0'; + $request->initialize(array(), array(), array(), array(), array(), $server); + $this->assertEquals('0', $request->getUserInfo()); - $request->server->set('QUERY_STRING', 'bar=&foo=bar'); - $this->assertEquals('bar=&foo=bar', $request->getQueryString(), '->getQueryString() works when empty parameters'); + $server['PHP_AUTH_PW'] = '0'; + $request->initialize(array(), array(), array(), array(), array(), $server); + $this->assertEquals('0:0', $request->getUserInfo()); + } - $request->server->set('QUERY_STRING', 'foo=bar&bar='); - $this->assertEquals('bar=&foo=bar', $request->getQueryString(), '->getQueryString() sorts keys alphabetically'); + /** + * @covers Symfony\Component\HttpFoundation\Request::getSchemeAndHttpHost + */ + public function testGetSchemeAndHttpHost() + { + $request = new Request(); - $request->server->set('QUERY_STRING', 'him=John%20Doe&her=Jane+Doe'); - $this->assertEquals('her=Jane%2BDoe&him=John%20Doe', $request->getQueryString(), '->getQueryString() normalizes encoding'); + $server['SERVER_NAME'] = 'servername'; + $server['SERVER_PORT'] = '90'; + $request->initialize(array(), array(), array(), array(), array(), $server); + $this->assertEquals('http://servername:90', $request->getSchemeAndHttpHost()); - $request->server->set('QUERY_STRING', 'foo[]=1&foo[]=2'); - $this->assertEquals('foo%5B%5D=1&foo%5B%5D=2', $request->getQueryString(), '->getQueryString() allows array notation'); + $server['PHP_AUTH_USER'] = 'fabien'; + $request->initialize(array(), array(), array(), array(), array(), $server); + $this->assertEquals('http://fabien@servername:90', $request->getSchemeAndHttpHost()); - $request->server->set('QUERY_STRING', 'foo=1&foo=2'); - $this->assertEquals('foo=1&foo=2', $request->getQueryString(), '->getQueryString() allows repeated parameters'); + $server['PHP_AUTH_USER'] = '0'; + $request->initialize(array(), array(), array(), array(), array(), $server); + $this->assertEquals('http://0@servername:90', $request->getSchemeAndHttpHost()); + + $server['PHP_AUTH_PW'] = '0'; + $request->initialize(array(), array(), array(), array(), array(), $server); + $this->assertEquals('http://0:0@servername:90', $request->getSchemeAndHttpHost()); + } + + /** + * @covers Symfony\Component\HttpFoundation\Request::getQueryString + * @covers Symfony\Component\HttpFoundation\Request::normalizeQueryString + * @dataProvider getQueryStringNormalizationData + */ + public function testGetQueryString($query, $expectedQuery, $msg) + { + $request = new Request(); + + $request->server->set('QUERY_STRING', $query); + $this->assertSame($expectedQuery, $request->getQueryString(), $msg); + } + + public function getQueryStringNormalizationData() + { + return array( + array('foo', 'foo', 'works with valueless parameters'), + array('foo=', 'foo=', 'includes a dangling equal sign'), + array('bar=&foo=bar', 'bar=&foo=bar', '->works with empty parameters'), + array('foo=bar&bar=', 'bar=&foo=bar', 'sorts keys alphabetically'), + + // GET parameters, that are submitted from a HTML form, encode spaces as "+" by default (as defined in enctype application/x-www-form-urlencoded). + // PHP also converts "+" to spaces when filling the global _GET or when using the function parse_str. + array('him=John%20Doe&her=Jane+Doe', 'her=Jane%20Doe&him=John%20Doe', 'normalizes spaces in both encodings "%20" and "+"'), + + array('foo[]=1&foo[]=2', 'foo%5B%5D=1&foo%5B%5D=2', 'allows array notation'), + array('foo=1&foo=2', 'foo=1&foo=2', 'allows repeated parameters'), + array('pa%3Dram=foo%26bar%3Dbaz&test=test', 'pa%3Dram=foo%26bar%3Dbaz&test=test', 'works with encoded delimiters'), + array('0', '0', 'allows "0"'), + array('Jane Doe&John%20Doe', 'Jane%20Doe&John%20Doe', 'normalizes encoding in keys'), + array('her=Jane Doe&him=John%20Doe', 'her=Jane%20Doe&him=John%20Doe', 'normalizes encoding in values'), + array('foo=bar&&&test&&', 'foo=bar&test', 'removes unneeded delimiters'), + array('formula=e=m*c^2', 'formula=e%3Dm%2Ac%5E2', 'correctly treats only the first "=" as delimiter and the next as value'), + + // Ignore pairs with empty key, even if there was a value, e.g. "=value", as such nameless values cannot be retrieved anyway. + // PHP also does not include them when building _GET. + array('foo=bar&=a=b&=x=y', 'foo=bar', 'removes params with empty key'), + ); + } + + public function testGetQueryStringReturnsNull() + { + $request = new Request(); + + $this->assertNull($request->getQueryString(), '->getQueryString() returns null for non-existent query string'); + + $request->server->set('QUERY_STRING', ''); + $this->assertNull($request->getQueryString(), '->getQueryString() returns null for empty query string'); } /** @@ -535,6 +620,11 @@ public function testGetSetMethod() $request->request->set('_method', 'purge'); $this->assertEquals('PURGE', $request->getMethod(), '->getMethod() returns the method from _method if defined and POST'); + $request->setMethod('POST'); + $request->request->remove('_method'); + $request->query->set('_method', 'purge'); + $this->assertEquals('PURGE', $request->getMethod(), '->getMethod() returns the method from _method if defined and POST'); + $request->setMethod('POST'); $request->headers->set('X-HTTP-METHOD-OVERRIDE', 'delete'); $this->assertEquals('DELETE', $request->getMethod(), '->getMethod() returns the method from X-HTTP-Method-Override even though _method is set if defined and POST'); 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 4edcd6dd1d9cda50ccf3f0e1c510e2d59bb5134e..cbbdd29aa093a9a249f2d000465c4c94bae6d599 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 @@ -367,6 +367,33 @@ public function testIsInvalid() $this->assertFalse($response->isInvalid()); } + /** + * @dataProvider getStatusCodeFixtures + */ + public function testSetStatusCode($code, $text, $expectedText) + { + $response = new Response(); + + $response->setStatusCode($code, $text); + + $statusText = new \ReflectionProperty($response, 'statusText'); + $statusText->setAccessible(true); + + $this->assertEquals($expectedText, $statusText->getValue($response)); + } + + public function getStatusCodeFixtures() + { + return array( + array('200', null, 'OK'), + array('200', false, ''), + array('200', 'foo', 'foo'), + array('199', null, ''), + array('199', false, ''), + array('199', 'foo', 'foo') + ); + } + public function testIsInformational() { $response = new Response('', 100); 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 2f2b26fb3ea2e8af4e261684c60462a9933b3a39..7bdc127fdb8de3f304be8f766c01d81376b52a44 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 @@ -12,7 +12,6 @@ namespace Symfony\Component\HttpFoundation\Tests\Session; use Symfony\Component\HttpFoundation\Session\Session; -use Symfony\Component\HttpFoundation\Session\MetadataBag; use Symfony\Component\HttpFoundation\Session\Flash\FlashBag; use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag; use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; @@ -260,7 +259,7 @@ public function testGetIterator() } /** - * @covers Symfony\Component\HttpFoundation\Session\Session::count + * @covers \Symfony\Component\HttpFoundation\Session\Session::count */ public function testGetCount() { diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/FileSessionHandlerTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/FileSessionHandlerTest.php deleted file mode 100644 index d935b34bd278c29805b3629e6270798dfeea2ae2..0000000000000000000000000000000000000000 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/FileSessionHandlerTest.php +++ /dev/null @@ -1,106 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler; - -use Symfony\Component\HttpFoundation\Session\Storage\Handler\FileSessionHandler; - -/** - * Test class for FileSessionHandler. - * - * @author Drak <drak@zikula.org> - */ -class FileSessionStorageTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var FileSessionHandler - */ - private $handler; - - /** - * @var string - */ - private $path; - - public function setUp() - { - $this->path = sys_get_temp_dir().'/filesessionhandler'; - $this->handler = new FileSessionHandler($this->path, 'mocksess_'); - - parent::setUp(); - } - - public function tearDown() - { - foreach (glob($this->path.'/*') as $file) { - unlink($file); - } - - rmdir($this->path); - - $this->handler = null; - } - - public function test__construct() - { - $this->assertTrue(is_dir($this->path)); - } - - public function testOpen() - { - $this->assertTrue($this->handler->open('a', 'b')); - } - - public function testClose() - { - $this->assertTrue($this->handler->close()); - } - - public function testReadWrite() - { - $this->assertEmpty($this->handler->read('123')); - $this->assertTrue($this->handler->write('123', 'data')); - $this->assertEquals('data', $this->handler->read('123')); - } - - public function testDestroy() - { - $this->handler->write('456', 'data'); - $this->handler->destroy('123'); - $this->assertEquals('data', $this->handler->read('456')); - $this->handler->destroy('456'); - $this->assertEmpty($this->handler->read('456')); - } - - public function testGc() - { - $prefix = $this->path.'/mocksess_'; - $this->handler->write('1', 'data'); - touch($prefix.'1', time()-86400); - - $this->handler->write('2', 'data'); - touch($prefix.'2', time()-3600); - - $this->handler->write('3', 'data'); - touch($prefix.'3', time()-300); - - $this->handler->write('4', 'data'); - - $this->handler->gc(90000); - $this->assertEquals(4, count(glob($this->path.'/*'))); - - $this->handler->gc(4000); - $this->assertEquals(3, count(glob($this->path.'/*'))); - - $this->handler->gc(200); - $this->assertEquals(1, count(glob($this->path.'/*'))); - } -} 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 new file mode 100644 index 0000000000000000000000000000000000000000..fdb0b99bcd83033ec0bfc36b9a8c5e966e3b0232 --- /dev/null +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php @@ -0,0 +1,80 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler; + +use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler; +use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage; + +/** + * Test class for NativeFileSessionHandler. + * + * @author Drak <drak@zikula.org> + * + * @runTestsInSeparateProcesses + */ +class NativeFileSessionHandlerTest extends \PHPUnit_Framework_TestCase +{ + public function test__Construct() + { + $storage = new NativeSessionStorage(array('name' => 'TESTING'), new NativeFileSessionHandler(sys_get_temp_dir())); + + if (version_compare(phpversion(), '5.4.0', '<')) { + $this->assertEquals('files', $storage->getSaveHandler()->getSaveHandlerName()); + $this->assertEquals('files', ini_get('session.save_handler')); + } else { + $this->assertEquals('files', $storage->getSaveHandler()->getSaveHandlerName()); + $this->assertEquals('user', ini_get('session.save_handler')); + } + + $this->assertEquals(sys_get_temp_dir(), ini_get('session.save_path')); + $this->assertEquals('TESTING', ini_get('session.name')); + } + + /** + * @dataProvider savePathDataProvider + */ + public function test__ConstructSavePath($savePath, $expectedSavePath, $path) + { + $handler = new NativeFileSessionHandler($savePath); + $this->assertEquals($expectedSavePath, ini_get('session.save_path')); + $dir = realpath('/'.$path); + $this->assertTrue(is_dir(realpath($dir))); + + rmdir($dir); + } + + 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"), + array("5;0600;$base/foo", "5;0600;$base/foo", "$base/foo"), + ); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function test__ConstructException() + { + $handler = new NativeFileSessionHandler('something;invalid;with;too-many-args'); + } + + public function testConstructDefault() + { + $path = ini_get('session.save_path'); + $storage = new NativeSessionStorage(array('name' => 'TESTING'), new NativeFileSessionHandler()); + + $this->assertEquals($path, ini_get('session.save_path')); + } +} diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeSessionHandlerTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeSessionHandlerTest.php new file mode 100644 index 0000000000000000000000000000000000000000..7880615db0be525af45c6ee7807d40ef8d7fc5e3 --- /dev/null +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeSessionHandlerTest.php @@ -0,0 +1,39 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler; + +use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler; + +/** + * Test class for NativeSessionHandler. + * + * @author Drak <drak@zikula.org> + * + * @runTestsInSeparateProcesses + */ +class NativeSessionHandlerTest extends \PHPUnit_Framework_TestCase +{ + public function testConstruct() + { + $handler = new NativeSessionHandler(); + + // note for PHPUnit optimisers - the use of assertTrue/False + // here is deliberate since the tests do not require the classes to exist - drak + if (version_compare(phpversion(), '5.4.0', '<')) { + $this->assertFalse($handler instanceof \SessionHandler); + $this->assertTrue($handler instanceof NativeSessionHandler); + } else { + $this->assertTrue($handler instanceof \SessionHandler); + $this->assertTrue($handler instanceof NativeSessionHandler); + } + } +} diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php index 3bd702e05c68a17d8afaffd7fbdd45344b521f32..45a47ce8fa563738e2ae669a1c32c4332ca9dd3b 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php @@ -55,4 +55,3 @@ public function getStorage() return new NativeSessionStorage(array(), new NullSessionHandler()); } } - diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php index d0938e0d3755f7dd921fc82c23028d706c5d3c8a..ff1565a183a942276aadc6777a4f2b13c6b4d3d1 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php @@ -61,4 +61,3 @@ public function testSessionGC() $this->assertEquals(0, count($this->pdo->query('SELECT * FROM sessions')->fetchAll())); } } - 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 0da4805ff37e31c41b1388013bc3c3d6c2fe432f..c9b2a7480c6752ac561f9ce006d8e2a91535d3f9 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 @@ -28,12 +28,12 @@ class MockArraySessionStorageTest extends \PHPUnit_Framework_TestCase private $storage; /** - * @var array + * @var AttributeBag */ private $attributes; /** - * @var array + * @var FlashBag */ private $flashes; 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 7bfe6a779df5acc7f72220bc248a24af06dc9d0b..f18089d92a822b9721c2ad1f54fd11f2a6c125d4 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 @@ -28,7 +28,7 @@ class MockFileSessionStorageTest extends \PHPUnit_Framework_TestCase private $sessionDir; /** - * @var MockFileSessionStorage + * @var FileMockSessionStorage */ protected $storage; @@ -40,14 +40,12 @@ protected function setUp() protected function tearDown() { - foreach (glob($this->sessionDir.'/mocksess_*') as $file) { - unlink($file); - } - - rmdir($this->sessionDir); - $this->sessionDir = null; $this->storage = null; + array_map('unlink', glob($this->sessionDir.'/*.session')); + if (is_dir($this->sessionDir)) { + rmdir($this->sessionDir); + } } public function testStart() diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php index 528a1d7b02a2479851388c094bccd085c47c0467..4b88a237a007ed9acb925f425f7d1473a5a4e2e8 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\HttpFoundation\Tests\Session\Storage; use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage; +use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler; use Symfony\Component\HttpFoundation\Session\Storage\Handler\NullSessionHandler; use Symfony\Component\HttpFoundation\Session\Flash\FlashBag; use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag; @@ -136,8 +137,8 @@ public function testSetSaveHandlerPHP53() $this->markTestSkipped('Test skipped, for PHP 5.3 only.'); } - ini_set('session.save_handler', 'files'); $storage = $this->getStorage(); + $storage->setSaveHandler(new NativeFileSessionHandler()); $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\NativeProxy', $storage->getSaveHandler()); } diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/StreamedResponseTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/StreamedResponseTest.php index 2d8654ef6868d321a6bd4bfbe03e3f593c141432..f52badf6a4f2267704accc900ab5d5ccb83cff19 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/StreamedResponseTest.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/StreamedResponseTest.php @@ -28,7 +28,7 @@ public function testPrepareWith11Protocol() { $response = new StreamedResponse(function () { echo 'foo'; }); $request = Request::create('/'); - $request->server->set('SERVER_PROTOCOL', '1.1'); + $request->server->set('SERVER_PROTOCOL', 'HTTP/1.1'); $response->prepare($request); @@ -41,7 +41,7 @@ public function testPrepareWith10Protocol() { $response = new StreamedResponse(function () { echo 'foo'; }); $request = Request::create('/'); - $request->server->set('SERVER_PROTOCOL', '1.0'); + $request->server->set('SERVER_PROTOCOL', 'HTTP/1.0'); $response->prepare($request); diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Bundle/BundleInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Bundle/BundleInterface.php index 980b8907c5868c2ffdd3288f65957e5f61066330..3203d84a2db11881d1eb42391cab8426326eadd1 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Bundle/BundleInterface.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Bundle/BundleInterface.php @@ -29,14 +29,14 @@ interface BundleInterface extends ContainerAwareInterface * * @api */ - function boot(); + public function boot(); /** * Shutdowns the Bundle. * * @api */ - function shutdown(); + public function shutdown(); /** * Builds the bundle. @@ -47,7 +47,7 @@ function shutdown(); * * @api */ - function build(ContainerBuilder $container); + public function build(ContainerBuilder $container); /** * Returns the container extension that should be implicitly loaded. @@ -56,16 +56,20 @@ function build(ContainerBuilder $container); * * @api */ - function getContainerExtension(); + public function getContainerExtension(); /** - * Returns the bundle parent name. + * Returns the bundle name that this bundle overrides. * - * @return string The Bundle parent name it overrides or null if no parent + * Despite its name, this method does not imply any parent/child relationship + * between the bundles, just a way to extend and override an existing + * bundle. + * + * @return string The Bundle name it overrides or null if no parent * * @api */ - function getParent(); + public function getParent(); /** * Returns the bundle name (the class short name). @@ -74,7 +78,7 @@ function getParent(); * * @api */ - function getName(); + public function getName(); /** * Gets the Bundle namespace. @@ -83,7 +87,7 @@ function getName(); * * @api */ - function getNamespace(); + public function getNamespace(); /** * Gets the Bundle directory path. @@ -94,5 +98,5 @@ function getNamespace(); * * @api */ - function getPath(); + public function getPath(); } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CHANGELOG.md b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CHANGELOG.md index d061c7decbc60062eabd1ee03e276df23a0d3d13..c27de87eca5d9404a123936db7f0ac6d8266699d 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CHANGELOG.md +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CHANGELOG.md @@ -4,6 +4,8 @@ CHANGELOG 2.1.0 ----- + * [BC BREAK] the charset is now configured via the Kernel::getCharset() method + * [BC BREAK] the current locale for the user is not stored anymore in the session * added the HTTP method to the profiler storage * updated all listeners to implement EventSubscriberInterface * added TimeDataCollector diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CacheClearer/CacheClearerInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CacheClearer/CacheClearerInterface.php index 1588b67607cab1698ebdf8a083d969722aee1ac1..d4a2db37644cacaa0f1dbc87b39efe87268c7750 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CacheClearer/CacheClearerInterface.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CacheClearer/CacheClearerInterface.php @@ -23,5 +23,5 @@ interface CacheClearerInterface * * @param string $cacheDir The cache directory. */ - function clear($cacheDir); + public function clear($cacheDir); } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerInterface.php index 478cdc99432ea4e0a40c67766fc9686988797a50..ed76ce35863b86ad4b47709647622b2c0f54a737 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerInterface.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerInterface.php @@ -28,5 +28,5 @@ interface CacheWarmerInterface extends WarmableInterface * * @return Boolean true if the warmer is optional, false otherwise */ - function isOptional(); + public function isOptional(); } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CacheWarmer/WarmableInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CacheWarmer/WarmableInterface.php index 0476161621c536c5d161b3f2571248d7d5c226c8..25d8ee8f61a8c81a415784c818374216931ac94d 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CacheWarmer/WarmableInterface.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CacheWarmer/WarmableInterface.php @@ -23,5 +23,5 @@ interface WarmableInterface * * @param string $cacheDir The cache directory */ - function warmUp($cacheDir); + public function warmUp($cacheDir); } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Controller/ControllerResolverInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Controller/ControllerResolverInterface.php index 986a13dca4d3e529aa1a27fc831b8d70520fd22e..f58f50db53292d2c777c9a221a277768014c12e6 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Controller/ControllerResolverInterface.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Controller/ControllerResolverInterface.php @@ -45,7 +45,7 @@ interface ControllerResolverInterface * * @api */ - function getController(Request $request); + public function getController(Request $request); /** * Returns the arguments to pass to the controller. @@ -59,5 +59,5 @@ function getController(Request $request); * * @api */ - function getArguments(Request $request, $controller); + public function getArguments(Request $request, $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 37e93b05288a452a95896a640edba2e752641355..81ede39ced0eadf0aae3b195f89db0eeabd53cc4 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 __construct(KernelInterface $kernel) + public function setKernel(KernelInterface $kernel) { $this->kernel = $kernel; } @@ -44,9 +44,9 @@ public function collect(Request $request, Response $response, \Exception $except $this->data = array( 'token' => $response->headers->get('X-Debug-Token'), 'symfony_version' => Kernel::VERSION, - 'name' => $this->kernel->getName(), - 'env' => $this->kernel->getEnvironment(), - 'debug' => $this->kernel->isDebug(), + 'name' => isset($this->kernel) ? $this->kernel->getName() : 'n/a', + 'env' => isset($this->kernel) ? $this->kernel->getEnvironment() : 'n/a', + 'debug' => isset($this->kernel) ? $this->kernel->isDebug() : 'n/a', 'php_version' => PHP_VERSION, 'xdebug_enabled' => extension_loaded('xdebug'), 'eaccel_enabled' => extension_loaded('eaccelerator') && ini_get('eaccelerator.enable'), @@ -55,8 +55,10 @@ public function collect(Request $request, Response $response, \Exception $except 'bundles' => array(), ); - foreach ($this->kernel->getBundles() as $name => $bundle) { - $this->data['bundles'][$name] = $bundle->getPath(); + if (isset($this->kernel)) { + foreach ($this->kernel->getBundles() as $name => $bundle) { + $this->data['bundles'][$name] = $bundle->getPath(); + } } } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/DataCollector.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/DataCollector.php index 7da36b678dcc76c8ef9f2ccd88dc2abc34d090fe..98eabdb516b66df21cc2e009ad12218c236a11d4 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/DataCollector.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/DataCollector.php @@ -11,7 +11,6 @@ namespace Symfony\Component\HttpKernel\DataCollector; - /** * DataCollector. * diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/DataCollectorInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/DataCollectorInterface.php index 7cfbbd132fc172ea1a1d12b9eb6fd0bcad03fcbe..cf4cdfd7713d86e723b654bd70eb9f92d67e0824 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/DataCollectorInterface.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/DataCollectorInterface.php @@ -32,7 +32,7 @@ interface DataCollectorInterface * * @api */ - function collect(Request $request, Response $response, \Exception $exception = null); + public function collect(Request $request, Response $response, \Exception $exception = null); /** * Returns the name of the collector. @@ -41,5 +41,5 @@ function collect(Request $request, Response $response, \Exception $exception = n * * @api */ - function getName(); + public function getName(); } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/ExceptionDataCollector.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/ExceptionDataCollector.php index d6808cee4203a799da166469c0d6976448feb261..20ff597bb554e6c47ace2bc0afd049146ed163a1 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/ExceptionDataCollector.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/ExceptionDataCollector.php @@ -29,13 +29,8 @@ class ExceptionDataCollector extends DataCollector public function collect(Request $request, Response $response, \Exception $exception = null) { if (null !== $exception) { - $flattenException = FlattenException::create($exception); - if ($exception instanceof HttpExceptionInterface) { - $flattenException->setStatusCode($exception->getStatusCode()); - } - $this->data = array( - 'exception' => $flattenException, + 'exception' => FlattenException::create($exception), ); } } 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 f7cf88eee362bd7acd88b03d073c337998e26f7a..b410c23325a43a4e35f38fcd5d06e683c0e0a385 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 @@ -17,14 +17,24 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\ResponseHeaderBag; +use Symfony\Component\HttpKernel\KernelEvents; +use Symfony\Component\HttpKernel\Event\FilterControllerEvent; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** * RequestDataCollector. * * @author Fabien Potencier <fabien@symfony.com> */ -class RequestDataCollector extends DataCollector +class RequestDataCollector extends DataCollector implements EventSubscriberInterface { + protected $controllers; + + public function __construct() + { + $this->controllers = new \SplObjectStorage(); + } + /** * {@inheritdoc} */ @@ -60,11 +70,17 @@ public function collect(Request $request, Response $response, \Exception $except } $sessionMetadata = array(); - + $sessionAttributes = array(); + $flashes = array(); if ($request->hasSession()) { - $sessionMetadata['Created'] = date(DATE_RFC822, $request->getSession()->getMetadataBag()->getCreated()); - $sessionMetadata['Last used'] = date(DATE_RFC822, $request->getSession()->getMetadataBag()->getLastUsed()); - $sessionMetadata['Lifetime'] = $request->getSession()->getMetadataBag()->getLifetime(); + $session = $request->getSession(); + if ($session->isStarted()) { + $sessionMetadata['Created'] = date(DATE_RFC822, $session->getMetadataBag()->getCreated()); + $sessionMetadata['Last used'] = date(DATE_RFC822, $session->getMetadataBag()->getLastUsed()); + $sessionMetadata['Lifetime'] = $session->getMetadataBag()->getLifetime(); + $sessionAttributes = $session->all(); + $flashes = $session->getFlashBag()->peekAll(); + } } $this->data = array( @@ -80,10 +96,29 @@ public function collect(Request $request, Response $response, \Exception $except 'request_attributes' => $attributes, 'response_headers' => $responseHeaders, 'session_metadata' => $sessionMetadata, - 'session_attributes' => $request->hasSession() ? $request->getSession()->all() : array(), - 'flashes' => $request->hasSession() ? $request->getSession()->getFlashBag()->peekAll() : array(), + 'session_attributes' => $sessionAttributes, + 'flashes' => $flashes, 'path_info' => $request->getPathInfo(), + 'controller' => 'n/a', ); + + if (isset($this->controllers[$request])) { + $controller = $this->controllers[$request]; + if (is_array($controller)) { + $r = new \ReflectionMethod($controller[0], $controller[1]); + $this->data['controller'] = array( + 'class' => get_class($controller[0]), + 'method' => $controller[1], + 'file' => $r->getFilename(), + 'line' => $r->getStartLine(), + ); + } elseif ($controller instanceof \Closure) { + $this->data['controller'] = 'Closure'; + } else { + $this->data['controller'] = (string) $controller ?: 'n/a'; + } + unset($this->controllers[$request]); + } } public function getPathInfo() @@ -161,6 +196,50 @@ public function getFormat() return $this->data['format']; } + /** + * Gets the route name. + * + * The _route request attributes is automatically set by the Router Matcher. + * + * @return string The route + */ + public function getRoute() + { + return isset($this->data['request_attributes']['_route']) ? $this->data['request_attributes']['_route'] : ''; + } + + /** + * Gets the route parameters. + * + * The _route_params request attributes is automatically set by the RouterListener. + * + * @return array The parameters + */ + public function getRouteParams() + { + return isset($this->data['request_attributes']['_route_params']) ? $this->data['request_attributes']['_route_params'] : array(); + } + + /** + * Gets the controller. + * + * @return string The controller as a string + */ + public function getController() + { + return $this->data['controller']; + } + + public function onKernelController(FilterControllerEvent $event) + { + $this->controllers[$event->getRequest()] = $event->getController(); + } + + public static function getSubscribedEvents() + { + return array(KernelEvents::CONTROLLER => 'onKernelController'); + } + /** * {@inheritdoc} */ diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/RouterDataCollector.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/RouterDataCollector.php new file mode 100644 index 0000000000000000000000000000000000000000..80e250ad0f689c653fea8d05a6137ee2305e0853 --- /dev/null +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/RouterDataCollector.php @@ -0,0 +1,101 @@ +<?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\HttpKernel\DataCollector; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\HttpKernel\DataCollector\DataCollector; +use Symfony\Component\HttpKernel\Event\FilterControllerEvent; + +/** + * RouterDataCollector. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class RouterDataCollector extends DataCollector +{ + protected $controllers; + + public function __construct() + { + $this->controllers = new \SplObjectStorage(); + + $this->data = array( + 'redirect' => false, + 'url' => null, + 'route' => null, + ); + } + + /** + * {@inheritdoc} + */ + public function collect(Request $request, Response $response, \Exception $exception = null) + { + if ($response instanceof RedirectResponse) { + $this->data['redirect'] = true; + $this->data['url'] = $response->getTargetUrl(); + + if ($this->controllers->contains($request)) { + $this->data['route'] = $this->guessRoute($request, $this->controllers[$request]); + } + } + } + + protected function guessRoute(Request $request, $controller) + { + return 'n/a'; + } + + /** + * Remembers the controller associated to each request. + * + * @param FilterControllerEvent $event The filter controller event + */ + public function onKernelController(FilterControllerEvent $event) + { + $this->controllers[$event->getRequest()] = $event->getController(); + } + + /** + * @return Boolean Whether this request will result in a redirect + */ + public function getRedirect() + { + return $this->data['redirect']; + } + + /** + * @return string|null The target URL + */ + public function getTargetUrl() + { + return $this->data['url']; + } + + /** + * @return string|null The target route + */ + public function getTargetRoute() + { + return $this->data['route']; + } + + /** + * {@inheritdoc} + */ + public function getName() + { + return 'router'; + } +} diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/TimeDataCollector.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/TimeDataCollector.php index a91e91c78c7992d732c5150d11fc07c767d8f35d..0d5ac81971f4354ae39ed482ec2b82154f6a8b78 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/TimeDataCollector.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/TimeDataCollector.php @@ -74,7 +74,7 @@ public function getTotalTime() { $lastEvent = $this->data['events']['__section__']; - return $lastEvent->getOrigin() + $lastEvent->getTotalTime() - $this->data['start_time']; + return $lastEvent->getOrigin() + $lastEvent->getTotalTime() - $this->getStartTime(); } /** 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 a2466d609f40171596ce32b09255363cb898e183..605c08626ce0c8abc39ddc331edbe4247f2b8605 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 @@ -39,7 +39,7 @@ class ErrorHandler * * @return The registered error handler */ - static public function register($level = null) + public static function register($level = null) { $handler = new static(); $handler->setLevel($level); @@ -64,7 +64,7 @@ public function handle($level, $message, $file, $line, $context) } if (error_reporting() & $level && $this->level & $level) { - throw new \ErrorException(sprintf('%s: %s in %s line %d', isset($this->levels[$level]) ? $this->levels[$level] : $level, $message, $file, $line)); + throw new \ErrorException(sprintf('%s: %s in %s line %d', isset($this->levels[$level]) ? $this->levels[$level] : $level, $message, $file, $line), 0, $level, $file, $line); } return false; 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 a9da24973ab67a380d6abda26d52106ff3cc02c7..c0133d49f41b4e7b3b25d24256d85710ed80633a 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 @@ -43,9 +43,9 @@ public function __construct($debug = true, $charset = 'UTF-8') /** * Register the exception handler. * - * @return The registered exception handler + * @return ExceptionHandler The registered exception handler */ - static public function register($debug = true) + public static function register($debug = true) { $handler = new static($debug); @@ -100,7 +100,7 @@ public function createResponse($exception) } } - return new Response($this->decorate($content, $title), $exception->getStatusCode()); + return new Response($this->decorate($content, $title), $exception->getStatusCode(), $exception->getHeaders()); } private function getContent($exception) diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DependencyInjection/ConfigurableExtension.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DependencyInjection/ConfigurableExtension.php index 8388ccfd6a1873c27f4ac90b5fb6e3d099cd0b71..7e036fdf0f74f941e4215ef02ddd233d82d3c266 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DependencyInjection/ConfigurableExtension.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DependencyInjection/ConfigurableExtension.php @@ -30,7 +30,7 @@ abstract class ConfigurableExtension extends Extension /** * {@inheritDoc} */ - public final function load(array $configs, ContainerBuilder $container) + final public function load(array $configs, ContainerBuilder $container) { $this->loadInternal($this->processConfiguration($this->getConfiguration(array(), $container), $configs), $container); } 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 dacd60a9917e687f9d0880d769309dd56023a6fb..5c8d5e69ad2a19dea9033deb0cd130786c2041a7 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 @@ -96,7 +96,7 @@ public function getAlias() return Container::underscore($classBaseName); } - protected final function processConfiguration(ConfigurationInterface $configuration, array $configs) + final protected function processConfiguration(ConfigurationInterface $configuration, array $configs) { $processor = new Processor(); diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Event/PostResponseEvent.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Event/PostResponseEvent.php index 6848f78ae98947d84921f30cd633e11939e7bbd1..caa7b9f26a2d7b90446a15196bd82d38a366d5d1 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Event/PostResponseEvent.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Event/PostResponseEvent.php @@ -61,7 +61,7 @@ public function getRequest() } /** - * Returns the reponse for which this event was thrown. + * Returns the response for which this event was thrown. * * @return Response */ diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/EsiListener.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/EsiListener.php index ba67dc15303900c4c1e2822510f958af98a7436f..1176a73b4d7f7be11aa61f7ad9304d1ee88cd0a2 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/EsiListener.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/EsiListener.php @@ -51,7 +51,7 @@ public function onKernelResponse(FilterResponseEvent $event) $this->esi->addSurrogateControl($event->getResponse()); } - static public function getSubscribedEvents() + public static function getSubscribedEvents() { return array( KernelEvents::RESPONSE => 'onKernelResponse', 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 c7a90e4ef81a64e933dfb0f6c09ae6fafaf529e4..99c9fff3512186d7b725fd540f6700371edeedc0 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 @@ -62,15 +62,9 @@ public function onKernelException(GetResponseForExceptionEvent $event) $logger = $this->logger instanceof DebugLoggerInterface ? $this->logger : null; - $flattenException = FlattenException::create($exception); - if ($exception instanceof HttpExceptionInterface) { - $flattenException->setStatusCode($exception->getStatusCode()); - $flattenException->setHeaders($exception->getHeaders()); - } - $attributes = array( '_controller' => $this->controller, - 'exception' => $flattenException, + 'exception' => FlattenException::create($exception), 'logger' => $logger, 'format' => $request->getRequestFormat(), ); @@ -96,7 +90,7 @@ public function onKernelException(GetResponseForExceptionEvent $event) $handling = false; // re-throw the exception as this is a catch-all - throw $exception; + return; } $event->setResponse($response); @@ -104,7 +98,7 @@ public function onKernelException(GetResponseForExceptionEvent $event) $handling = false; } - static public function getSubscribedEvents() + public static function getSubscribedEvents() { return array( KernelEvents::EXCEPTION => array('onKernelException', -128), diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/LocaleListener.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/LocaleListener.php index cfe9734a517512cf4fae52a515f8554a62e6fdf2..529314b86d3fab3173db1b4e2e94b69c5045174a 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/LocaleListener.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/LocaleListener.php @@ -36,18 +36,10 @@ public function onKernelRequest(GetResponseEvent $event) { $request = $event->getRequest(); - if ($request->hasPreviousSession()) { - $request->setDefaultLocale($request->getSession()->get('_locale', $this->defaultLocale)); - } else { - $request->setDefaultLocale($this->defaultLocale); - } + $request->setDefaultLocale($this->defaultLocale); if ($locale = $request->attributes->get('_locale')) { $request->setLocale($locale); - - if ($request->hasPreviousSession()) { - $request->getSession()->set('_locale', $request->getLocale()); - } } if (null !== $this->router) { @@ -55,7 +47,7 @@ public function onKernelRequest(GetResponseEvent $event) } } - static public function getSubscribedEvents() + public static function getSubscribedEvents() { return array( // must be registered after the Router to have access to the _locale diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php index 83ee82a8d42c9d81ed1c86b0c5ff4235f153ebc6..5b2228ba1a58fc391ed7dfb2c1704713d3cc31fa 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php @@ -117,9 +117,13 @@ public function onKernelResponse(FilterResponseEvent $event) array_pop($this->requests); $parent = end($this->requests); - $profiles = isset($this->children[$parent]) ? $this->children[$parent] : array(); - $profiles[] = $profile; - $this->children[$parent] = $profiles; + + // when simulating requests, we might not have the parent + if ($parent) { + $profiles = isset($this->children[$parent]) ? $this->children[$parent] : array(); + $profiles[] = $profile; + $this->children[$parent] = $profiles; + } } if (isset($this->children[$request])) { @@ -134,7 +138,7 @@ public function onKernelResponse(FilterResponseEvent $event) } } - static public function getSubscribedEvents() + public static function getSubscribedEvents() { return array( // kernel.request must be registered as early as possible to not break diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/ResponseListener.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/ResponseListener.php index d047b1f1590a1f0ac06128dd41ee2083bc5793e3..669980cf2b61613c136cea132ff9750937e55344 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/ResponseListener.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/ResponseListener.php @@ -50,7 +50,7 @@ public function onKernelResponse(FilterResponseEvent $event) $response->prepare($event->getRequest()); } - static public function getSubscribedEvents() + public static function getSubscribedEvents() { return array( KernelEvents::RESPONSE => 'onKernelResponse', 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 be43a72dd289f2295b39afdfe6fdda74054d7042..6cccd3707d1e4448860551dd648d389b5a128f79 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 @@ -12,7 +12,6 @@ namespace Symfony\Component\HttpKernel\EventListener; use Symfony\Component\HttpKernel\Log\LoggerInterface; -use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; @@ -21,25 +20,40 @@ use Symfony\Component\Routing\Exception\ResourceNotFoundException; use Symfony\Component\Routing\Matcher\UrlMatcherInterface; use Symfony\Component\Routing\Matcher\RequestMatcherInterface; +use Symfony\Component\Routing\RequestContext; +use Symfony\Component\Routing\RequestContextAwareInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** - * Initializes request attributes based on a matching route. + * Initializes the context from the request and sets request attributes based on a matching route. * * @author Fabien Potencier <fabien@symfony.com> */ class RouterListener implements EventSubscriberInterface { private $matcher; + private $context; private $logger; - public function __construct($matcher, LoggerInterface $logger = null) + /** + * Constructor. + * + * @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 + */ + public function __construct($matcher, RequestContext $context = null, LoggerInterface $logger = null) { if (!$matcher instanceof UrlMatcherInterface && !$matcher instanceof RequestMatcherInterface) { throw new \InvalidArgumentException('Matcher must either implement UrlMatcherInterface or RequestMatcherInterface.'); } + if (null === $context && !$matcher instanceof RequestContextAwareInterface) { + throw new \InvalidArgumentException('You must either pass a RequestContext or the matcher must implement RequestContextAwareInterface.'); + } + $this->matcher = $matcher; + $this->context = $context ?: $matcher->getContext(); $this->logger = $logger; } @@ -47,18 +61,17 @@ public function onKernelRequest(GetResponseEvent $event) { $request = $event->getRequest(); - if (HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) { - $this->matcher->getContext()->fromRequest($request); - } + // initialize the context that is also used by the generator (assuming matcher and generator share the same context instance) + $this->context->fromRequest($request); if ($request->attributes->has('_controller')) { // routing is already done return; } - // add attributes based on the path info (routing) + // add attributes based on the request (routing) try { - // matching requests is more powerful than matching URLs only, so try that first + // matching a request is more powerful than matching a URL path + context, so try that first if ($this->matcher instanceof RequestMatcherInterface) { $parameters = $this->matcher->matchRequest($request); } else { @@ -94,7 +107,7 @@ private function parametersToString(array $parameters) return implode(', ', $pieces); } - static public function getSubscribedEvents() + public static function getSubscribedEvents() { return array( KernelEvents::REQUEST => array(array('onKernelRequest', 32)), diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/StreamedResponseListener.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/StreamedResponseListener.php index 588c5fe9b16110966cf84f3164ec93a74323c47f..88505fac6e7a63a01e4cf1524731be7291681790 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/StreamedResponseListener.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/StreamedResponseListener.php @@ -43,7 +43,7 @@ public function onKernelResponse(FilterResponseEvent $event) } } - static public function getSubscribedEvents() + public static function getSubscribedEvents() { return array( KernelEvents::RESPONSE => array('onKernelResponse', -1024), 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 16f14535d21e45e82a3f2c0b29de2fff5e14c834..b2ffb9fcfbb21382edac71e864cb49868aa9b5aa 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 @@ -30,14 +30,19 @@ class FlattenException private $file; private $line; - static public function create(\Exception $exception, $statusCode = null, array $headers = array()) + public static function create(\Exception $exception, $statusCode = null, array $headers = array()) { $e = new static(); $e->setMessage($exception->getMessage()); $e->setCode($exception->getCode()); + if ($exception instanceof HttpExceptionInterface) { + $statusCode = $exception->getStatusCode(); + $headers = array_merge($headers, $exception->getHeaders()); + } + if (null === $statusCode) { - $statusCode = $exception instanceof HttpExceptionInterface ? $exception->getStatusCode() : 500; + $statusCode = 500; } $e->setStatusCode($statusCode); diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/HttpExceptionInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/HttpExceptionInterface.php index 11102bdb8d8d381dfe6cfa75f2c079ed5701c734..dd4a9dc5a3a3ea01581c44dca934937e677327e5 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/HttpExceptionInterface.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/HttpExceptionInterface.php @@ -23,12 +23,12 @@ interface HttpExceptionInterface * * @return integer An HTTP response status code */ - function getStatusCode(); + public function getStatusCode(); /** * Returns response headers. * * @return array Response headers */ - function getHeaders(); + public function getHeaders(); } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategyInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategyInterface.php index 7b1d38795ec19a7c447064d9893cd52493776868..0fb8a12436f62349bdde185b7de9c7cc39858277 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategyInterface.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategyInterface.php @@ -30,12 +30,12 @@ interface EsiResponseCacheStrategyInterface * * @param Response $response */ - function add(Response $response); + public function add(Response $response); /** * Updates the Response HTTP headers based on the embedded Responses. * * @param Response $response */ - function update(Response $response); + public function update(Response $response); } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/StoreInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/StoreInterface.php index 58f8a8c1d940f50a6b3b92d54e8c7259a1014772..dd8c8869798d55809501ae78184f51f26750c4bb 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/StoreInterface.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/StoreInterface.php @@ -31,7 +31,7 @@ interface StoreInterface * * @return Response|null A Response instance, or null if no cache entry was found */ - function lookup(Request $request); + public function lookup(Request $request); /** * Writes a cache entry to the store for the given Request and Response. @@ -44,14 +44,14 @@ function lookup(Request $request); * * @return string The key under which the response is stored */ - function write(Request $request, Response $response); + public function write(Request $request, Response $response); /** * Invalidates all cache entries that match the request. * * @param Request $request A Request instance */ - function invalidate(Request $request); + public function invalidate(Request $request); /** * Locks the cache for a given Request. @@ -60,14 +60,14 @@ function invalidate(Request $request); * * @return Boolean|string true if the lock is acquired, the path to the current lock otherwise */ - function lock(Request $request); + public function lock(Request $request); /** * Releases the lock for the given Request. * * @param Request $request A Request instance */ - function unlock(Request $request); + public function unlock(Request $request); /** * Purges data for the given URL. @@ -76,10 +76,10 @@ function unlock(Request $request); * * @return Boolean true if the URL exists and has been purged, false otherwise */ - function purge($url); + public function purge($url); /** * Cleanups storage. */ - function cleanup(); + public function cleanup(); } 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 eea71e855eb2b8d5129a790a9f0dc63d0477f628..95167011b93551081ff1bd7dfee6f55977e6068a 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php @@ -13,6 +13,7 @@ use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; use Symfony\Component\HttpKernel\Event\FilterControllerEvent; use Symfony\Component\HttpKernel\Event\FilterResponseEvent; use Symfony\Component\HttpKernel\Event\GetResponseEvent; @@ -184,14 +185,35 @@ private function handleException(\Exception $e, $request, $type) $event = new GetResponseForExceptionEvent($this, $request, $type, $e); $this->dispatcher->dispatch(KernelEvents::EXCEPTION, $event); + // a listener might have replaced the exception + $e = $event->getException(); + if (!$event->hasResponse()) { throw $e; } + $response = $event->getResponse(); + + // the developer asked for a specific status code + if ($response->headers->has('X-Status-Code')) { + $response->setStatusCode($response->headers->get('X-Status-Code')); + + $response->headers->remove('X-Status-Code'); + } elseif (!$response->isClientError() && !$response->isServerError() && !$response->isRedirect()) { + // ensure that we actually have an error response + if ($e instanceof HttpExceptionInterface) { + // keep the HTTP status code and headers + $response->setStatusCode($e->getStatusCode()); + $response->headers->add($e->getHeaders()); + } else { + $response->setStatusCode(500); + } + } + try { - return $this->filterResponse($event->getResponse(), $request, $type); + return $this->filterResponse($response, $request, $type); } catch (\Exception $e) { - return $event->getResponse(); + return $response; } } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernelInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernelInterface.php index efcf39da91311826a49d12eb870c984d1a84780c..f49d37ccb1f96247db825020688aa64c8336ea10 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernelInterface.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernelInterface.php @@ -43,5 +43,5 @@ interface HttpKernelInterface * * @api */ - function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true); + public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true); } 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 bc45891fd9391247a01743fb8d93e81f37ca3ad2..588b07e3bf8eab190d7294229a6bf59460d6e262 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Kernel.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Kernel.php @@ -58,12 +58,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $classes; protected $errorReportingLevel; - const VERSION = '2.1.0-BETA1'; + const VERSION = '2.1.0-RC1'; const VERSION_ID = '20100'; const MAJOR_VERSION = '2'; const MINOR_VERSION = '1'; const RELEASE_VERSION = '0'; - const EXTRA_VERSION = 'BETA'; + const EXTRA_VERSION = 'RC1'; /** * Constructor. @@ -79,7 +79,7 @@ public function __construct($environment, $debug) $this->debug = (Boolean) $debug; $this->booted = false; $this->rootDir = $this->getRootDir(); - $this->name = preg_replace('/[^a-zA-Z0-9_]+/', '', basename($this->rootDir)); + $this->name = $this->getName(); $this->classes = array(); if ($this->debug) { @@ -354,6 +354,10 @@ public function locateResource($name, $dir = null, $first = true) */ public function getName() { + if (null === $this->name) { + $this->name = preg_replace('/[^a-zA-Z0-9_]+/', '', basename($this->rootDir)); + } + return $this->name; } @@ -467,6 +471,18 @@ public function getLogDir() return $this->rootDir.'/logs'; } + /** + * Gets the charset of the application. + * + * @return string The charset + * + * @api + */ + public function getCharset() + { + return 'UTF-8'; + } + /** * Initializes the data structures related to the bundle management. * @@ -601,7 +617,7 @@ protected function getKernelParameters() 'kernel.cache_dir' => $this->getCacheDir(), 'kernel.logs_dir' => $this->getLogDir(), 'kernel.bundles' => $bundles, - 'kernel.charset' => 'UTF-8', + 'kernel.charset' => $this->getCharset(), 'kernel.container_class' => $this->getContainerClass(), ), $this->getEnvParameters() @@ -736,7 +752,7 @@ protected function getContainerLoader(ContainerInterface $container) * * @return string The PHP string with the comments removed */ - static public function stripComments($source) + public static function stripComments($source) { if (!function_exists('token_get_all')) { return $source; diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/KernelEvents.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/KernelEvents.php index c2a43090b3d46859c3b9d8360fed4000fd0276bb..fce48ac3a6ed8f244eaf41d9b3c159f6615e6e6f 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/KernelEvents.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/KernelEvents.php @@ -93,7 +93,7 @@ final class KernelEvents const RESPONSE = 'kernel.response'; /** - * The TERMINATE event occurs once a reponse was sent + * The TERMINATE event occurs once a response was sent * * This event allows you to run expensive post-response jobs. * The event listener method receives a diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/KernelInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/KernelInterface.php index 4fb0abc0ad6c87468d8aecd4c4b8e72fbad6f799..4010a3020e21afa9980b828f85c8b5d186701ce3 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/KernelInterface.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/KernelInterface.php @@ -34,7 +34,7 @@ interface KernelInterface extends HttpKernelInterface, \Serializable * * @api */ - function registerBundles(); + public function registerBundles(); /** * Loads the container configuration @@ -43,14 +43,14 @@ function registerBundles(); * * @api */ - function registerContainerConfiguration(LoaderInterface $loader); + public function registerContainerConfiguration(LoaderInterface $loader); /** * Boots the current kernel. * * @api */ - function boot(); + public function boot(); /** * Shutdowns the kernel. @@ -59,7 +59,7 @@ function boot(); * * @api */ - function shutdown(); + public function shutdown(); /** * Gets the registered bundle instances. @@ -68,7 +68,7 @@ function shutdown(); * * @api */ - function getBundles(); + public function getBundles(); /** * Checks if a given class name belongs to an active bundle. @@ -79,7 +79,7 @@ function getBundles(); * * @api */ - function isClassInActiveBundle($class); + public function isClassInActiveBundle($class); /** * Returns a bundle and optionally its descendants by its name. @@ -93,7 +93,7 @@ function isClassInActiveBundle($class); * * @api */ - function getBundle($name, $first = true); + public function getBundle($name, $first = true); /** * Returns the file path for a given resource. @@ -123,7 +123,7 @@ function getBundle($name, $first = true); * * @api */ - function locateResource($name, $dir = null, $first = true); + public function locateResource($name, $dir = null, $first = true); /** * Gets the name of the kernel @@ -132,7 +132,7 @@ function locateResource($name, $dir = null, $first = true); * * @api */ - function getName(); + public function getName(); /** * Gets the environment. @@ -141,7 +141,7 @@ function getName(); * * @api */ - function getEnvironment(); + public function getEnvironment(); /** * Checks if debug mode is enabled. @@ -150,7 +150,7 @@ function getEnvironment(); * * @api */ - function isDebug(); + public function isDebug(); /** * Gets the application root dir. @@ -159,7 +159,7 @@ function isDebug(); * * @api */ - function getRootDir(); + public function getRootDir(); /** * Gets the current container. @@ -168,7 +168,7 @@ function getRootDir(); * * @api */ - function getContainer(); + public function getContainer(); /** * Gets the request start time (not available if debug is disabled). @@ -177,7 +177,7 @@ function getContainer(); * * @api */ - function getStartTime(); + public function getStartTime(); /** * Gets the cache directory. @@ -186,7 +186,7 @@ function getStartTime(); * * @api */ - function getCacheDir(); + public function getCacheDir(); /** * Gets the log directory. @@ -195,5 +195,14 @@ function getCacheDir(); * * @api */ - function getLogDir(); + public function getLogDir(); + + /** + * Gets the charset of the application. + * + * @return string The charset + * + * @api + */ + public function getCharset(); } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Log/DebugLoggerInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Log/DebugLoggerInterface.php index 65bb25a864036bf7da5db398fcbeb8b695772057..4442c6398efa4d9614bd1e628adbe1a240155ca0 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Log/DebugLoggerInterface.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Log/DebugLoggerInterface.php @@ -27,12 +27,12 @@ interface DebugLoggerInterface * * @return array An array of logs */ - function getLogs(); + public function getLogs(); /** * Returns the number of errors. * * @return integer The number of errors */ - function countErrors(); + public function countErrors(); } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Log/LoggerInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Log/LoggerInterface.php index 97fe65b912ed1971517d11db65badd96c5b5a9d6..34847c8098f0eb3835722b02836efdc2d0311656 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Log/LoggerInterface.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Log/LoggerInterface.php @@ -23,40 +23,40 @@ interface LoggerInterface /** * @api */ - function emerg($message, array $context = array()); + public function emerg($message, array $context = array()); /** * @api */ - function alert($message, array $context = array()); + public function alert($message, array $context = array()); /** * @api */ - function crit($message, array $context = array()); + public function crit($message, array $context = array()); /** * @api */ - function err($message, array $context = array()); + public function err($message, array $context = array()); /** * @api */ - function warn($message, array $context = array()); + public function warn($message, array $context = array()); /** * @api */ - function notice($message, array $context = array()); + public function notice($message, array $context = array()); /** * @api */ - function info($message, array $context = array()); + public function info($message, array $context = array()); /** * @api */ - function debug($message, array $context = array()); + public function debug($message, array $context = array()); } 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 ebf19127f252c2a4a35979a16c886eb057128913..c4e259aa844958c10ad84238c1a8aab08555dba4 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 @@ -153,20 +153,27 @@ public function write(Profile $profile) 'time' => $profile->getTime(), ); + $profileIndexed = false !== $this->getValue($this->getItemName($profile->getToken())); + if ($this->setValue($this->getItemName($profile->getToken()), $data, $this->lifetime)) { - // Add to index - $indexName = $this->getIndexName(); - - $indexRow = implode("\t", array( - $profile->getToken(), - $profile->getIp(), - $profile->getMethod(), - $profile->getUrl(), - $profile->getTime(), - $profile->getParentToken(), - ))."\n"; - - return $this->appendValue($indexName, $indexRow, $this->lifetime); + + if (!$profileIndexed) { + // Add to index + $indexName = $this->getIndexName(); + + $indexRow = implode("\t", array( + $profile->getToken(), + $profile->getIp(), + $profile->getMethod(), + $profile->getUrl(), + $profile->getTime(), + $profile->getParentToken(), + ))."\n"; + + return $this->appendValue($indexName, $indexRow, $this->lifetime); + } + + return true; } return false; 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 7f85cdefb7c56ed813fc7399218b5315fed1b3ba..94052f8b1f5351a6bb4791f6d210922efdd9ac63 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 @@ -129,10 +129,13 @@ public function write(Profile $profile) { $file = $this->getFilename($profile->getToken()); - // Create directory - $dir = dirname($file); - if (!is_dir($dir)) { - mkdir($dir, 0777, true); + $profileIndexed = is_file($file); + if (!$profileIndexed) { + // Create directory + $dir = dirname($file); + if (!is_dir($dir)) { + mkdir($dir, 0777, true); + } } // Store profile @@ -151,20 +154,22 @@ public function write(Profile $profile) return false; } - // Add to index - if (false === $file = fopen($this->getIndexFilename(), 'a')) { - return false; - } + if (!$profileIndexed) { + // Add to index + if (false === $file = fopen($this->getIndexFilename(), 'a')) { + return false; + } - fputcsv($file, array( - $profile->getToken(), - $profile->getIp(), - $profile->getMethod(), - $profile->getUrl(), - $profile->getTime(), - $profile->getParentToken(), - )); - fclose($file); + fputcsv($file, array( + $profile->getToken(), + $profile->getIp(), + $profile->getMethod(), + $profile->getUrl(), + $profile->getTime(), + $profile->getParentToken(), + )); + fclose($file); + } return true; } @@ -200,7 +205,7 @@ protected function getIndexFilename() * * @param resource $file The file resource, with the pointer placed at the end of the line to read * - * @return mixed A string representating the line or FALSE if beginning of file is reached + * @return mixed A string representing the line or FALSE if beginning of file is reached */ protected function readLineFromFile($file) { 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 0ddac785f127f408c8da99a481043215daa11e9c..0dcad22df50d42109edcdcd956c3dbf63cbe907e 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 @@ -114,7 +114,7 @@ protected function getMongo() { if ($this->mongo === null) { if (preg_match('#^(mongodb://.*)/(.*)/(.*)$#', $this->dsn, $matches)) { - $mongo = new \Mongo($matches[1]); + $mongo = new \Mongo($matches[1] . (!empty($matches[2]) ? '/' . $matches[2] : '')); $database = $matches[2]; $collection = $matches[3]; $this->mongo = $mongo->selectCollection($database, $collection); 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 4091232f1370a5b1ec479bb694f538b6a8c2d5e5..b7bc61769025b97834f2a1508e40f055e5c02616 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 @@ -235,7 +235,7 @@ protected function readChildren($token, $parent) return $profiles; } - + /** * Returns whether data for the given token already exists in storage. * 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 db608eaa187435ae2c4e1261ef167f7a4fd86710..f92d90d87d4183c4f1f3bffa5c43801c8ac2830b 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 @@ -28,7 +28,7 @@ interface ProfilerStorageInterface * * @return array An array of tokens */ - function find($ip, $url, $limit, $method); + public function find($ip, $url, $limit, $method); /** * Reads data associated with the given token. @@ -39,7 +39,7 @@ function find($ip, $url, $limit, $method); * * @return Profile The profile associated with token */ - function read($token); + public function read($token); /** * Saves a Profile. @@ -48,10 +48,10 @@ function read($token); * * @return Boolean Write operation successful */ - function write(Profile $profile); + public function write(Profile $profile); /** * Purges all data from the database. */ - function purge(); + public function purge(); } 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 f7e5f3c8ff26c7c60ca51b0bc7f4da78ddce8e00..51c9f9c344c78f10e33c9251c7fa679aa6d98d2b 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 @@ -167,20 +167,27 @@ public function write(Profile $profile) 'time' => $profile->getTime(), ); + $profileIndexed = false !== $this->getValue($this->getItemName($profile->getToken())); + if ($this->setValue($this->getItemName($profile->getToken()), $data, $this->lifetime, self::REDIS_SERIALIZER_PHP)) { - // Add to index - $indexName = $this->getIndexName(); - - $indexRow = implode("\t", array( - $profile->getToken(), - $profile->getIp(), - $profile->getMethod(), - $profile->getUrl(), - $profile->getTime(), - $profile->getParentToken(), - ))."\n"; - - return $this->appendValue($indexName, $indexRow, $this->lifetime); + + if (!$profileIndexed) { + // Add to index + $indexName = $this->getIndexName(); + + $indexRow = implode("\t", array( + $profile->getToken(), + $profile->getIp(), + $profile->getMethod(), + $profile->getUrl(), + $profile->getTime(), + $profile->getParentToken(), + ))."\n"; + + return $this->appendValue($indexName, $indexRow, $this->lifetime); + } + + return true; } return false; @@ -363,7 +370,7 @@ private function appendValue($key, $value, $expiration = 0) /** * Removes the specified keys. * - * @param array $key + * @param array $keys * * @return Boolean */ 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 70e9c50a01b5b185d765952f0d6a7617ebabd8d5..f59bbc934de340c3be7c76a1f832fdcdd78f92c8 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 @@ -11,7 +11,6 @@ namespace Symfony\Component\HttpKernel\Profiler; - /** * SqliteProfilerStorage stores profiling information in a SQLite database. * diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/TerminableInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/TerminableInterface.php index 78a362fe431d332ff23574be7af6ea8ea9db2a3b..fc0e580dfb785cc02485fa73f0d04c439b1d36fa 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/TerminableInterface.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/TerminableInterface.php @@ -35,5 +35,5 @@ interface TerminableInterface * * @api */ - function terminate(Request $request, Response $response); + public function terminate(Request $request, Response $response); } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php index eaff42a1bcd15c876dcfd8f45d7e118a36687c23..8affb5f300bfbb315d426a02d790355a1f71ed61 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php @@ -25,7 +25,7 @@ public function testRegisterCommands() $this->markTestSkipped('The "Console" component is not available'); } - if (!class_exists('Symfony\Component\DependencyInjection\ContainerAwareInterface')) { + if (!interface_exists('Symfony\Component\DependencyInjection\ContainerAwareInterface')) { $this->markTestSkipped('The "DependencyInjection" component is not available'); } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php index e1ede855e1bed32f6132ae8655c9dbb1e588da33..594af3247a64154ff64510d8ac01796520f4847d 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php @@ -162,7 +162,7 @@ protected function controllerMethod3($foo, $bar = null, $foobar) { } - static protected function controllerMethod4() + protected static function controllerMethod4() { } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php index 407f18fec03450ce6437596a74dd0fbb63bcf58b..f517c12b2f92af79eafc25f2887c6bc4e6ff09ca 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php @@ -28,8 +28,9 @@ protected function setUp() public function testCollect() { - $kernel = new KernelForTest('test',true); - $c = new ConfigDataCollector($kernel); + $kernel = new KernelForTest('test', true); + $c = new ConfigDataCollector(); + $c->setKernel($kernel); $c->collect(new Request(), new Response()); $this->assertSame('test',$c->getEnv()); diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/ContainerAwareTraceableEventDispatcherTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/ContainerAwareTraceableEventDispatcherTest.php index b126848b7608bae1a340f92aec93854709c5812e..40c54e56a5a719acdc51b16062c9ddd3e3cdb7d0 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/ContainerAwareTraceableEventDispatcherTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/ContainerAwareTraceableEventDispatcherTest.php @@ -71,9 +71,9 @@ public function testStaticCallable() class StaticClassFixture { - static public $called = false; + public static $called = false; - static public function staticListener($event) + public static function staticListener($event) { self::$called = true; } 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 585efd46a827d05b22c94eba7598465f4eece72f..0eb2d79d4c2b1bc9f76120882a5b83645e03894b 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 @@ -51,6 +51,9 @@ public function testHandle() $handler->handle(1, 'foo', 'foo.php', 12, 'foo'); } catch (\ErrorException $e) { $this->assertSame('1: foo in foo.php line 12', $e->getMessage()); + $this->assertSame(1, $e->getSeverity()); + $this->assertSame('foo.php', $e->getFile()); + $this->assertSame(12, $e->getLine()); } restore_error_handler(); diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/ExceptionHandlerTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/ExceptionHandlerTest.php index 8c61f5a57db919cca2341861f7bff287e0029935..c13e559362b7bf312b8218c32ac9ebc563b2407c 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/ExceptionHandlerTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/ExceptionHandlerTest.php @@ -13,6 +13,7 @@ use Symfony\Component\HttpKernel\Debug\ExceptionHandler; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; class ExceptionHandlerTest extends \PHPUnit_Framework_TestCase { @@ -51,6 +52,15 @@ public function testStatusCode() $this->assertContains('<title>Sorry, the page you are looking for could not be found.</title>', $response->getContent()); } + public function testHeaders() + { + $handler = new ExceptionHandler(false); + + $response = $handler->createResponse(new MethodNotAllowedHttpException(array('POST'))); + $this->assertEquals('405', $response->getStatusCode()); + $this->assertEquals('POST', $response->headers->get('Allow')); + } + public function testNestedExceptions() { $handler = new ExceptionHandler(true); diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/StopwatchTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/StopwatchTest.php index 76ae5566ff60135cabbe8a073cf1596c2c2f8be2..210acb59595e7dd24b0051723041377c83f1366b 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/StopwatchTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/StopwatchTest.php @@ -85,7 +85,6 @@ public function testSection() $stopwatch->stop('foobar'); $stopwatch->stopSection('0'); - // the section is an event by itself $this->assertCount(3, $stopwatch->getSectionEvents('1')); $this->assertCount(2, $stopwatch->getSectionEvents('2')); diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php index a13b325f743c885a522367fd166e2c402dbb369a..9ca64321b2cbee4b7af90cbbe306adfdbef1c1e2 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php @@ -34,23 +34,6 @@ public function testDefaultLocaleWithoutSession() $this->assertEquals('fr', $request->getLocale()); } - public function testDefaultLocaleWithSession() - { - $request = Request::create('/'); - session_name('foo'); - $request->cookies->set('foo', 'value'); - - $session = $this->getMock('Symfony\Component\HttpFoundation\Session\Session', array('get'), array(), '', true); - $session->expects($this->once())->method('get')->will($this->returnValue('es')); - $request->setSession($session); - - $listener = new LocaleListener('fr'); - $event = $this->getEvent($request); - - $listener->onKernelRequest($event); - $this->assertEquals('es', $request->getLocale()); - } - public function testLocaleFromRequestAttribute() { $request = Request::create('/'); @@ -61,12 +44,6 @@ public function testLocaleFromRequestAttribute() $listener = new LocaleListener('fr'); $event = $this->getEvent($request); - // also updates the session _locale value - $session = $this->getMock('Symfony\Component\HttpFoundation\Session\Session', array('set', 'get'), array(), '', true); - $session->expects($this->once())->method('set')->with('_locale', 'es'); - $session->expects($this->once())->method('get')->with('_locale')->will($this->returnValue('es')); - $request->setSession($session); - $listener->onKernelRequest($event); $this->assertEquals('es', $request->getLocale()); } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php index 9ac028c652352f09276fd30220fc0ec4a61e96c5..3ba56a8da78b86d23762c014d8d0194a024835a5 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php @@ -92,18 +92,43 @@ public function testRequestMatcher() $request = Request::create('http://localhost/'); $event = new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST); - $context = new RequestContext(); + $requestMatcher = $this->getMock('Symfony\Component\Routing\Matcher\RequestMatcherInterface'); + $requestMatcher->expects($this->once()) + ->method('matchRequest') + ->with($this->isInstanceOf('Symfony\Component\HttpFoundation\Request')) + ->will($this->returnValue(array())); + + $listener = new RouterListener($requestMatcher, new RequestContext()); + $listener->onKernelRequest($event); + } + + public function testSubRequestWithDifferentMethod() + { + $kernel = $this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface'); + $request = Request::create('http://localhost/', 'post'); + $event = new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST); $requestMatcher = $this->getMock('Symfony\Component\Routing\Matcher\RequestMatcherInterface'); $requestMatcher->expects($this->any()) - ->method('getContext') - ->will($this->returnValue($context)); - $requestMatcher->expects($this->once()) ->method('matchRequest') ->with($this->isInstanceOf('Symfony\Component\HttpFoundation\Request')) ->will($this->returnValue(array())); - $listener = new RouterListener($requestMatcher); + $context = new RequestContext(); + $requestMatcher->expects($this->any()) + ->method('getContext') + ->will($this->returnValue($context)); + + $listener = new RouterListener($requestMatcher, new RequestContext()); + $listener->onKernelRequest($event); + + // sub-request with another HTTP method + $kernel = $this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface'); + $request = Request::create('http://localhost/', 'get'); + $event = new GetResponseEvent($kernel, $request, HttpKernelInterface::SUB_REQUEST); + $listener->onKernelRequest($event); + + $this->assertEquals('GET', $context->getMethod()); } } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Exception/FlattenExceptionTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Exception/FlattenExceptionTest.php index a1ddda759b68b765129993734a1a650d07f3f1d9..65975aa96fc83a8fc6d473d0f93fdf769061a1f3 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Exception/FlattenExceptionTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Exception/FlattenExceptionTest.php @@ -13,6 +13,7 @@ use Symfony\Component\HttpKernel\Exception\FlattenException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; class FlattenExceptionTest extends \PHPUnit_Framework_TestCase { @@ -28,6 +29,12 @@ public function testStatusCode() $this->assertEquals('404', $flattened->getStatusCode()); } + public function testHeadersForHttpException() + { + $flattened = FlattenException::create(new MethodNotAllowedHttpException(array('POST'))); + $this->assertEquals(array('Allow' => 'POST'), $flattened->getHeaders()); + } + /** * @dataProvider flattenDataProvider */ diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/KernelForOverrideName.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/KernelForOverrideName.php new file mode 100644 index 0000000000000000000000000000000000000000..32c05f4ba6a829f83755fae8eab52e5fe9d4659a --- /dev/null +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/KernelForOverrideName.php @@ -0,0 +1,30 @@ +<?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\HttpKernel\Tests\Fixtures; + +use Symfony\Component\HttpKernel\Kernel; +use Symfony\Component\Config\Loader\LoaderInterface; + +class KernelForOverrideName extends Kernel +{ + protected $name = 'overridden'; + + public function registerBundles() + { + + } + + public function registerContainerConfiguration(LoaderInterface $loader) + { + + } +} diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/TestEventDispatcher.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/TestEventDispatcher.php index f27737877fe677b85864e12fc123c2a21f90d2b4..da7ef5bd603818fa589a20648fd5fa87b42f98dc 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/TestEventDispatcher.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/TestEventDispatcher.php @@ -16,12 +16,12 @@ class TestEventDispatcher extends EventDispatcher implements TraceableEventDispatcherInterface { - function getCalledListeners() + public function getCalledListeners() { return array('foo'); } - function getNotCalledListeners() + public function getNotCalledListeners() { return array('bar'); } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php index 3d78c7c8cef0fdde33db787665b99ab00481ecd5..4377f61fbeac529b0676ee27c4ffa7c5c1dad0db 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php @@ -154,7 +154,7 @@ public function catchExceptions($catch = true) $this->catch = $catch; } - static public function clearDirectory($directory) + public static function clearDirectory($directory) { if (!is_dir($directory)) { return; diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php index bdbc4e80ff8cd3cd757cc768fa3b2e283e7d1259..701e7a71e6416b37137d19b310ec66c3a6fe4eae 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php @@ -14,8 +14,11 @@ use Symfony\Component\HttpKernel\HttpKernel; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\KernelEvents; +use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; +use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\EventDispatcher\EventDispatcher; class HttpKernelTest extends \PHPUnit_Framework_TestCase @@ -59,8 +62,65 @@ public function testHandleWhenControllerThrowsAnExceptionAndRawIsFalse() }); $kernel = new HttpKernel($dispatcher, $this->getResolver(function () { throw new \RuntimeException('foo'); })); + $response = $kernel->handle(new Request()); - $this->assertEquals('foo', $kernel->handle(new Request())->getContent()); + $this->assertEquals('500', $response->getStatusCode()); + $this->assertEquals('foo', $response->getContent()); + } + + public function testHandleExceptionWithARedirectionResponse() + { + $dispatcher = new EventDispatcher(); + $dispatcher->addListener(KernelEvents::EXCEPTION, function ($event) { + $event->setResponse(new RedirectResponse('/login', 301)); + }); + + $kernel = new HttpKernel($dispatcher, $this->getResolver(function () { throw new AccessDeniedHttpException(); })); + $response = $kernel->handle(new Request()); + + $this->assertEquals('301', $response->getStatusCode()); + $this->assertEquals('/login', $response->headers->get('Location')); + } + + public function testHandleHttpException() + { + $dispatcher = new EventDispatcher(); + $dispatcher->addListener(KernelEvents::EXCEPTION, function ($event) { + $event->setResponse(new Response($event->getException()->getMessage())); + }); + + $kernel = new HttpKernel($dispatcher, $this->getResolver(function () { throw new MethodNotAllowedHttpException(array('POST')); })); + $response = $kernel->handle(new Request()); + + $this->assertEquals('405', $response->getStatusCode()); + $this->assertEquals('POST', $response->headers->get('Allow')); + } + + /** + * @dataProvider getStatusCodes + */ + public function testHandleWhenAnExceptionIsHandledWithASpecificStatusCode($responseStatusCode, $expectedStatusCode) + { + $dispatcher = new EventDispatcher(); + $dispatcher->addListener(KernelEvents::EXCEPTION, function ($event) use ($responseStatusCode, $expectedStatusCode) { + $event->setResponse(new Response('', $responseStatusCode, array('X-Status-Code' => $expectedStatusCode))); + }); + + $kernel = new HttpKernel($dispatcher, $this->getResolver(function () { throw new \RuntimeException(); })); + $response = $kernel->handle(new Request()); + + $this->assertEquals($expectedStatusCode, $response->getStatusCode()); + $this->assertFalse($response->headers->has('X-Status-Code')); + } + + public function getStatusCodes() + { + return array( + array(200, 404), + array(404, 200), + array(301, 200), + array(500, 200), + ); } public function testHandleWhenAListenerReturnsAResponse() @@ -225,7 +285,7 @@ public function controller() return new Response('foo'); } - static public function staticController() + public static function staticController() { return new Response('foo'); } 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 8fc46cc8f18e259ed8153b8e366bfaa890946e29..0def224354f33b79c71660bbb0ba6d99941ec0a1 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 @@ -17,6 +17,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTest; +use Symfony\Component\HttpKernel\Tests\Fixtures\KernelForOverrideName; use Symfony\Component\HttpKernel\Tests\Fixtures\FooBarBundle; class KernelTest extends \PHPUnit_Framework_TestCase @@ -292,7 +293,15 @@ public function testGetRootDir() { $kernel = new KernelForTest('test', true); - $this->assertEquals(__DIR__.DIRECTORY_SEPARATOR.'Fixtures', $kernel->getRootDir()); + $rootDir = __DIR__.DIRECTORY_SEPARATOR.'Fixtures'; + + // getRootDir() returns path with slashes + // without conversion test fails on Windows + if (defined('PHP_WINDOWS_VERSION_MAJOR')) { + $rootDir = strtr($rootDir, '\\', '/'); + } + + $this->assertEquals($rootDir, $kernel->getRootDir()); } public function testGetName() @@ -302,6 +311,13 @@ public function testGetName() $this->assertEquals('Fixtures', $kernel->getName()); } + public function testOverrideGetName() + { + $kernel = new KernelForOverrideName('test', true); + + $this->assertEquals('overridden', $kernel->getName()); + } + public function testSerialize() { $env = 'test_env'; 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 15bcc39edb311e78df56c3635709188decd23248..62f24ce87a405b961f0de6d35c7bec506389759a 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 @@ -209,6 +209,22 @@ public function testPurge() $this->assertCount(0, $this->getStorage()->find('127.0.0.1', '', 10, 'GET'), '->purge() removes all items from index'); } + public function testDuplicates() + { + for ($i = 1; $i <= 5; $i++) { + $profile = new Profile('foo' . $i); + $profile->setIp('127.0.0.1'); + $profile->setUrl('http://example.net/'); + $profile->setMethod('GET'); + + ///three duplicates + $this->getStorage()->write($profile); + $this->getStorage()->write($profile); + $this->getStorage()->write($profile); + } + $this->assertCount(3, $this->getStorage()->find('127.0.0.1', 'http://example.net/', 3, 'GET'), '->find() method returns incorrect number of entries'); + } + /** * @return \Symfony\Component\HttpKernel\Profiler\ProfilerStorageInterface */ diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php index 16c615a05d96ef202c9c5b31ec548fb756f67090..ad225129d34b55cd7b6eb667e7a42b477ab01f9f 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\HttpKernel\Tests\Profiler; use Symfony\Component\HttpKernel\Profiler\FileProfilerStorage; +use Symfony\Component\HttpKernel\Profiler\Profile; class FileProfilerStorageTest extends AbstractProfilerStorageTest { @@ -57,4 +58,28 @@ protected function getStorage() { return self::$storage; } + + public function testMultiRowIndexFile() + { + $iteration = 3; + for ($i = 0; $i < $iteration; $i++) { + $profile = new Profile('token' . $i); + $profile->setIp('127.0.0.' . $i); + $profile->setUrl('http://foo.bar/' . $i); + $storage = $this->getStorage(); + + $storage->write($profile); + $storage->write($profile); + $storage->write($profile); + } + + $handle = fopen(self::$tmpDir . '/index.csv', 'r'); + for ($i = 0; $i < $iteration; $i++) { + $row = fgetcsv($handle); + $this->assertEquals('token' . $i, $row[0]); + $this->assertEquals('127.0.0.' . $i, $row[1]); + $this->assertEquals('http://foo.bar/' . $i, $row[3]); + } + $this->assertFalse(fgetcsv($handle)); + } } 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 4679a0efa5e945aa055b926250fc6c9a4cb22352..bff52e7c5eed034f0df275c5691009719bbd0dba 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 @@ -26,7 +26,7 @@ class MongoDbProfilerStorageTest extends AbstractProfilerStorageTest { protected static $storage; - static public function setUpBeforeClass() + public static function setUpBeforeClass() { if (extension_loaded('mongo')) { self::$storage = new DummyMongoDbProfilerStorage('mongodb://localhost/symfony_tests/profiler_data', '', '', 86400); @@ -38,7 +38,7 @@ static public function setUpBeforeClass() } } - static public function tearDownAfterClass() + public static function tearDownAfterClass() { if (self::$storage) { self::$storage->purge(); diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/CHANGELOG.md b/core/vendor/symfony/routing/Symfony/Component/Routing/CHANGELOG.md index 741d18c7b55997c4c72f2485bb7ff49c268152b9..edfdd4e491440a98b2b50046cd01e8bae26eb19e 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/CHANGELOG.md +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/CHANGELOG.md @@ -22,5 +22,5 @@ CHANGELOG been used anyway without creating inconsistencies * [BC BREAK] RouteCollection::remove also removes a route from parent collections (not only from its children) - * added strict_parameters option to disable exceptions (and generate empty + * added strict_requirements option to disable exceptions (and generate empty URLs instead) when generating a route with an invalid parameter value diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Generator/ConfigurableRequirementsInterface.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Generator/ConfigurableRequirementsInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..9a795d6aac33c6d42f382bec937d6edfb39cb114 --- /dev/null +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Generator/ConfigurableRequirementsInterface.php @@ -0,0 +1,36 @@ +<?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\Routing\Generator; + +/** + * ConfigurableRequirementsInterface must be implemented by URL generators in order + * to be able to configure whether an exception should be generated when the + * parameters do not match the requirements. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +interface ConfigurableRequirementsInterface +{ + /** + * Enables or disables the exception on incorrect parameters. + * + * @param Boolean $enabled + */ + public function setStrictRequirements($enabled); + + /** + * Gets the strict check of incorrect parameters. + * + * @return Boolean + */ + public function isStrictRequirements(); +} diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Generator/Dumper/GeneratorDumperInterface.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Generator/Dumper/GeneratorDumperInterface.php index 0f2f684032664407b3fc50a9c1867e6a5c9bb34d..deb0c0a2ddc057123a0eaaf91ae10ca73143a179 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Generator/Dumper/GeneratorDumperInterface.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Generator/Dumper/GeneratorDumperInterface.php @@ -30,12 +30,12 @@ interface GeneratorDumperInterface * * @return string Executable code */ - function dump(array $options = array()); + public function dump(array $options = array()); /** * Gets the routes to dump. * * @return RouteCollection A RouteCollection instance */ - function getRoutes(); + public function getRoutes(); } 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 760d7294204f3c4175a970c8a7080efed632755e..18edd160dd597c8c1ab0602a460277ee4c8f74ff 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Generator/UrlGenerator.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Generator/UrlGenerator.php @@ -26,14 +26,38 @@ * * @api */ -class UrlGenerator implements UrlGeneratorInterface +class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInterface { protected $context; - protected $strictParameters = true; + protected $strictRequirements = true; protected $logger; + + /** + * This array defines the characters (besides alphanumeric ones) that will not be percent-encoded in the path segment of the generated URL. + * + * PHP's rawurlencode() encodes all chars except "a-zA-Z0-9-._~" according to RFC 3986. But we want to allow some chars + * to be used in their literal form (reasons below). Other chars inside the path must of course be encoded, e.g. + * "?" and "#" (would be interpreted wrongly as query and fragment identifier), + * "'" and """ (are used as delimiters in HTML). + */ protected $decodedChars = array( - // %2F is not valid in a URL, so we don't encode it (which is fine as the requirements explicitly allowed it) + // the slash can be used to designate a hierarchical structure and we want allow using it with this meaning + // some webservers don't allow the slash in encoded form in the path for security reasons anyway + // see http://stackoverflow.com/questions/4069002/http-400-if-2f-part-of-get-url-in-jboss '%2F' => '/', + // the following chars are general delimiters in the URI specification but have only special meaning in the authority component + // so they can safely be used in the path in unencoded form + '%40' => '@', + '%3A' => ':', + // these chars are only sub-delimiters that have no predefined meaning and can therefore be used literally + // so URI producing applications can use these chars to delimit subcomponents in a path segment without being encoded for better readability + '%3B' => ';', + '%2C' => ',', + '%3D' => '=', + '%2B' => '+', + '%21' => '!', + '%2A' => '*', + '%7C' => '|', ); protected $routes; @@ -71,23 +95,19 @@ public function getContext() } /** - * Enables or disables the exception on incorrect parameters. - * - * @param Boolean $enabled + * {@inheritdoc} */ - public function setStrictParameters($enabled) + public function setStrictRequirements($enabled) { - $this->strictParameters = $enabled; + $this->strictRequirements = (Boolean) $enabled; } /** - * Gets the strict check of incorrect parameters. - * - * @return Boolean + * {@inheritdoc} */ - public function getStrictParameters() + public function isStrictRequirements() { - return $this->strictParameters; + return $this->strictRequirements; } /** @@ -131,7 +151,7 @@ protected function doGenerate($variables, $defaults, $requirements, $tokens, $pa // check requirement if ($tparams[$token[3]] && !preg_match('#^'.$token[2].'$#', $tparams[$token[3]])) { $message = sprintf('Parameter "%s" for route "%s" must match "%s" ("%s" given).', $token[3], $name, $token[2], $tparams[$token[3]]); - if ($this->strictParameters) { + if ($this->strictRequirements) { throw new InvalidParameterException($message); } @@ -144,7 +164,7 @@ protected function doGenerate($variables, $defaults, $requirements, $tokens, $pa } if (!$isEmpty || !$optional) { - $url = $token[1].strtr(rawurlencode($tparams[$token[3]]), $this->decodedChars).$url; + $url = $token[1].$tparams[$token[3]].$url; } $optional = false; @@ -155,18 +175,29 @@ protected function doGenerate($variables, $defaults, $requirements, $tokens, $pa } } - if (!$url) { + if ('' === $url) { $url = '/'; } + // do not encode the contexts base url as it is already encoded (see Symfony\Component\HttpFoundation\Request) + $url = $this->context->getBaseUrl().strtr(rawurlencode($url), $this->decodedChars); + + // the path segments "." and ".." are interpreted as relative reference when resolving a URI; see http://tools.ietf.org/html/rfc3986#section-3.3 + // so we need to encode them as they are not used for this purpose here + // otherwise we would generate a URI that, when followed by a user agent (e.g. browser), does not match this route + $url = strtr($url, array('/../' => '/%2E%2E/', '/./' => '/%2E/')); + if ('/..' === substr($url, -3)) { + $url = substr($url, 0, -2) . '%2E%2E'; + } elseif ('/.' === substr($url, -2)) { + $url = substr($url, 0, -1) . '%2E'; + } + // add a query string if needed $extra = array_diff_key($originParameters, $variables, $defaults); if ($extra && $query = http_build_query($extra, '', '&')) { $url .= '?'.$query; } - $url = $this->context->getBaseUrl().$url; - if ($this->context->getHost()) { $scheme = $this->context->getScheme(); if (isset($requirements['_scheme']) && ($req = strtolower($requirements['_scheme'])) && $scheme != $req) { diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Generator/UrlGeneratorInterface.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Generator/UrlGeneratorInterface.php index 220334f57e685bc2400557b6522da1543b5600db..e28c79d2d6ec3ef74f480184166074b2f589aa3d 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Generator/UrlGeneratorInterface.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Generator/UrlGeneratorInterface.php @@ -39,5 +39,5 @@ interface UrlGeneratorInterface extends RequestContextAwareInterface * * @api */ - function generate($name, $parameters = array(), $absolute = false); + public function generate($name, $parameters = array(), $absolute = false); } 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 6e5e2db9c76183c0ccfef2c384d600e17f699f52..3003dfdebb0253b465af61dae63afb3155f4167c 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/ApacheUrlMatcher.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/ApacheUrlMatcher.php @@ -34,6 +34,7 @@ class ApacheUrlMatcher extends UrlMatcher public function match($pathinfo) { $parameters = array(); + $defaults = array(); $allow = array(); $match = false; @@ -44,26 +45,28 @@ public function match($pathinfo) $name = substr($name, 9); } - if (0 === strpos($name, '_ROUTING_')) { + if (0 === strpos($name, '_ROUTING_DEFAULTS_')) { + $name = substr($name, 18); + $defaults[$name] = $value; + } elseif (0 === strpos($name, '_ROUTING_')) { $name = substr($name, 9); + if ('_route' == $name) { + $match = true; + $parameters[$name] = $value; + } elseif (0 === strpos($name, '_allow_')) { + $allow[] = substr($name, 7); + } else { + $parameters[$name] = $value; + } } else { continue; } - if ('_route' == $name) { - $match = true; - $parameters[$name] = $value; - } elseif (0 === strpos($name, '_allow_')) { - $allow[] = substr($name, 7); - } else { - $parameters[$name] = $value; - } - unset($_SERVER[$key]); } if ($match) { - return $parameters; + return $this->mergeDefaults($parameters, $defaults); } elseif (0 < count($allow)) { throw new MethodNotAllowedException($allow); } else { diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php index 6e0561dd5843978837ae14643b692038f3a0e1e5..102488cd5c467d548842871a2a73b4ca671e4840 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Routing\Matcher\Dumper; - /** * Dumps a set of Apache mod_rewrite rules. * @@ -75,7 +74,7 @@ public function dump(array $options = array()) $variables[] = 'E=_ROUTING_'.$variable.':%'.($i + 1); } foreach ($route->getDefaults() as $key => $value) { - $variables[] = 'E=_ROUTING_'.$key.':'.strtr($value, array( + $variables[] = 'E=_ROUTING_DEFAULTS_'.$key.':'.strtr($value, array( ':' => '\\:', '=' => '\\=', '\\' => '\\\\', @@ -140,7 +139,7 @@ public function dump(array $options = array()) * * @return string The escaped string */ - static private function escape($string, $char, $with) + private static function escape($string, $char, $with) { $escaped = false; $output = ''; diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/MatcherDumperInterface.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/MatcherDumperInterface.php index 08d03f5933a6ddcaf44c353c86cb955803d04727..f85e4ceff0a7778880b1f2c6d0b7be7eb6b5faea 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/MatcherDumperInterface.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/MatcherDumperInterface.php @@ -26,12 +26,12 @@ interface MatcherDumperInterface * * @return string Executable code */ - function dump(array $options = array()); + public function dump(array $options = array()); /** * Gets the routes to dump. * * @return RouteCollection A RouteCollection instance */ - function getRoutes(); + public function getRoutes(); } 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 a8e0dcb183a4316bce99d61127d318e8e6158993..72130544cefd2d0321c99cb00cb8f7e6f0346cc7 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 @@ -165,7 +165,7 @@ private function compileRoutes(RouteCollection $routes, $supportsRedirections, $ /** * Compiles a single Route to PHP code used to match it against the path info. * - * @param Route $routes A Route instance + * @param Route $route A Route instance * @param string $name The name of the Route * @param Boolean $supportsRedirections Whether redirections are supported by the base class * @param string|null $parentPrefix The prefix of the parent collection used to optimize the code diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/RedirectableUrlMatcher.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/RedirectableUrlMatcher.php index 8826c59854deec4d5a43c1029b0a3c1b0449866f..51e80057cd53b2b380d6ca2a68b3b8a88ea2e08c 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/RedirectableUrlMatcher.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/RedirectableUrlMatcher.php @@ -29,7 +29,7 @@ public function match($pathinfo) try { $parameters = parent::match($pathinfo); } catch (ResourceNotFoundException $e) { - if ('/' === substr($pathinfo, -1)) { + if ('/' === substr($pathinfo, -1) || !in_array($this->context->getMethod(), array('HEAD', 'GET'))) { throw $e; } diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/RedirectableUrlMatcherInterface.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/RedirectableUrlMatcherInterface.php index 7225c81cd54338240dcab6f73b5b5080051ca4cc..929ae9cc78fd8f08d83735155b0e46a7610ad4be 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/RedirectableUrlMatcherInterface.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/RedirectableUrlMatcherInterface.php @@ -31,5 +31,5 @@ interface RedirectableUrlMatcherInterface * * @api */ - function redirect($path, $route, $scheme = null); + public function redirect($path, $route, $scheme = null); } diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/RequestMatcherInterface.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/RequestMatcherInterface.php index 6a5c235ac0e6e11d13c6f80715f3f95c29665f59..b5def3d468ab3b32798e5686e5e866948db43068 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/RequestMatcherInterface.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/RequestMatcherInterface.php @@ -12,16 +12,15 @@ namespace Symfony\Component\Routing\Matcher; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\Routing\RequestContextAwareInterface; use Symfony\Component\Routing\Exception\ResourceNotFoundException; use Symfony\Component\Routing\Exception\MethodNotAllowedException; /** - * UrlMatcherInterface is the interface that all URL matcher classes must implement. + * RequestMatcherInterface is the interface that all request matcher classes must implement. * * @author Fabien Potencier <fabien@symfony.com> */ -interface RequestMatcherInterface extends RequestContextAwareInterface +interface RequestMatcherInterface { /** * Tries to match a request with a set of routes. @@ -36,5 +35,5 @@ interface RequestMatcherInterface extends RequestContextAwareInterface * @throws ResourceNotFoundException If no matching resource could be found * @throws MethodNotAllowedException If a matching resource was found but the request method is not allowed */ - function matchRequest(Request $request); + public function matchRequest(Request $request); } diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/UrlMatcher.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/UrlMatcher.php index 33c7f54c18199aeef05c8d3b70b6cd7b3d228e3c..c417d946d77e030139086d9d293cb5948ca2b747 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/UrlMatcher.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/UrlMatcher.php @@ -151,25 +151,25 @@ protected function matchCollection($pathinfo, RouteCollection $routes) * * @param string $pathinfo The path * @param string $name The route name - * @param string $route The route + * @param Route $route The route * * @return array The first element represents the status, the second contains additional information */ protected function handleRouteRequirements($pathinfo, $name, Route $route) { - // check HTTP scheme requirement - $scheme = $route->getRequirement('_scheme'); - $status = $scheme && $scheme !== $this->context->getScheme() ? self::REQUIREMENT_MISMATCH : self::REQUIREMENT_MATCH; + // check HTTP scheme requirement + $scheme = $route->getRequirement('_scheme'); + $status = $scheme && $scheme !== $this->context->getScheme() ? self::REQUIREMENT_MISMATCH : self::REQUIREMENT_MATCH; - return array($status, null); + return array($status, null); } /** * Get merged default parameters. - * + * * @param array $params The parameters * @param array $defaults The defaults - * + * * @return array Merged default parameters */ protected function mergeDefaults($params, $defaults) diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/UrlMatcherInterface.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/UrlMatcherInterface.php index afccf8009eee3a6d90a59ea03f7b7179e3197e59..dd718b156983b8eb656c773b56027a466b54f069 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/UrlMatcherInterface.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/UrlMatcherInterface.php @@ -25,7 +25,7 @@ interface UrlMatcherInterface extends RequestContextAwareInterface { /** - * Tries to match a URL with a set of routes. + * Tries to match a URL path with a set of routes. * * If the matcher can not find information, it must throw one of the exceptions documented * below. @@ -39,5 +39,5 @@ interface UrlMatcherInterface extends RequestContextAwareInterface * * @api */ - function match($pathinfo); + public function match($pathinfo); } diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/RequestContextAwareInterface.php b/core/vendor/symfony/routing/Symfony/Component/Routing/RequestContextAwareInterface.php index 8357b52f93de2811694b621a0f99d28c9d16924a..daf52549dda00c3db2b97e02ec841b4b224645a2 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/RequestContextAwareInterface.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/RequestContextAwareInterface.php @@ -23,7 +23,7 @@ interface RequestContextAwareInterface * * @api */ - function setContext(RequestContext $context); + public function setContext(RequestContext $context); /** * Gets the request context. @@ -32,5 +32,5 @@ function setContext(RequestContext $context); * * @api */ - function getContext(); + public function getContext(); } diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Route.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Route.php index f18b0ed7570e99f0a82c12065578c6557106e4bb..318426a0db09cafbcd956eea6674321c52a48c1e 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Route.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Route.php @@ -18,7 +18,7 @@ * * @api */ -class Route +class Route implements \Serializable { private $pattern; private $defaults; @@ -26,7 +26,7 @@ class Route private $options; private $compiled; - static private $compilers = array(); + private static $compilers = array(); /** * Constructor. @@ -55,6 +55,25 @@ public function __clone() $this->compiled = null; } + public function serialize() + { + return serialize(array( + 'pattern' => $this->pattern, + 'defaults' => $this->defaults, + 'requirements' => $this->requirements, + 'options' => $this->options, + )); + } + + public function unserialize($data) + { + $data = unserialize($data); + $this->pattern = $data['pattern']; + $this->defaults = $data['defaults']; + $this->requirements = $data['requirements']; + $this->options = $data['options']; + } + /** * Returns the pattern. * diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/RouteCollection.php b/core/vendor/symfony/routing/Symfony/Component/Routing/RouteCollection.php index 85acf331bae9a86645ad3ce1e8573707677f80fe..7a0e4c906acec69bc7b6d7148059e26f7b5045c7 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/RouteCollection.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/RouteCollection.php @@ -24,7 +24,7 @@ * * @api */ -class RouteCollection implements \IteratorAggregate +class RouteCollection implements \IteratorAggregate, \Countable { private $routes; private $resources; @@ -88,6 +88,21 @@ public function getIterator() return new \ArrayIterator($this->routes); } + /** + * Gets the number of Routes in this collection. + * + * @return int The number of routes in this collection, including nested collections + */ + public function count() + { + $count = 0; + foreach ($this->routes as $route) { + $count += $route instanceof RouteCollection ? count($route) : 1; + } + + return $count; + } + /** * Adds a route. * @@ -293,7 +308,7 @@ private function removeRecursively($name) { // It is ensured by the adders (->add and ->addCollection) that there can // only be one route per name in all connected collections. So we can stop - // interating recursively on the first hit. + // iterating recursively on the first hit. if (isset($this->routes[$name])) { unset($this->routes[$name]); diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/RouteCompilerInterface.php b/core/vendor/symfony/routing/Symfony/Component/Routing/RouteCompilerInterface.php index 5193665629ee38bf4e2a9790ea93eff7fac91bbb..f72e9e5ef4231606b10bb5201e3d01d4c7394b88 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/RouteCompilerInterface.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/RouteCompilerInterface.php @@ -25,5 +25,5 @@ interface RouteCompilerInterface * * @return CompiledRoute A CompiledRoute instance */ - function compile(Route $route); + public function compile(Route $route); } diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Router.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Router.php index 2e0333e6734ea54c5b104542955b24a6ac107218..f617a60b559e33c78a04a5703eb6b2285a84dba7 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Router.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Router.php @@ -14,6 +14,7 @@ use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\Config\ConfigCache; use Symfony\Component\HttpKernel\Log\LoggerInterface; +use Symfony\Component\Routing\Generator\ConfigurableRequirementsInterface; /** * The Router class is an example of the integration of all pieces of the @@ -77,7 +78,7 @@ public function setOptions(array $options) 'matcher_dumper_class' => 'Symfony\\Component\\Routing\\Matcher\\Dumper\\PhpMatcherDumper', 'matcher_cache_class' => 'ProjectUrlMatcher', 'resource_type' => null, - 'strict_parameters' => true, + 'strict_requirements' => true, ); // check option names and live merge, if errors are encountered Exception will be thrown @@ -244,8 +245,8 @@ public function getGenerator() $this->generator = new $class($this->context, $this->logger); } - if (false === $this->options['strict_parameters']) { - $this->generator->setStrictParameters(false); + if ($this->generator instanceof ConfigurableRequirementsInterface) { + $this->generator->setStrictRequirements($this->options['strict_requirements']); } return $this->generator; diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/RouterInterface.php b/core/vendor/symfony/routing/Symfony/Component/Routing/RouterInterface.php index 529a85f2e9e2e946692102b71f9a9789bf590987..a10ae34e07451b6a16949e030922c8ff005cd741 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/RouterInterface.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/RouterInterface.php @@ -28,5 +28,5 @@ interface RouterInterface extends UrlMatcherInterface, UrlGeneratorInterface * * @return RouteCollection A RouteCollection instance */ - function getRouteCollection(); + public function getRouteCollection(); } diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Annotation/RouteTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Annotation/RouteTest.php index dc080db6ffbaa4eca845de933a96b076df7d8fa8..ff3c20c26d99fde10685dc0ca2cf48a3d1fa01f6 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Annotation/RouteTest.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Annotation/RouteTest.php @@ -43,4 +43,3 @@ public function getValidParameters() ); } } - diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.apache b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.apache index 25f6060fdd330764663c58416f18f5aeabf037bf..ea17bca529e9ed0bd24ea3fb816f5ca6a5b39890 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.apache +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.apache @@ -4,7 +4,11 @@ RewriteRule .* - [QSA,L] # foo RewriteCond %{REQUEST_URI} ^/foo/(baz|symfony)$ -RewriteRule .* app.php [QSA,L,E=_ROUTING__route:foo,E=_ROUTING_bar:%1,E=_ROUTING_def:test] +RewriteRule .* app.php [QSA,L,E=_ROUTING__route:foo,E=_ROUTING_bar:%1,E=_ROUTING_DEFAULTS_def:test] + +# foobar +RewriteCond %{REQUEST_URI} ^/foo(?:/([^/]+))?$ +RewriteRule .* app.php [QSA,L,E=_ROUTING__route:foobar,E=_ROUTING_bar:%1,E=_ROUTING_DEFAULTS_bar:toto] # bar RewriteCond %{REQUEST_URI} ^/bar/([^/]+)$ @@ -58,7 +62,7 @@ RewriteRule .* app.php [QSA,L,E=_ROUTING__route:baz5unsafe,E=_ROUTING_foo:%1] # baz6 RewriteCond %{REQUEST_URI} ^/test/baz$ -RewriteRule .* app.php [QSA,L,E=_ROUTING__route:baz6,E=_ROUTING_foo:bar\ baz] +RewriteRule .* app.php [QSA,L,E=_ROUTING__route:baz6,E=_ROUTING_DEFAULTS_foo:bar\ baz] # baz7 RewriteCond %{REQUEST_URI} ^/te\ st/baz$ diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php index 53e86fa3644185fc727749f5cb7869be40c81692..2558b2d9f35ee481f4c5ac9d3b793a5fce8cf1a1 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php @@ -139,9 +139,9 @@ public function match($pathinfo) } - // overriden + // overridden if (preg_match('#^/a/(?<var>.*)$#s', $pathinfo, $matches)) { - $matches['_route'] = 'overriden'; + $matches['_route'] = 'overridden'; return $matches; } @@ -171,9 +171,9 @@ public function match($pathinfo) return array_merge($this->mergeDefaults($matches, array ( 'who' => 'World!',)), array('_route' => 'helloWorld')); } - // overriden2 + // overridden2 if ($pathinfo === '/multi/new') { - return array('_route' => 'overriden2'); + return array('_route' => 'overridden2'); } // hey diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php index a3c105cc8be565f6a3ce08f5bd791a6723a2b0ca..ad1476edccc5b2ede0c4c1c25bcc9ed7415777fa 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php @@ -147,9 +147,9 @@ public function match($pathinfo) } - // overriden + // overridden if (preg_match('#^/a/(?<var>.*)$#s', $pathinfo, $matches)) { - $matches['_route'] = 'overriden'; + $matches['_route'] = 'overridden'; return $matches; } @@ -179,9 +179,9 @@ public function match($pathinfo) return array_merge($this->mergeDefaults($matches, array ( 'who' => 'World!',)), array('_route' => 'helloWorld')); } - // overriden2 + // overridden2 if ($pathinfo === '/multi/new') { - return array('_route' => 'overriden2'); + return array('_route' => 'overridden2'); } // hey diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/validpattern.yml b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/validpattern.yml index e645d9b6ec0479ffcd50663cbac63e9130b25bbf..d5136cbab8031e94e2ea1d0a30b3e5fb12c2d7c3 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/validpattern.yml +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/validpattern.yml @@ -3,4 +3,3 @@ blog_show: defaults: { _controller: MyBlogBundle:Blog:show } options: compiler_class: RouteCompiler - diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php index b9a116f45483c530b3974095ff4797a954a6068e..69c06a44ea71ae9da1825a677712d95491ed7f84 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php @@ -169,7 +169,7 @@ public function testGenerateForRouteWithInvalidOptionalParameterNonStrict() { $routes = $this->getRoutes('test', new Route('/testing/{foo}', array('foo' => '1'), array('foo' => 'd+'))); $generator = $this->getGenerator($routes); - $generator->setStrictParameters(false); + $generator->setStrictRequirements(false); $this->assertNull($generator->generate('test', array('foo' => 'bar'), true)); } @@ -184,14 +184,14 @@ public function testGenerateForRouteWithInvalidOptionalParameterNonStrictWithLog $logger->expects($this->once()) ->method('err'); $generator = $this->getGenerator($routes, array(), $logger); - $generator->setStrictParameters(false); + $generator->setStrictRequirements(false); $this->assertNull($generator->generate('test', array('foo' => 'bar'), true)); } /** * @expectedException Symfony\Component\Routing\Exception\InvalidParameterException */ - public function testGenerateForRouteWithInvalidManditoryParameter() + public function testGenerateForRouteWithInvalidMandatoryParameter() { $routes = $this->getRoutes('test', new Route('/testing/{foo}', array(), array('foo' => 'd+'))); $this->getGenerator($routes)->generate('test', array('foo' => 'bar'), true); @@ -229,6 +229,32 @@ public function testWithAnIntegerAsADefaultValue() $this->assertEquals('/app.php/foo', $this->getGenerator($routes)->generate('test', array('default' => 'foo'))); } + public function testUrlEncoding() + { + // This tests the encoding of reserved characters that are used for delimiting of URI components (defined in RFC 3986) + // and other special ASCII chars. These chars are tested as static text path, variable path and query param. + $chars = '@:[]/()*\'" +,;-._~&$<>|{}%\\^`!?foo=bar#id'; + $routes = $this->getRoutes('test', new Route("/$chars/{varpath}", array(), array('varpath' => '.+'))); + $this->assertSame('/app.php/@:%5B%5D/%28%29*%27%22%20+,;-._~%26%24%3C%3E|%7B%7D%25%5C%5E%60!%3Ffoo=bar%23id' + . '/@:%5B%5D/%28%29*%27%22%20+,;-._~%26%24%3C%3E|%7B%7D%25%5C%5E%60!%3Ffoo=bar%23id' + . '?query=%40%3A%5B%5D%2F%28%29%2A%27%22+%2B%2C%3B-._%7E%26%24%3C%3E%7C%7B%7D%25%5C%5E%60%21%3Ffoo%3Dbar%23id', + $this->getGenerator($routes)->generate('test', array( + 'varpath' => $chars, + 'query' => $chars + )) + ); + } + + public function testEncodingOfRelativePathSegments() + { + $routes = $this->getRoutes('test', new Route('/dir/../dir/..')); + $this->assertSame('/app.php/dir/%2E%2E/dir/%2E%2E', $this->getGenerator($routes)->generate('test')); + $routes = $this->getRoutes('test', new Route('/dir/./dir/.')); + $this->assertSame('/app.php/dir/%2E/dir/%2E', $this->getGenerator($routes)->generate('test')); + $routes = $this->getRoutes('test', new Route('/a./.a/a../..a/...')); + $this->assertSame('/app.php/a./.a/a../..a/...', $this->getGenerator($routes)->generate('test')); + } + protected function getGenerator(RouteCollection $routes, array $parameters = array(), $logger = null) { $context = new RequestContext('/app.php'); diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/AbstractAnnotationLoaderTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/AbstractAnnotationLoaderTest.php index a30555b8c68f6c4af715ff731817f056f72f29ad..c927ae4a85fee4ae21b79cdd2ddd114de01b5bbd 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/AbstractAnnotationLoaderTest.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/AbstractAnnotationLoaderTest.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Routing\Tests\Loader; - abstract class AbstractAnnotationLoaderTest extends \PHPUnit_Framework_TestCase { protected function setUp() 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 f4b30e3262e4c88e07b5eff3bcdfade0e33e2839..74c38737f2f9afcc0cc1c3667e96e0073b38d525 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 @@ -50,4 +50,3 @@ public function testLoadWithRoute() $this->assertEquals('RouteCompiler', $route->getOption('compiler_class')); } } - diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/ApacheUrlMatcherTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/ApacheUrlMatcherTest.php index e68b61804cca0746999eee848941e5d8a908d1da..88487201cc31ea4430e0d63aee77b12106cce119 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/ApacheUrlMatcherTest.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/ApacheUrlMatcherTest.php @@ -17,6 +17,18 @@ class ApacheUrlMatcherTest extends \PHPUnit_Framework_TestCase { + protected $server; + + protected function setUp() + { + $this->server = $_SERVER; + } + + protected function tearDown() + { + $_SERVER = $this->server; + } + /** * @dataProvider getMatchData */ @@ -49,6 +61,35 @@ public function getMatchData() 'name' => 'world', ), ), + array( + 'Route with params and defaults', + '/hello/hugo', + array( + '_ROUTING__route' => 'hello', + '_ROUTING__controller' => 'AcmeBundle:Default:index', + '_ROUTING_name' => 'hugo', + '_ROUTING_DEFAULTS_name' => 'world', + ), + array( + 'name' => 'hugo', + '_route' => 'hello', + '_controller' => 'AcmeBundle:Default:index', + ), + ), + array( + 'Route with defaults only', + '/hello', + array( + '_ROUTING__route' => 'hello', + '_ROUTING__controller' => 'AcmeBundle:Default:index', + '_ROUTING_DEFAULTS_name' => 'world', + ), + array( + 'name' => 'world', + '_route' => 'hello', + '_controller' => 'AcmeBundle:Default:index', + ), + ), array( 'REDIRECT_ envs', '/hello/world', @@ -66,4 +107,3 @@ public function getMatchData() ); } } - diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/Dumper/ApacheMatcherDumperTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/Dumper/ApacheMatcherDumperTest.php index 65cb454bee151c5c407c2e7156a753bf2ff0fd89..2847564b90ed887dec44c012b995b1b4c61a3e86 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/Dumper/ApacheMatcherDumperTest.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/Dumper/ApacheMatcherDumperTest.php @@ -17,9 +17,9 @@ class ApacheMatcherDumperTest extends \PHPUnit_Framework_TestCase { - static protected $fixturesPath; + protected static $fixturesPath; - static public function setUpBeforeClass() + public static function setUpBeforeClass() { self::$fixturesPath = realpath(__DIR__.'/../../Fixtures/'); } @@ -70,6 +70,11 @@ private function getRouteCollection() array('def' => 'test'), array('bar' => 'baz|symfony') )); + // defaults parameters in pattern + $collection->add('foobar', new Route( + '/foo/{bar}', + array('bar' => 'toto') + )); // method requirement $collection->add('bar', new Route( '/bar/{foo}', diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php index 3677c7e324eb9b5165a287c053f93e32665e83e6..ee113851cd33e3b06f6cda8a0e0688b80c962d5e 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php @@ -14,7 +14,6 @@ use Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper; use Symfony\Component\Routing\Route; use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Routing\RequestContext; class PhpMatcherDumperTest extends \PHPUnit_Framework_TestCase { @@ -51,7 +50,7 @@ public function getRouteCollections() $collection = new RouteCollection(); - $collection->add('overriden', new Route('/overriden')); + $collection->add('overridden', new Route('/overridden')); // defaults and requirements $collection->add('foo', new Route( @@ -117,25 +116,25 @@ public function getRouteCollections() // prefixes $collection1 = new RouteCollection(); - $collection1->add('overriden', new Route('/overriden1')); + $collection1->add('overridden', new Route('/overridden1')); $collection1->add('foo1', new Route('/{foo}')); $collection1->add('bar1', new Route('/{bar}')); $collection2 = new RouteCollection(); $collection2->addCollection($collection1, '/b\'b'); - $collection2->add('overriden', new Route('/{var}', array(), array('var' => '.*'))); + $collection2->add('overridden', new Route('/{var}', array(), array('var' => '.*'))); $collection1 = new RouteCollection(); $collection1->add('foo2', new Route('/{foo1}')); $collection1->add('bar2', new Route('/{bar1}')); $collection2->addCollection($collection1, '/b\'b'); $collection->addCollection($collection2, '/a'); - // overriden through addCollection() and multiple sub-collections with no own prefix + // overridden through addCollection() and multiple sub-collections with no own prefix $collection1 = new RouteCollection(); - $collection1->add('overriden2', new Route('/old')); + $collection1->add('overridden2', new Route('/old')); $collection1->add('helloWorld', new Route('/hello/{who}', array('who' => 'World!'))); $collection2 = new RouteCollection(); $collection3 = new RouteCollection(); - $collection3->add('overriden2', new Route('/new')); + $collection3->add('overridden2', new Route('/new')); $collection3->add('hey', new Route('/hey/')); $collection1->addCollection($collection2); $collection2->addCollection($collection3); diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php index 43c958b1502fc944fb72a838e4a7e1f7387aea12..b8ab2647ffd05d5f8eb36395f2a69c068057fefe 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php @@ -27,6 +27,20 @@ public function testRedirectWhenNoSlash() $matcher->match('/foo'); } + /** + * @expectedException Symfony\Component\Routing\Exception\ResourceNotFoundException + */ + public function testRedirectWhenNoSlashForNonSafeMethod() + { + $coll = new RouteCollection(); + $coll->add('foo', new Route('/foo/')); + + $context = new RequestContext(); + $context->setMethod('POST'); + $matcher = $this->getMockForAbstractClass('Symfony\Component\Routing\Matcher\RedirectableUrlMatcher', array($coll, $context)); + $matcher->match('/foo'); + } + public function testSchemeRedirect() { $coll = new RouteCollection(); 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 77d1f2087ff6fe45938f9f0af61d53705a2ae926..31069b2af7f1104f0f1ab0fde14e2722c20480c8 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 @@ -178,7 +178,7 @@ public function testMatchWithDotMetacharacterInRequirements() $this->assertEquals(array('_route' => 'foo', 'foo' => "\n"), $matcher->match('/'.urlencode("\n").'/bar'), 'linefeed character is matched'); } - public function testMatchOverridenRoute() + public function testMatchOverriddenRoute() { $collection = new RouteCollection(); $collection->add('foo', new Route('/foo')); diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/RouteCollectionTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/RouteCollectionTest.php index aee0f9d68118198b6de315a0d02705f372b17e6a..792e65daccfac78a5a4eec1fc30c8011d6933e79 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/RouteCollectionTest.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/RouteCollectionTest.php @@ -37,7 +37,7 @@ public function testAddInvalidRoute() $collection->add('f o o', $route); } - public function testOverridenRoute() + public function testOverriddenRoute() { $collection = new RouteCollection(); $collection->add('foo', new Route('/foo')); @@ -46,7 +46,7 @@ public function testOverridenRoute() $this->assertEquals('/foo1', $collection->get('foo')->getPattern()); } - public function testDeepOverridenRoute() + public function testDeepOverriddenRoute() { $collection = new RouteCollection(); $collection->add('foo', new Route('/foo')); @@ -64,7 +64,7 @@ public function testDeepOverridenRoute() $this->assertEquals('/foo2', $collection->get('foo')->getPattern()); } - public function testIteratorWithOverridenRoutes() + public function testIteratorWithOverriddenRoutes() { $collection = new RouteCollection(); $collection->add('foo', new Route('/foo')); @@ -76,6 +76,18 @@ public function testIteratorWithOverridenRoutes() $this->assertEquals('/foo1', $this->getFirstNamedRoute($collection, 'foo')->getPattern()); } + public function testCount() + { + $collection = new RouteCollection(); + $collection->add('foo', new Route('/foo')); + + $collection1 = new RouteCollection(); + $collection->addCollection($collection1); + $collection1->add('foo1', new Route('/foo1')); + + $this->assertCount(2, $collection); + } + protected function getFirstNamedRoute(RouteCollection $routeCollection, $name) { foreach ($routeCollection as $key => $route) { diff --git a/core/vendor/symfony/yaml/Symfony/Component/Yaml/Escaper.php b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Escaper.php index 81a7d5fe1bf20287482218b3fa49ce85b5cb6ba0..fe9f33ff0f6a5ce85bb19dd0fcd1369ef3bfaa2c 100644 --- a/core/vendor/symfony/yaml/Symfony/Component/Yaml/Escaper.php +++ b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Escaper.php @@ -25,13 +25,13 @@ class Escaper // first to ensure proper escaping because str_replace operates iteratively // on the input arrays. This ordering of the characters avoids the use of strtr, // which performs more slowly. - static private $escapees = array('\\\\', '\\"', + private static $escapees = array('\\\\', '\\"', "\x00", "\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", "\x08", "\x09", "\x0a", "\x0b", "\x0c", "\x0d", "\x0e", "\x0f", "\x10", "\x11", "\x12", "\x13", "\x14", "\x15", "\x16", "\x17", "\x18", "\x19", "\x1a", "\x1b", "\x1c", "\x1d", "\x1e", "\x1f", "\xc2\x85", "\xc2\xa0", "\xe2\x80\xa8", "\xe2\x80\xa9"); - static private $escaped = array('\\"', '\\\\', + private static $escaped = array('\\"', '\\\\', "\\0", "\\x01", "\\x02", "\\x03", "\\x04", "\\x05", "\\x06", "\\a", "\\b", "\\t", "\\n", "\\v", "\\f", "\\r", "\\x0e", "\\x0f", "\\x10", "\\x11", "\\x12", "\\x13", "\\x14", "\\x15", "\\x16", "\\x17", @@ -45,7 +45,7 @@ class Escaper * * @return Boolean True if the value would require double quotes. */ - static public function requiresDoubleQuoting($value) + public static function requiresDoubleQuoting($value) { return preg_match('/'.self::REGEX_CHARACTER_TO_ESCAPE.'/u', $value); } @@ -57,7 +57,7 @@ static public function requiresDoubleQuoting($value) * * @return string The quoted, escaped string */ - static public function escapeWithDoubleQuotes($value) + public static function escapeWithDoubleQuotes($value) { return sprintf('"%s"', str_replace(self::$escapees, self::$escaped, $value)); } @@ -69,7 +69,7 @@ static public function escapeWithDoubleQuotes($value) * * @return Boolean True if the value would require single quotes. */ - static public function requiresSingleQuoting($value) + public static function requiresSingleQuoting($value) { return preg_match('/[ \s \' " \: \{ \} \[ \] , & \* \# \?] | \A[ - ? | < > = ! % @ ` ]/x', $value); } @@ -81,7 +81,7 @@ static public function requiresSingleQuoting($value) * * @return string The quoted, escaped string */ - static public function escapeWithSingleQuotes($value) + public static function escapeWithSingleQuotes($value) { return sprintf("'%s'", str_replace('\'', '\'\'', $value)); } diff --git a/core/vendor/symfony/yaml/Symfony/Component/Yaml/Inline.php b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Inline.php index 8bcfcda62b9ae331e1b94f3884eb67c1a29e3af2..df8928577c3c8d8c49234d90ceabf57d9c0eb7fe 100644 --- a/core/vendor/symfony/yaml/Symfony/Component/Yaml/Inline.php +++ b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Inline.php @@ -29,7 +29,7 @@ class Inline * * @return array A PHP array representing the YAML string */ - static public function parse($value) + public static function parse($value) { $value = trim($value); @@ -75,7 +75,7 @@ static public function parse($value) * * @throws DumpException When trying to dump PHP resource */ - static public function dump($value) + public static function dump($value) { switch (true) { case is_resource($value): @@ -125,7 +125,7 @@ static public function dump($value) * * @return string The YAML string representing the PHP array */ - static private function dumpArray($value) + private static function dumpArray($value) { // array $keys = array_keys($value); @@ -162,7 +162,7 @@ static private function dumpArray($value) * * @throws ParseException When malformed inline YAML string is parsed */ - static public function parseScalar($scalar, $delimiters = null, $stringDelimiters = array('"', "'"), &$i = 0, $evaluate = true) + public static function parseScalar($scalar, $delimiters = null, $stringDelimiters = array('"', "'"), &$i = 0, $evaluate = true) { if (in_array($scalar[$i], $stringDelimiters)) { // quoted scalar @@ -207,7 +207,7 @@ static public function parseScalar($scalar, $delimiters = null, $stringDelimiter * * @throws ParseException When malformed inline YAML string is parsed */ - static private function parseQuotedScalar($scalar, &$i) + private static function parseQuotedScalar($scalar, &$i) { // Only check the current item we're dealing with (for sequences) $subject = substr($scalar, $i); @@ -242,7 +242,7 @@ static private function parseQuotedScalar($scalar, &$i) * * @throws ParseException When malformed inline YAML string is parsed */ - static private function parseSequence($sequence, &$i = 0) + private static function parseSequence($sequence, &$i = 0) { $output = array(); $len = strlen($sequence); @@ -298,7 +298,7 @@ static private function parseSequence($sequence, &$i = 0) * * @throws ParseException When malformed inline YAML string is parsed */ - static private function parseMapping($mapping, &$i = 0) + private static function parseMapping($mapping, &$i = 0) { $output = array(); $len = strlen($mapping); @@ -359,7 +359,7 @@ static private function parseMapping($mapping, &$i = 0) * * @return string A YAML string */ - static private function evaluateScalar($scalar) + private static function evaluateScalar($scalar) { $scalar = trim($scalar); @@ -404,7 +404,7 @@ static private function evaluateScalar($scalar) * * @return string The regular expression */ - static private function getTimestampRegex() + private static function getTimestampRegex() { return <<<EOF ~^ diff --git a/core/vendor/symfony/yaml/Symfony/Component/Yaml/Parser.php b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Parser.php index 76d1926b9473dc022eb8b8a790702b7420415e46..f28d89b7e0cb1246aa532066b00a8975fefc6d70 100644 --- a/core/vendor/symfony/yaml/Symfony/Component/Yaml/Parser.php +++ b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Parser.php @@ -60,6 +60,7 @@ public function parse($value) } $data = array(); + $context = null; while ($this->moveToNextLine()) { if ($this->isCurrentLineEmpty()) { continue; @@ -72,6 +73,11 @@ public function parse($value) $isRef = $isInPlace = $isProcessed = false; if (preg_match('#^\-((?P<leadspaces>\s+)(?P<value>.+?))?\s*$#u', $this->currentLine, $values)) { + if ($context && 'mapping' == $context) { + throw new ParseException('You cannot define a sequence item when in a mapping'); + } + $context = 'sequence'; + if (isset($values['value']) && preg_match('#^&(?P<ref>[^ ]+) *(?P<value>.*)#u', $values['value'], $matches)) { $isRef = $matches['ref']; $values['value'] = $matches['value']; @@ -104,6 +110,11 @@ public function parse($value) } } } elseif (preg_match('#^(?P<key>'.Inline::REGEX_QUOTED_STRING.'|[^ \'"\[\{].*?) *\:(\s+(?P<value>.+?))?\s*$#u', $this->currentLine, $values)) { + if ($context && 'sequence' == $context) { + throw new ParseException('You cannot define a mapping item when in a sequence'); + } + $context = 'mapping'; + try { $key = Inline::parseScalar($values['key']); } catch (ParseException $e) { diff --git a/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/YtsErrorTests.yml b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/YtsErrorTests.yml index 753d82947b8c65d35b3f5290d6c9104cb4dc1697..e8506fcb66bb31afdced90f8a1277c8828cfab9a 100644 --- a/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/YtsErrorTests.yml +++ b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/YtsErrorTests.yml @@ -23,4 +23,3 @@ yaml: | secondline: 2 php: | array('foo' => null, 'firstline' => 1, 'secondline' => 2) - diff --git a/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/embededPhp.yml b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/embededPhp.yml new file mode 100644 index 0000000000000000000000000000000000000000..ec456ed09fb38097b0fa6e0a7d9fdd61c37637f3 --- /dev/null +++ b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/embededPhp.yml @@ -0,0 +1 @@ +value: <?php echo 1 + 2 + 3 ?> diff --git a/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/ParserTest.php b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/ParserTest.php index 6b4e2d482bfacc8d23c60d49c8382d569ced4490..e27482a694791ac358d237fd1efe3939e053be8b 100644 --- a/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/ParserTest.php +++ b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/ParserTest.php @@ -160,6 +160,31 @@ public function testUnindentedCollectionException() $this->parser->parse($yaml); } + /** + * @expectedException Symfony\Component\Yaml\Exception\ParseException + */ + public function testSequenceInAMapping() + { + Yaml::parse(<<<EOF +yaml: + hash: me + - array stuff +EOF + ); + } + + /** + * @expectedException Symfony\Component\Yaml\Exception\ParseException + */ + public function testMappingInASequence() + { + Yaml::parse(<<<EOF +yaml: + - array stuff + hash: me +EOF + ); + } } class B diff --git a/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/YamlTest.php b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/YamlTest.php new file mode 100644 index 0000000000000000000000000000000000000000..b1a9ba08c1f69590146a5bc73064b5a30d5e6574 --- /dev/null +++ b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/YamlTest.php @@ -0,0 +1,41 @@ +<?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\Yaml\Tests; + +use Symfony\Component\Yaml\Yaml; + +class YamlTest extends \PHPUnit_Framework_TestCase +{ + + public function testParseAndDump() + { + $data = array('lorem' => 'ipsum', 'dolor' => 'sit'); + $yml = Yaml::dump($data); + $parsed = Yaml::parse($yml); + $this->assertEquals($data, $parsed); + + $filename = __DIR__.'/Fixtures/index.yml'; + $contents = file_get_contents($filename); + $parsedByFilename = Yaml::parse($filename); + $parsedByContents = Yaml::parse($contents); + $this->assertEquals($parsedByFilename, $parsedByContents); + } + + public function testEmbededPhp() + { + $filename = __DIR__.'/Fixtures/embededPhp.yml'; + Yaml::enablePhpParsing(); + $parsed = Yaml::parse($filename); + $this->assertEquals(array('value' => 6), $parsed); + } + +} diff --git a/core/vendor/symfony/yaml/Symfony/Component/Yaml/Unescaper.php b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Unescaper.php index 0061dfdcc352d9168971b616de08e09c09daaf58..ac3a576b677bcb53a7afd187fa4c3760c4d68619 100644 --- a/core/vendor/symfony/yaml/Symfony/Component/Yaml/Unescaper.php +++ b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Unescaper.php @@ -48,7 +48,7 @@ public function unescapeSingleQuotedString($value) public function unescapeDoubleQuotedString($value) { $self = $this; - $callback = function($match) use($self) { + $callback = function($match) use ($self) { return $self->unescapeCharacter($match[0]); }; diff --git a/core/vendor/symfony/yaml/Symfony/Component/Yaml/Yaml.php b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Yaml.php index 29e941343e44659934db362e6a1b454192594340..d35e67d62c020925f1a9668833fbae4948c1c2ab 100644 --- a/core/vendor/symfony/yaml/Symfony/Component/Yaml/Yaml.php +++ b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Yaml.php @@ -22,9 +22,9 @@ */ class Yaml { - static public $enablePhpParsing = false; + public static $enablePhpParsing = false; - static public function enablePhpParsing() + public static function enablePhpParsing() { self::$enablePhpParsing = true; } @@ -49,7 +49,7 @@ static public function enablePhpParsing() * * @api */ - static public function parse($input) + public static function parse($input) { // if input is a file, process it $file = ''; @@ -102,7 +102,7 @@ static public function parse($input) * * @api */ - static public function dump($array, $inline = 2) + public static function dump($array, $inline = 2) { $yaml = new Dumper();