Security update to Drupal 8.4.6 t2
authorJeff Veit <jeff.veit@gmail.com>
Fri, 30 Mar 2018 16:43:30 +0000 (17:43 +0100)
committerJeff Veit <jeff.veit@gmail.com>
Fri, 30 Mar 2018 16:43:30 +0000 (17:43 +0100)
133 files changed:
composer.json
composer.lock
vendor/composer/installed.json
vendor/doctrine/annotations/CHANGELOG.md
vendor/doctrine/annotations/composer.json
vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php
vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationRegistry.php
vendor/doctrine/annotations/phpstan.neon
vendor/doctrine/cache/.coveralls.yml [deleted file]
vendor/doctrine/cache/.gitignore [deleted file]
vendor/doctrine/cache/.travis.yml [deleted file]
vendor/doctrine/cache/README.md
vendor/doctrine/cache/build.properties [deleted file]
vendor/doctrine/cache/build.xml [deleted file]
vendor/doctrine/cache/composer.json
vendor/doctrine/cache/lib/Doctrine/Common/Cache/ApcCache.php
vendor/doctrine/cache/lib/Doctrine/Common/Cache/ApcuCache.php
vendor/doctrine/cache/lib/Doctrine/Common/Cache/CacheProvider.php
vendor/doctrine/cache/lib/Doctrine/Common/Cache/ChainCache.php
vendor/doctrine/cache/lib/Doctrine/Common/Cache/CouchbaseCache.php
vendor/doctrine/cache/lib/Doctrine/Common/Cache/ExtMongoDBCache.php [new file with mode: 0644]
vendor/doctrine/cache/lib/Doctrine/Common/Cache/FileCache.php
vendor/doctrine/cache/lib/Doctrine/Common/Cache/LegacyMongoDBCache.php [new file with mode: 0644]
vendor/doctrine/cache/lib/Doctrine/Common/Cache/MemcacheCache.php
vendor/doctrine/cache/lib/Doctrine/Common/Cache/MemcachedCache.php
vendor/doctrine/cache/lib/Doctrine/Common/Cache/MongoDBCache.php
vendor/doctrine/cache/lib/Doctrine/Common/Cache/MultiDeleteCache.php [new file with mode: 0644]
vendor/doctrine/cache/lib/Doctrine/Common/Cache/MultiGetCache.php
vendor/doctrine/cache/lib/Doctrine/Common/Cache/MultiOperationCache.php [new file with mode: 0644]
vendor/doctrine/cache/lib/Doctrine/Common/Cache/MultiPutCache.php
vendor/doctrine/cache/lib/Doctrine/Common/Cache/PhpFileCache.php
vendor/doctrine/cache/lib/Doctrine/Common/Cache/PredisCache.php
vendor/doctrine/cache/lib/Doctrine/Common/Cache/RedisCache.php
vendor/doctrine/cache/lib/Doctrine/Common/Cache/RiakCache.php
vendor/doctrine/cache/lib/Doctrine/Common/Cache/SQLite3Cache.php
vendor/doctrine/cache/lib/Doctrine/Common/Cache/Version.php
vendor/doctrine/cache/lib/Doctrine/Common/Cache/WinCacheCache.php
vendor/doctrine/cache/lib/Doctrine/Common/Cache/XcacheCache.php
vendor/doctrine/cache/phpunit.xml.dist [deleted file]
vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/ApcCacheTest.php [deleted file]
vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/ApcuCacheTest.php [deleted file]
vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/ArrayCacheTest.php [deleted file]
vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/BaseFileCacheTest.php [deleted file]
vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/CacheProviderTest.php [deleted file]
vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/CacheTest.php [deleted file]
vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/ChainCacheTest.php [deleted file]
vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/CouchbaseCacheTest.php [deleted file]
vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/FileCacheTest.php [deleted file]
vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/FilesystemCacheTest.php [deleted file]
vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/MemcacheCacheTest.php [deleted file]
vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/MemcachedCacheTest.php [deleted file]
vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/MongoDBCacheTest.php [deleted file]
vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/PhpFileCacheTest.php [deleted file]
vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/PredisCacheTest.php [deleted file]
vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/RedisCacheTest.php [deleted file]
vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/RiakCacheTest.php [deleted file]
vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/SQLite3CacheTest.php [deleted file]
vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/VoidCacheTest.php [deleted file]
vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/WinCacheCacheTest.php [deleted file]
vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/XcacheCacheTest.php [deleted file]
vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/ZendDataCacheTest.php [deleted file]
vendor/doctrine/cache/tests/Doctrine/Tests/DoctrineTestCase.php [deleted file]
vendor/doctrine/cache/tests/travis/php.ini [deleted file]
vendor/doctrine/cache/tests/travis/phpunit.travis.xml [deleted file]
vendor/doctrine/collections/composer.json
vendor/doctrine/collections/lib/Doctrine/Common/Collections/AbstractLazyCollection.php
vendor/doctrine/collections/lib/Doctrine/Common/Collections/ArrayCollection.php
vendor/doctrine/collections/lib/Doctrine/Common/Collections/Collection.php
vendor/doctrine/collections/lib/Doctrine/Common/Collections/Criteria.php
vendor/doctrine/collections/lib/Doctrine/Common/Collections/Expr/ClosureExpressionVisitor.php
vendor/doctrine/collections/lib/Doctrine/Common/Collections/Expr/Comparison.php
vendor/doctrine/collections/lib/Doctrine/Common/Collections/Expr/CompositeExpression.php
vendor/doctrine/common/README.md
vendor/doctrine/common/composer.json
vendor/doctrine/common/lib/Doctrine/Common/ClassLoader.php
vendor/doctrine/common/lib/Doctrine/Common/EventManager.php
vendor/doctrine/common/lib/Doctrine/Common/Persistence/ManagerRegistry.php
vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php
vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/PHPDriver.php
vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectManagerDecorator.php
vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php
vendor/doctrine/common/lib/Doctrine/Common/Proxy/Exception/InvalidArgumentException.php
vendor/doctrine/common/lib/Doctrine/Common/Proxy/ProxyGenerator.php
vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionParser.php
vendor/doctrine/common/lib/Doctrine/Common/Util/ClassUtils.php
vendor/doctrine/common/lib/Doctrine/Common/Util/Debug.php
vendor/doctrine/common/lib/Doctrine/Common/Version.php
vendor/doctrine/common/phpstan.neon [new file with mode: 0644]
vendor/doctrine/inflector/composer.json
vendor/doctrine/inflector/lib/Doctrine/Common/Inflector/Inflector.php
vendor/guzzlehttp/guzzle/CHANGELOG.md
vendor/guzzlehttp/guzzle/LICENSE
vendor/guzzlehttp/guzzle/README.md
vendor/guzzlehttp/guzzle/composer.json
vendor/guzzlehttp/guzzle/src/Client.php
vendor/guzzlehttp/guzzle/src/ClientInterface.php
vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php
vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php
vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php
vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php
vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php
vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php
vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php
vendor/guzzlehttp/guzzle/src/HandlerStack.php
vendor/guzzlehttp/guzzle/src/MessageFormatter.php
vendor/guzzlehttp/guzzle/src/Middleware.php
vendor/guzzlehttp/guzzle/src/UriTemplate.php
vendor/guzzlehttp/guzzle/src/functions.php
vendor/twig/twig/.travis.yml
vendor/twig/twig/CHANGELOG
vendor/twig/twig/composer.json
vendor/twig/twig/ext/twig/php_twig.h
vendor/twig/twig/lib/Twig/Environment.php
vendor/twig/twig/lib/Twig/ExpressionParser.php
vendor/twig/twig/lib/Twig/Extension/Core.php
vendor/twig/twig/lib/Twig/Lexer.php
vendor/twig/twig/lib/Twig/Loader/Filesystem.php
vendor/twig/twig/lib/Twig/NodeVisitor/Optimizer.php
vendor/twig/twig/lib/Twig/NodeVisitor/Sandbox.php
vendor/twig/twig/lib/Twig/Parser.php
vendor/twig/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php
vendor/twig/twig/lib/Twig/Template.php
vendor/twig/twig/lib/Twig/TokenParser/For.php
vendor/twig/twig/lib/Twig/TokenParserBroker.php
vendor/twig/twig/lib/Twig/TokenStream.php
vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php
vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length.test
vendor/twig/twig/test/Twig/Tests/Fixtures/regression/block_names_unicity.test [new file with mode: 0644]
vendor/twig/twig/test/Twig/Tests/IntegrationTest.php
web/core/lib/Drupal.php
web/core/lib/Drupal/Core/DrupalKernel.php
web/core/lib/Drupal/Core/Security/RequestSanitizer.php [new file with mode: 0644]
web/core/modules/update/update.module

index 85d1a8b46b0d1d8a1446d14c25210255d06b87d3..3f2b9df6420c8e2412f0d46e42754b01f5f75abd 100644 (file)
@@ -19,7 +19,7 @@
         "composer/installers": "^1.2",
         "drupal-composer/drupal-scaffold": "^2.2",
         "cweagans/composer-patches": "~1.0",
-        "drupal/core": "^8.4.0",
+        "drupal/core": "^8.4.6",
         "drupal/console": "^1.0",
         "drupal/token": "^1.0@RC",
         "drupal/ctools": "^3.0@alpha",
index df1aa94a6d21dfa8ceacea866b4a1bade9fdd492..40663eb421eb46a1f7a60aa4d742d2ad74a63af8 100644 (file)
@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
         "This file is @generated automatically"
     ],
-    "content-hash": "01a5df84551bef7c3f76ff65995f296f",
+    "content-hash": "08077751106b61fc89fbb36241674293",
     "packages": [
         {
             "name": "alchemy/zippy",
         },
         {
             "name": "doctrine/annotations",
-            "version": "v1.4.0",
+            "version": "v1.6.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/doctrine/annotations.git",
-                "reference": "54cacc9b81758b14e3ce750f205a393d52339e97"
+                "reference": "c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/doctrine/annotations/zipball/54cacc9b81758b14e3ce750f205a393d52339e97",
-                "reference": "54cacc9b81758b14e3ce750f205a393d52339e97",
+                "url": "https://api.github.com/repos/doctrine/annotations/zipball/c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5",
+                "reference": "c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5",
                 "shasum": ""
             },
             "require": {
                 "doctrine/lexer": "1.*",
-                "php": "^5.6 || ^7.0"
+                "php": "^7.1"
             },
             "require-dev": {
                 "doctrine/cache": "1.*",
-                "phpunit/phpunit": "^5.7"
+                "phpunit/phpunit": "^6.4"
             },
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-master": "1.4.x-dev"
+                    "dev-master": "1.6.x-dev"
                 }
             },
             "autoload": {
                 "docblock",
                 "parser"
             ],
-            "time": "2017-02-24T16:22:25+00:00"
+            "time": "2017-12-06T07:11:42+00:00"
         },
         {
             "name": "doctrine/cache",
-            "version": "v1.6.2",
+            "version": "v1.7.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/doctrine/cache.git",
-                "reference": "eb152c5100571c7a45470ff2a35095ab3f3b900b"
+                "reference": "b3217d58609e9c8e661cd41357a54d926c4a2a1a"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/doctrine/cache/zipball/eb152c5100571c7a45470ff2a35095ab3f3b900b",
-                "reference": "eb152c5100571c7a45470ff2a35095ab3f3b900b",
+                "url": "https://api.github.com/repos/doctrine/cache/zipball/b3217d58609e9c8e661cd41357a54d926c4a2a1a",
+                "reference": "b3217d58609e9c8e661cd41357a54d926c4a2a1a",
                 "shasum": ""
             },
             "require": {
-                "php": "~5.5|~7.0"
+                "php": "~7.1"
             },
             "conflict": {
                 "doctrine/common": ">2.2,<2.4"
             },
             "require-dev": {
-                "phpunit/phpunit": "~4.8|~5.0",
-                "predis/predis": "~1.0",
-                "satooshi/php-coveralls": "~0.6"
+                "alcaeus/mongo-php-adapter": "^1.1",
+                "mongodb/mongodb": "^1.1",
+                "phpunit/phpunit": "^5.7",
+                "predis/predis": "~1.0"
+            },
+            "suggest": {
+                "alcaeus/mongo-php-adapter": "Required to use legacy MongoDB driver"
             },
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-master": "1.6.x-dev"
+                    "dev-master": "1.7.x-dev"
                 }
             },
             "autoload": {
                 "cache",
                 "caching"
             ],
-            "time": "2017-07-22T12:49:21+00:00"
+            "time": "2017-08-25T07:02:50+00:00"
         },
         {
             "name": "doctrine/collections",
-            "version": "v1.4.0",
+            "version": "v1.5.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/doctrine/collections.git",
-                "reference": "1a4fb7e902202c33cce8c55989b945612943c2ba"
+                "reference": "a01ee38fcd999f34d9bfbcee59dbda5105449cbf"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/doctrine/collections/zipball/1a4fb7e902202c33cce8c55989b945612943c2ba",
-                "reference": "1a4fb7e902202c33cce8c55989b945612943c2ba",
+                "url": "https://api.github.com/repos/doctrine/collections/zipball/a01ee38fcd999f34d9bfbcee59dbda5105449cbf",
+                "reference": "a01ee38fcd999f34d9bfbcee59dbda5105449cbf",
                 "shasum": ""
             },
             "require": {
-                "php": "^5.6 || ^7.0"
+                "php": "^7.1"
             },
             "require-dev": {
                 "doctrine/coding-standard": "~0.1@dev",
                 "collections",
                 "iterator"
             ],
-            "time": "2017-01-03T10:49:41+00:00"
+            "time": "2017-07-22T10:37:32+00:00"
         },
         {
             "name": "doctrine/common",
-            "version": "v2.7.3",
+            "version": "v2.8.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/doctrine/common.git",
-                "reference": "4acb8f89626baafede6ee5475bc5844096eba8a9"
+                "reference": "f68c297ce6455e8fd794aa8ffaf9fa458f6ade66"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/doctrine/common/zipball/4acb8f89626baafede6ee5475bc5844096eba8a9",
-                "reference": "4acb8f89626baafede6ee5475bc5844096eba8a9",
+                "url": "https://api.github.com/repos/doctrine/common/zipball/f68c297ce6455e8fd794aa8ffaf9fa458f6ade66",
+                "reference": "f68c297ce6455e8fd794aa8ffaf9fa458f6ade66",
                 "shasum": ""
             },
             "require": {
                 "doctrine/collections": "1.*",
                 "doctrine/inflector": "1.*",
                 "doctrine/lexer": "1.*",
-                "php": "~5.6|~7.0"
+                "php": "~7.1"
             },
             "require-dev": {
-                "phpunit/phpunit": "^5.4.6"
+                "phpunit/phpunit": "^5.7"
             },
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-master": "2.7.x-dev"
+                    "dev-master": "2.8.x-dev"
                 }
             },
             "autoload": {
                 "persistence",
                 "spl"
             ],
-            "time": "2017-07-22T08:35:12+00:00"
+            "time": "2017-08-31T08:43:38+00:00"
         },
         {
             "name": "doctrine/inflector",
-            "version": "v1.2.0",
+            "version": "v1.3.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/doctrine/inflector.git",
-                "reference": "e11d84c6e018beedd929cff5220969a3c6d1d462"
+                "reference": "5527a48b7313d15261292c149e55e26eae771b0a"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/doctrine/inflector/zipball/e11d84c6e018beedd929cff5220969a3c6d1d462",
-                "reference": "e11d84c6e018beedd929cff5220969a3c6d1d462",
+                "url": "https://api.github.com/repos/doctrine/inflector/zipball/5527a48b7313d15261292c149e55e26eae771b0a",
+                "reference": "5527a48b7313d15261292c149e55e26eae771b0a",
                 "shasum": ""
             },
             "require": {
-                "php": "^7.0"
+                "php": "^7.1"
             },
             "require-dev": {
                 "phpunit/phpunit": "^6.2"
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-master": "1.2.x-dev"
+                    "dev-master": "1.3.x-dev"
                 }
             },
             "autoload": {
                 "singularize",
                 "string"
             ],
-            "time": "2017-07-22T12:18:28+00:00"
+            "time": "2018-01-09T20:05:19+00:00"
         },
         {
             "name": "doctrine/instantiator",
         },
         {
             "name": "drupal/core",
-            "version": "8.4.5",
+            "version": "8.4.6",
             "source": {
                 "type": "git",
                 "url": "https://github.com/drupal/core.git",
-                "reference": "44a857df6f7ffd063cffed9a41767cdc50dd7474"
+                "reference": "f439a43c7da1df8d16067f797c0bc3498eb4c699"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/drupal/core/zipball/44a857df6f7ffd063cffed9a41767cdc50dd7474",
-                "reference": "44a857df6f7ffd063cffed9a41767cdc50dd7474",
+                "url": "https://api.github.com/repos/drupal/core/zipball/f439a43c7da1df8d16067f797c0bc3498eb4c699",
+                "reference": "f439a43c7da1df8d16067f797c0bc3498eb4c699",
                 "shasum": ""
             },
             "require": {
                 "GPL-2.0+"
             ],
             "description": "Drupal is an open source content management platform powering millions of websites and applications.",
-            "time": "2018-02-20T21:35:13+00:00"
+            "time": "2018-03-27T10:03:10+00:00"
         },
         {
             "name": "drupal/crop",
         },
         {
             "name": "guzzlehttp/guzzle",
-            "version": "6.3.0",
+            "version": "6.3.2",
             "source": {
                 "type": "git",
                 "url": "https://github.com/guzzle/guzzle.git",
-                "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699"
+                "reference": "68d0ea14d5a3f42a20e87632a5f84931e2709c90"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/guzzle/guzzle/zipball/f4db5a78a5ea468d4831de7f0bf9d9415e348699",
-                "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699",
+                "url": "https://api.github.com/repos/guzzle/guzzle/zipball/68d0ea14d5a3f42a20e87632a5f84931e2709c90",
+                "reference": "68d0ea14d5a3f42a20e87632a5f84931e2709c90",
                 "shasum": ""
             },
             "require": {
             },
             "require-dev": {
                 "ext-curl": "*",
-                "phpunit/phpunit": "^4.0 || ^5.0",
+                "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4",
                 "psr/log": "^1.0"
             },
             "suggest": {
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-master": "6.2-dev"
+                    "dev-master": "6.3-dev"
                 }
             },
             "autoload": {
                 "rest",
                 "web service"
             ],
-            "time": "2017-06-22T18:50:49+00:00"
+            "time": "2018-03-26T16:33:04+00:00"
         },
         {
             "name": "guzzlehttp/promises",
         },
         {
             "name": "symfony/debug",
-            "version": "v3.4.5",
+            "version": "v3.4.6",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/debug.git",
         },
         {
             "name": "twig/twig",
-            "version": "v1.35.1",
+            "version": "v1.35.3",
             "source": {
                 "type": "git",
                 "url": "https://github.com/twigphp/Twig.git",
-                "reference": "ffda54d85cc3aec3ba499c8c0eda9b2176edfe83"
+                "reference": "b48680b6eb7d16b5025b9bfc4108d86f6b8af86f"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/twigphp/Twig/zipball/ffda54d85cc3aec3ba499c8c0eda9b2176edfe83",
-                "reference": "ffda54d85cc3aec3ba499c8c0eda9b2176edfe83",
+                "url": "https://api.github.com/repos/twigphp/Twig/zipball/b48680b6eb7d16b5025b9bfc4108d86f6b8af86f",
+                "reference": "b48680b6eb7d16b5025b9bfc4108d86f6b8af86f",
                 "shasum": ""
             },
             "require": {
             },
             "require-dev": {
                 "psr/container": "^1.0",
-                "symfony/debug": "~2.7",
-                "symfony/phpunit-bridge": "~3.3@dev"
+                "symfony/debug": "^2.7",
+                "symfony/phpunit-bridge": "^3.3"
             },
             "type": "library",
             "extra": {
             "keywords": [
                 "templating"
             ],
-            "time": "2018-03-02T18:06:27+00:00"
+            "time": "2018-03-20T04:25:58+00:00"
         },
         {
             "name": "webflo/drupal-finder",
index eb244a78a47cc035d4459be7977ef5109b0cc0a6..89ec16634da8c1598fdaa63541b812537672c958 100644 (file)
     },
     {
         "name": "doctrine/annotations",
-        "version": "v1.4.0",
-        "version_normalized": "1.4.0.0",
+        "version": "v1.6.0",
+        "version_normalized": "1.6.0.0",
         "source": {
             "type": "git",
             "url": "https://github.com/doctrine/annotations.git",
-            "reference": "54cacc9b81758b14e3ce750f205a393d52339e97"
+            "reference": "c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5"
         },
         "dist": {
             "type": "zip",
-            "url": "https://api.github.com/repos/doctrine/annotations/zipball/54cacc9b81758b14e3ce750f205a393d52339e97",
-            "reference": "54cacc9b81758b14e3ce750f205a393d52339e97",
+            "url": "https://api.github.com/repos/doctrine/annotations/zipball/c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5",
+            "reference": "c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5",
             "shasum": ""
         },
         "require": {
             "doctrine/lexer": "1.*",
-            "php": "^5.6 || ^7.0"
+            "php": "^7.1"
         },
         "require-dev": {
             "doctrine/cache": "1.*",
-            "phpunit/phpunit": "^5.7"
+            "phpunit/phpunit": "^6.4"
         },
-        "time": "2017-02-24T16:22:25+00:00",
+        "time": "2017-12-06T07:11:42+00:00",
         "type": "library",
         "extra": {
             "branch-alias": {
-                "dev-master": "1.4.x-dev"
+                "dev-master": "1.6.x-dev"
             }
         },
         "installation-source": "dist",
     },
     {
         "name": "doctrine/cache",
-        "version": "v1.6.2",
-        "version_normalized": "1.6.2.0",
+        "version": "v1.7.1",
+        "version_normalized": "1.7.1.0",
         "source": {
             "type": "git",
             "url": "https://github.com/doctrine/cache.git",
-            "reference": "eb152c5100571c7a45470ff2a35095ab3f3b900b"
+            "reference": "b3217d58609e9c8e661cd41357a54d926c4a2a1a"
         },
         "dist": {
             "type": "zip",
-            "url": "https://api.github.com/repos/doctrine/cache/zipball/eb152c5100571c7a45470ff2a35095ab3f3b900b",
-            "reference": "eb152c5100571c7a45470ff2a35095ab3f3b900b",
+            "url": "https://api.github.com/repos/doctrine/cache/zipball/b3217d58609e9c8e661cd41357a54d926c4a2a1a",
+            "reference": "b3217d58609e9c8e661cd41357a54d926c4a2a1a",
             "shasum": ""
         },
         "require": {
-            "php": "~5.5|~7.0"
+            "php": "~7.1"
         },
         "conflict": {
             "doctrine/common": ">2.2,<2.4"
         },
         "require-dev": {
-            "phpunit/phpunit": "~4.8|~5.0",
-            "predis/predis": "~1.0",
-            "satooshi/php-coveralls": "~0.6"
+            "alcaeus/mongo-php-adapter": "^1.1",
+            "mongodb/mongodb": "^1.1",
+            "phpunit/phpunit": "^5.7",
+            "predis/predis": "~1.0"
+        },
+        "suggest": {
+            "alcaeus/mongo-php-adapter": "Required to use legacy MongoDB driver"
         },
-        "time": "2017-07-22T12:49:21+00:00",
+        "time": "2017-08-25T07:02:50+00:00",
         "type": "library",
         "extra": {
             "branch-alias": {
-                "dev-master": "1.6.x-dev"
+                "dev-master": "1.7.x-dev"
             }
         },
         "installation-source": "dist",
     },
     {
         "name": "doctrine/collections",
-        "version": "v1.4.0",
-        "version_normalized": "1.4.0.0",
+        "version": "v1.5.0",
+        "version_normalized": "1.5.0.0",
         "source": {
             "type": "git",
             "url": "https://github.com/doctrine/collections.git",
-            "reference": "1a4fb7e902202c33cce8c55989b945612943c2ba"
+            "reference": "a01ee38fcd999f34d9bfbcee59dbda5105449cbf"
         },
         "dist": {
             "type": "zip",
-            "url": "https://api.github.com/repos/doctrine/collections/zipball/1a4fb7e902202c33cce8c55989b945612943c2ba",
-            "reference": "1a4fb7e902202c33cce8c55989b945612943c2ba",
+            "url": "https://api.github.com/repos/doctrine/collections/zipball/a01ee38fcd999f34d9bfbcee59dbda5105449cbf",
+            "reference": "a01ee38fcd999f34d9bfbcee59dbda5105449cbf",
             "shasum": ""
         },
         "require": {
-            "php": "^5.6 || ^7.0"
+            "php": "^7.1"
         },
         "require-dev": {
             "doctrine/coding-standard": "~0.1@dev",
             "phpunit/phpunit": "^5.7"
         },
-        "time": "2017-01-03T10:49:41+00:00",
+        "time": "2017-07-22T10:37:32+00:00",
         "type": "library",
         "extra": {
             "branch-alias": {
     },
     {
         "name": "doctrine/common",
-        "version": "v2.7.3",
-        "version_normalized": "2.7.3.0",
+        "version": "v2.8.1",
+        "version_normalized": "2.8.1.0",
         "source": {
             "type": "git",
             "url": "https://github.com/doctrine/common.git",
-            "reference": "4acb8f89626baafede6ee5475bc5844096eba8a9"
+            "reference": "f68c297ce6455e8fd794aa8ffaf9fa458f6ade66"
         },
         "dist": {
             "type": "zip",
-            "url": "https://api.github.com/repos/doctrine/common/zipball/4acb8f89626baafede6ee5475bc5844096eba8a9",
-            "reference": "4acb8f89626baafede6ee5475bc5844096eba8a9",
+            "url": "https://api.github.com/repos/doctrine/common/zipball/f68c297ce6455e8fd794aa8ffaf9fa458f6ade66",
+            "reference": "f68c297ce6455e8fd794aa8ffaf9fa458f6ade66",
             "shasum": ""
         },
         "require": {
             "doctrine/collections": "1.*",
             "doctrine/inflector": "1.*",
             "doctrine/lexer": "1.*",
-            "php": "~5.6|~7.0"
+            "php": "~7.1"
         },
         "require-dev": {
-            "phpunit/phpunit": "^5.4.6"
+            "phpunit/phpunit": "^5.7"
         },
-        "time": "2017-07-22T08:35:12+00:00",
+        "time": "2017-08-31T08:43:38+00:00",
         "type": "library",
         "extra": {
             "branch-alias": {
-                "dev-master": "2.7.x-dev"
+                "dev-master": "2.8.x-dev"
             }
         },
         "installation-source": "dist",
     },
     {
         "name": "doctrine/inflector",
-        "version": "v1.2.0",
-        "version_normalized": "1.2.0.0",
+        "version": "v1.3.0",
+        "version_normalized": "1.3.0.0",
         "source": {
             "type": "git",
             "url": "https://github.com/doctrine/inflector.git",
-            "reference": "e11d84c6e018beedd929cff5220969a3c6d1d462"
+            "reference": "5527a48b7313d15261292c149e55e26eae771b0a"
         },
         "dist": {
             "type": "zip",
-            "url": "https://api.github.com/repos/doctrine/inflector/zipball/e11d84c6e018beedd929cff5220969a3c6d1d462",
-            "reference": "e11d84c6e018beedd929cff5220969a3c6d1d462",
+            "url": "https://api.github.com/repos/doctrine/inflector/zipball/5527a48b7313d15261292c149e55e26eae771b0a",
+            "reference": "5527a48b7313d15261292c149e55e26eae771b0a",
             "shasum": ""
         },
         "require": {
-            "php": "^7.0"
+            "php": "^7.1"
         },
         "require-dev": {
             "phpunit/phpunit": "^6.2"
         },
-        "time": "2017-07-22T12:18:28+00:00",
+        "time": "2018-01-09T20:05:19+00:00",
         "type": "library",
         "extra": {
             "branch-alias": {
-                "dev-master": "1.2.x-dev"
+                "dev-master": "1.3.x-dev"
             }
         },
         "installation-source": "dist",
     },
     {
         "name": "drupal/core",
-        "version": "8.4.5",
-        "version_normalized": "8.4.5.0",
+        "version": "8.4.6",
+        "version_normalized": "8.4.6.0",
         "source": {
             "type": "git",
             "url": "https://github.com/drupal/core.git",
-            "reference": "44a857df6f7ffd063cffed9a41767cdc50dd7474"
+            "reference": "f439a43c7da1df8d16067f797c0bc3498eb4c699"
         },
         "dist": {
             "type": "zip",
-            "url": "https://api.github.com/repos/drupal/core/zipball/44a857df6f7ffd063cffed9a41767cdc50dd7474",
-            "reference": "44a857df6f7ffd063cffed9a41767cdc50dd7474",
+            "url": "https://api.github.com/repos/drupal/core/zipball/f439a43c7da1df8d16067f797c0bc3498eb4c699",
+            "reference": "f439a43c7da1df8d16067f797c0bc3498eb4c699",
             "shasum": ""
         },
         "require": {
             "symfony/css-selector": "~3.2.8",
             "symfony/phpunit-bridge": "~3.2.8"
         },
-        "time": "2018-02-20T21:35:13+00:00",
+        "time": "2018-03-27T10:03:10+00:00",
         "type": "drupal-core",
         "installation-source": "dist",
         "autoload": {
     },
     {
         "name": "guzzlehttp/guzzle",
-        "version": "6.3.0",
-        "version_normalized": "6.3.0.0",
+        "version": "6.3.2",
+        "version_normalized": "6.3.2.0",
         "source": {
             "type": "git",
             "url": "https://github.com/guzzle/guzzle.git",
-            "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699"
+            "reference": "68d0ea14d5a3f42a20e87632a5f84931e2709c90"
         },
         "dist": {
             "type": "zip",
-            "url": "https://api.github.com/repos/guzzle/guzzle/zipball/f4db5a78a5ea468d4831de7f0bf9d9415e348699",
-            "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699",
+            "url": "https://api.github.com/repos/guzzle/guzzle/zipball/68d0ea14d5a3f42a20e87632a5f84931e2709c90",
+            "reference": "68d0ea14d5a3f42a20e87632a5f84931e2709c90",
             "shasum": ""
         },
         "require": {
         },
         "require-dev": {
             "ext-curl": "*",
-            "phpunit/phpunit": "^4.0 || ^5.0",
+            "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4",
             "psr/log": "^1.0"
         },
         "suggest": {
             "psr/log": "Required for using the Log middleware"
         },
-        "time": "2017-06-22T18:50:49+00:00",
+        "time": "2018-03-26T16:33:04+00:00",
         "type": "library",
         "extra": {
             "branch-alias": {
-                "dev-master": "6.2-dev"
+                "dev-master": "6.3-dev"
             }
         },
         "installation-source": "dist",
     },
     {
         "name": "symfony/debug",
-        "version": "v3.4.5",
-        "version_normalized": "3.4.5.0",
+        "version": "v3.4.6",
+        "version_normalized": "3.4.6.0",
         "source": {
             "type": "git",
             "url": "https://github.com/symfony/debug.git",
     },
     {
         "name": "twig/twig",
-        "version": "v1.35.1",
-        "version_normalized": "1.35.1.0",
+        "version": "v1.35.3",
+        "version_normalized": "1.35.3.0",
         "source": {
             "type": "git",
             "url": "https://github.com/twigphp/Twig.git",
-            "reference": "ffda54d85cc3aec3ba499c8c0eda9b2176edfe83"
+            "reference": "b48680b6eb7d16b5025b9bfc4108d86f6b8af86f"
         },
         "dist": {
             "type": "zip",
-            "url": "https://api.github.com/repos/twigphp/Twig/zipball/ffda54d85cc3aec3ba499c8c0eda9b2176edfe83",
-            "reference": "ffda54d85cc3aec3ba499c8c0eda9b2176edfe83",
+            "url": "https://api.github.com/repos/twigphp/Twig/zipball/b48680b6eb7d16b5025b9bfc4108d86f6b8af86f",
+            "reference": "b48680b6eb7d16b5025b9bfc4108d86f6b8af86f",
             "shasum": ""
         },
         "require": {
         },
         "require-dev": {
             "psr/container": "^1.0",
-            "symfony/debug": "~2.7",
-            "symfony/phpunit-bridge": "~3.3@dev"
+            "symfony/debug": "^2.7",
+            "symfony/phpunit-bridge": "^3.3"
         },
-        "time": "2018-03-02T18:06:27+00:00",
+        "time": "2018-03-20T04:25:58+00:00",
         "type": "library",
         "extra": {
             "branch-alias": {
index c09ebe60107ef2d316321cef1c1bccf5c0545df7..100b006a3322d16b5b2435d998655fdea269d1aa 100644 (file)
@@ -1,5 +1,20 @@
 ## Changelog
 
+### 1.5.0
+
+This release increments the minimum supported PHP version to 7.1.0.
+
+Also, HHVM official support has been dropped.
+
+Some noticeable performance improvements to annotation autoloading
+have been applied, making failed annotation autoloading less heavy
+on the filesystem access.
+
+- [133: Add @throws annotation in AnnotationReader#__construct()](https://github.com/doctrine/annotations/issues/133) thanks to @SenseException
+- [134: Require PHP 7.1, drop HHVM support](https://github.com/doctrine/annotations/issues/134) thanks to @lcobucci
+- [135: Prevent the same loader from being registered twice](https://github.com/doctrine/annotations/issues/135)  thanks to @jrjohnson
+- [137: #135 optimise multiple class load attempts in AnnotationRegistry](https://github.com/doctrine/annotations/issues/137)  thanks to @Ocramius
+
 
 ### 1.4.0
 
index 6a2719b348f107c5025b0b3fe7c8178498944b69..cd5b630970795d4faccf54b1dd76956d9723a466 100644 (file)
         {"name": "Johannes Schmitt", "email": "schmittjoh@gmail.com"}
     ],
     "require": {
-        "php": "^5.6 || ^7.0",
+        "php": "^7.1",
         "doctrine/lexer": "1.*"
     },
     "require-dev": {
         "doctrine/cache": "1.*",
-        "phpunit/phpunit": "^5.7"
+        "phpunit/phpunit": "^6.4"
     },
     "autoload": {
         "psr-4": { "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" }
@@ -28,7 +28,7 @@
     },
     "extra": {
         "branch-alias": {
-            "dev-master": "1.4.x-dev"
+            "dev-master": "1.6.x-dev"
         }
     }
 }
index 6c579775fd682fb344db60a6f17a7d1ce5c25c24..0c060496515e04881ef38788102dda5d7c964a42 100644 (file)
@@ -100,6 +100,8 @@ class AnnotationReader implements Reader
         'package_version' => true,
         // PlantUML
         'startuml' => true, 'enduml' => true,
+        // Symfony 3.3 Cache Adapter
+        'experimental' => true
     );
 
     /**
@@ -172,6 +174,8 @@ class AnnotationReader implements Reader
      * Initializes a new AnnotationReader.
      *
      * @param DocParser $parser
+     *
+     * @throws AnnotationException
      */
     public function __construct(DocParser $parser = null)
     {
index 13ceb6348b33593a7de16fd2600d9e408ce8c3c3..13abaf50d5aa65ba516cc2377dadad004c266fab 100644 (file)
@@ -19,9 +19,6 @@
 
 namespace Doctrine\Common\Annotations;
 
-/**
- * AnnotationRegistry.
- */
 final class AnnotationRegistry
 {
     /**
@@ -32,34 +29,39 @@ final class AnnotationRegistry
      *
      * This autoloading mechanism does not utilize the PHP autoloading but implements autoloading on its own.
      *
-     * @var array
+     * @var string[][]|string[]|null[]
      */
-    static private $autoloadNamespaces = array();
+    static private $autoloadNamespaces = [];
 
     /**
      * A map of autoloader callables.
      *
-     * @var array
+     * @var callable[]
      */
-    static private $loaders = array();
+    static private $loaders = [];
 
     /**
-     * @return void
+     * An array of classes which cannot be found
+     *
+     * @var null[] indexed by class name
      */
-    static public function reset()
+    static private $failedToAutoload = [];
+
+    public static function reset() : void
     {
-        self::$autoloadNamespaces = array();
-        self::$loaders = array();
+        self::$autoloadNamespaces = [];
+        self::$loaders            = [];
+        self::$failedToAutoload   = [];
     }
 
     /**
      * Registers file.
      *
-     * @param string $file
-     *
-     * @return void
+     * @deprecated this method is deprecated and will be removed in doctrine/annotations 2.0
+     *             autoloading should be deferred to the globally registered autoloader by then. For now,
+     *             use @example AnnotationRegistry::registerLoader('class_exists')
      */
-    static public function registerFile($file)
+    public static function registerFile(string $file) : void
     {
         require_once $file;
     }
@@ -72,9 +74,11 @@ final class AnnotationRegistry
      * @param string            $namespace
      * @param string|array|null $dirs
      *
-     * @return void
+     * @deprecated this method is deprecated and will be removed in doctrine/annotations 2.0
+     *             autoloading should be deferred to the globally registered autoloader by then. For now,
+     *             use @example AnnotationRegistry::registerLoader('class_exists')
      */
-    static public function registerAutoloadNamespace($namespace, $dirs = null)
+    public static function registerAutoloadNamespace(string $namespace, $dirs = null) : void
     {
         self::$autoloadNamespaces[$namespace] = $dirs;
     }
@@ -84,13 +88,15 @@ final class AnnotationRegistry
      *
      * Loading of this namespaces will be done with a PSR-0 namespace loading algorithm.
      *
-     * @param array $namespaces
+     * @param string[][]|string[]|null[] $namespaces indexed by namespace name
      *
-     * @return void
+     * @deprecated this method is deprecated and will be removed in doctrine/annotations 2.0
+     *             autoloading should be deferred to the globally registered autoloader by then. For now,
+     *             use @example AnnotationRegistry::registerLoader('class_exists')
      */
-    static public function registerAutoloadNamespaces(array $namespaces)
+    public static function registerAutoloadNamespaces(array $namespaces) : void
     {
-        self::$autoloadNamespaces = array_merge(self::$autoloadNamespaces, $namespaces);
+        self::$autoloadNamespaces = \array_merge(self::$autoloadNamespaces, $namespaces);
     }
 
     /**
@@ -99,41 +105,55 @@ final class AnnotationRegistry
      * 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 callable $callable
-     *
-     * @return void
+     * @deprecated this method is deprecated and will be removed in doctrine/annotations 2.0
+     *             autoloading should be deferred to the globally registered autoloader by then. For now,
+     *             use @example AnnotationRegistry::registerLoader('class_exists')
+     */
+    public static function registerLoader(callable $callable) : void
+    {
+        // Reset our static cache now that we have a new loader to work with
+        self::$failedToAutoload   = [];
+        self::$loaders[]          = $callable;
+    }
+
+    /**
+     * Registers an autoloading callable for annotations, if it is not already registered
      *
-     * @throws \InvalidArgumentException
+     * @deprecated this method is deprecated and will be removed in doctrine/annotations 2.0
      */
-    static public function registerLoader($callable)
+    public static function registerUniqueLoader(callable $callable) : void
     {
-        if (!is_callable($callable)) {
-            throw new \InvalidArgumentException("A callable is expected in AnnotationRegistry::registerLoader().");
+        if ( ! in_array($callable, self::$loaders, true) ) {
+            self::registerLoader($callable);
         }
-        self::$loaders[] = $callable;
     }
 
     /**
      * Autoloads an annotation class silently.
-     *
-     * @param string $class
-     *
-     * @return boolean
      */
-    static public function loadAnnotationClass($class)
+    public static function loadAnnotationClass(string $class) : bool
     {
+        if (\class_exists($class, false)) {
+            return true;
+        }
+
+        if (\array_key_exists($class, self::$failedToAutoload)) {
+            return false;
+        }
+
         foreach (self::$autoloadNamespaces AS $namespace => $dirs) {
-            if (strpos($class, $namespace) === 0) {
-                $file = str_replace("\\", DIRECTORY_SEPARATOR, $class) . ".php";
+            if (\strpos($class, $namespace) === 0) {
+                $file = \str_replace('\\', \DIRECTORY_SEPARATOR, $class) . '.php';
+
                 if ($dirs === null) {
                     if ($path = stream_resolve_include_path($file)) {
                         require $path;
                         return true;
                     }
                 } else {
-                    foreach((array)$dirs AS $dir) {
-                        if (is_file($dir . DIRECTORY_SEPARATOR . $file)) {
-                            require $dir . DIRECTORY_SEPARATOR . $file;
+                    foreach((array) $dirs AS $dir) {
+                        if (is_file($dir . \DIRECTORY_SEPARATOR . $file)) {
+                            require $dir . \DIRECTORY_SEPARATOR . $file;
                             return true;
                         }
                     }
@@ -142,10 +162,13 @@ final class AnnotationRegistry
         }
 
         foreach (self::$loaders AS $loader) {
-            if (call_user_func($loader, $class) === true) {
+            if ($loader($class) === true) {
                 return true;
             }
         }
+
+        self::$failedToAutoload[$class] = null;
+
         return false;
     }
 }
index d2b79a7fd65549181ea808290b13b32dbb78bce0..be267e611cc7a8c7e105f17801e8f2512f56b8fc 100644 (file)
@@ -3,6 +3,9 @@ parameters:
         - %currentWorkingDirectory%/tests/Doctrine/Tests/Common/Annotations/DocParserTest.php
     excludes_analyse:
         - %currentWorkingDirectory%/tests/*/Fixtures/*
+        - %currentWorkingDirectory%/tests/Doctrine/Tests/Common/Annotations/ReservedKeywordsClasses.php
+        - %currentWorkingDirectory%/tests/Doctrine/Tests/Common/Annotations/Ticket/DCOM58Entity.php
+        - %currentWorkingDirectory%/tests/Doctrine/Tests/DoctrineTestCase.php
     polluteScopeWithLoopInitialAssignments: true
     ignoreErrors:
         - '#Class Doctrine_Tests_Common_Annotations_Fixtures_ClassNoNamespaceNoComment not found#'
diff --git a/vendor/doctrine/cache/.coveralls.yml b/vendor/doctrine/cache/.coveralls.yml
deleted file mode 100644 (file)
index 0c08233..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-# for php-coveralls
-service_name: travis-ci
-src_dir: lib
-coverage_clover: build/logs/clover.xml
diff --git a/vendor/doctrine/cache/.gitignore b/vendor/doctrine/cache/.gitignore
deleted file mode 100644 (file)
index ca23023..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-vendor/
-build/
-phpunit.xml
-composer.lock
\ No newline at end of file
diff --git a/vendor/doctrine/cache/.travis.yml b/vendor/doctrine/cache/.travis.yml
deleted file mode 100644 (file)
index a16fd9d..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-language: php
-
-sudo: false
-
-cache:
-    directories:
-        - vendor
-        - $HOME/.composer/cache
-
-php:
-    - 5.5
-    - 5.6
-    - 7.0
-    - hhvm
-
-services:
-    - riak
-    - mongodb
-    - memcached
-    - redis-server
-
-before_install:
-    - if [[ $TRAVIS_PHP_VERSION != 'hhvm' ]] ; then pecl channel-update pecl.php.net; fi;
-    - if [[ $TRAVIS_PHP_VERSION != 'hhvm' && $TRAVIS_PHP_VERSION != '7.0' ]]; then pecl install riak-beta; fi;
-    - if [[ $TRAVIS_PHP_VERSION =~ 5.[56] ]] ; then echo yes | pecl install apcu-4.0.10; fi;
-    - if [[ $TRAVIS_PHP_VERSION = 7.* ]] ; then pecl config-set preferred_state beta; echo yes | pecl install apcu; fi;
-    - if [[ $TRAVIS_PHP_VERSION != 'hhvm' ]]; then phpenv config-add ./tests/travis/php.ini; fi;
-
-install:
-    - travis_retry composer install
-
-script:
-    - ./vendor/bin/phpunit -c ./tests/travis/phpunit.travis.xml -v
-
-after_script:
-    - php vendor/bin/coveralls -v
-
-matrix:
-    fast_finish: true
-    allow_failures:
-        - php: hhvm
-        - php: 7.0
index 94f80a30ee959b10151b0811763896847ae1393a..a0902580fe683abbffba065a937583a6a25d6fc3 100644 (file)
@@ -1,14 +1,9 @@
 # Doctrine Cache
 
-Master: [![Build Status](https://secure.travis-ci.org/doctrine/cache.png?branch=master)](http://travis-ci.org/doctrine/cache) [![Coverage Status](https://coveralls.io/repos/doctrine/cache/badge.png?branch=master)](https://coveralls.io/r/doctrine/cache?branch=master)
+[![Build Status](https://secure.travis-ci.org/doctrine/cache.png?branch=master)](http://travis-ci.org/doctrine/cache) 
+[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/doctrine/cache/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/doctrine/cache/?branch=master) 
+[![Code Coverage](https://scrutinizer-ci.com/g/doctrine/cache/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/doctrine/cache/?branch=master)
 
 [![Latest Stable Version](https://poser.pugx.org/doctrine/cache/v/stable.png)](https://packagist.org/packages/doctrine/cache) [![Total Downloads](https://poser.pugx.org/doctrine/cache/downloads.png)](https://packagist.org/packages/doctrine/cache)
 
-Cache component extracted from the Doctrine Common project.
-
-## Changelog
-
-### v1.2
-
-* Added support for MongoDB as Cache Provider
-* Fix namespace version reset
+Cache component extracted from the Doctrine Common project. [Documentation](http://doctrine-orm.readthedocs.io/projects/doctrine-orm/en/latest/reference/caching.html)
diff --git a/vendor/doctrine/cache/build.properties b/vendor/doctrine/cache/build.properties
deleted file mode 100644 (file)
index 2d98c36..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-# Version class and file
-project.version_class = Doctrine\\Common\\Cache\\Version
-project.version_file = lib/Doctrine/Common/Cache/Version.php
diff --git a/vendor/doctrine/cache/build.xml b/vendor/doctrine/cache/build.xml
deleted file mode 100644 (file)
index a7c52e3..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-<?xml version="1.0"?>
-<project name="DoctrineCommonCache" default="build" basedir=".">
-    <property file="build.properties" />
-
-    <target name="php">
-        <exec executable="which" outputproperty="php_executable">
-            <arg value="php" />
-        </exec>
-    </target>
-
-    <target name="prepare">
-        <mkdir dir="build" />
-    </target>
-
-    <target name="build" depends="check-git-checkout-clean,prepare,php,composer">
-        <exec executable="${php_executable}">
-            <arg value="build/composer.phar" />
-            <arg value="archive" />
-            <arg value="--dir=build" />
-        </exec>
-    </target>
-
-    <target name="composer" depends="php,composer-check,composer-download">
-        <exec executable="${php_executable}">
-            <arg value="build/composer.phar" />
-            <arg value="install" />
-        </exec>
-    </target>
-
-    <target name="composer-check" depends="prepare">
-        <available file="build/composer.phar" property="composer.present"/>
-    </target>
-
-    <target name="composer-download" unless="composer.present">
-        <exec executable="wget">
-            <arg value="-Obuild/composer.phar" />
-            <arg value="http://getcomposer.org/composer.phar" />
-        </exec>
-    </target>
-
-    <target name="make-release" depends="check-git-checkout-clean,prepare,php">
-        <replace file="${project.version_file}" token="-DEV" value="" failOnNoReplacements="true" />
-        <exec executable="git" failonerror="true" outputproperty="current_git_branch">
-            <arg value="rev-parse" />
-            <arg value="--abbrev-ref" />
-            <arg value="HEAD" />
-        </exec>
-        <exec executable="${php_executable}" outputproperty="doctrine.current_version" failonerror="true">
-            <arg value="-r" />
-            <arg value="require_once '${project.version_file}';echo ${project.version_class}::VERSION;" />
-        </exec>
-        <exec executable="${php_executable}" outputproperty="doctrine.next_version" failonerror="true">
-            <arg value="-r" />
-            <arg value="$parts = explode('.', str_ireplace(array('-DEV', '-ALPHA', '-BETA'), '', '${doctrine.current_version}'));
-                if (count($parts) != 3) {
-                    throw new \InvalidArgumentException('Version is assumed in format x.y.z, ${doctrine.current_version} given');
-                }
-                if ('${current_git_branch}' === 'master') {
-                    $parts[1]++;
-                } else {
-                    $parts[2]++;
-                }
-                echo implode('.', $parts);
-            " />
-        </exec>
-
-        <git-commit file="${project.version_file}" message="Release ${doctrine.current_version}" />
-        <git-tag version="${doctrine.current_version}" />
-        <replace file="${project.version_file}" token="${doctrine.current_version}" value="${doctrine.next_version}-DEV" />
-        <git-commit file="${project.version_file}" message="Bump version to ${doctrine.next_version}" />
-    </target>
-
-    <target name="check-git-checkout-clean">
-        <exec executable="git" failonerror="true">
-            <arg value="diff-index" />
-            <arg value="--quiet" />
-            <arg value="HEAD" />
-        </exec>
-    </target>
-
-    <macrodef name="git-commit">
-        <attribute name="file" default="NOT SET"/>
-        <attribute name="message" default="NOT SET"/>
-
-        <sequential>
-            <exec executable="git">
-                <arg value="add" />
-                <arg value="@{file}" />
-            </exec>
-            <exec executable="git">
-                <arg value="commit" />
-                <arg value="-m" />
-                <arg value="@{message}" />
-            </exec>
-        </sequential>
-    </macrodef>
-
-    <macrodef name="git-tag">
-        <attribute name="version" default="NOT SET" />
-
-        <sequential>
-            <exec executable="git">
-                <arg value="tag" />
-                <arg value="-m" />
-                <arg value="v@{version}" />
-                <arg value="v@{version}" />
-            </exec>
-        </sequential>
-    </macrodef>
-</project>
index 7ef1727a107d72263adc2cde7deea2fa0cdcacfa..893012e10281ceb96967f08ad0ad52fc2f5e3ab6 100644 (file)
         {"name": "Johannes Schmitt", "email": "schmittjoh@gmail.com"}
     ],
     "require": {
-        "php": "~5.5|~7.0"
+        "php": "~7.1"
     },
     "require-dev": {
-        "phpunit/phpunit":         "~4.8|~5.0",
-        "satooshi/php-coveralls":  "~0.6",
-        "predis/predis":           "~1.0"
+        "alcaeus/mongo-php-adapter": "^1.1",
+        "mongodb/mongodb": "^1.1",
+        "phpunit/phpunit": "^5.7",
+        "predis/predis":   "~1.0"
+    },
+    "suggest": {
+        "alcaeus/mongo-php-adapter": "Required to use legacy MongoDB driver"
     },
     "conflict": {
         "doctrine/common": ">2.2,<2.4"
@@ -31,7 +35,7 @@
     },
     "extra": {
         "branch-alias": {
-            "dev-master": "1.6.x-dev"
+            "dev-master": "1.7.x-dev"
         }
     }
 }
index 0dfbd6a1d546795505d0a1e8740d40f192c68d0c..0d2cb5858742864c0bb6c07916d3a6b064ee43ef 100644 (file)
@@ -107,12 +107,12 @@ class ApcCache extends CacheProvider
             $info['start_time'] = isset($info['start_time']) ? $info['start_time'] : $info['stime'];
         }
 
-        return array(
+        return [
             Cache::STATS_HITS             => $info['num_hits'],
             Cache::STATS_MISSES           => $info['num_misses'],
             Cache::STATS_UPTIME           => $info['start_time'],
             Cache::STATS_MEMORY_USAGE     => $info['mem_size'],
             Cache::STATS_MEMORY_AVAILABLE => $sma['avail_mem'],
-        );
+        ];
     }
 }
index 2a91752ba851af05bebc91776a417ccab4ff404a..5449b02e75712d882446aaf28ccf4c9c89a79bc2 100644 (file)
@@ -61,6 +61,16 @@ class ApcuCache extends CacheProvider
         return apcu_delete($id) || ! apcu_exists($id);
     }
 
+    /**
+     * {@inheritdoc}
+     */
+    protected function doDeleteMultiple(array $keys)
+    {
+        $result = apcu_delete($keys);
+
+        return false !== $result && count($result) !== count($keys);
+    }
+
     /**
      * {@inheritdoc}
      */
@@ -95,12 +105,12 @@ class ApcuCache extends CacheProvider
         $info = apcu_cache_info(true);
         $sma  = apcu_sma_info();
 
-        return array(
+        return [
             Cache::STATS_HITS             => $info['num_hits'],
             Cache::STATS_MISSES           => $info['num_misses'],
             Cache::STATS_UPTIME           => $info['start_time'],
             Cache::STATS_MEMORY_USAGE     => $info['mem_size'],
             Cache::STATS_MEMORY_AVAILABLE => $sma['avail_mem'],
-        );
+        ];
     }
 }
index 9f579237a6199303a51e6e12f0955b1c0d7ef7ff..546c0ec1dd09923d18456f9b4512b7ad1e58f6d8 100644 (file)
@@ -28,8 +28,9 @@ namespace Doctrine\Common\Cache;
  * @author Jonathan Wage <jonwage@gmail.com>
  * @author Roman Borschel <roman@code-factory.org>
  * @author Fabio B. Silva <fabio.bat.silva@gmail.com>
+ * @author Benoit Burnichon <bburnichon@gmail.com>
  */
-abstract class CacheProvider implements Cache, FlushableCache, ClearableCache, MultiGetCache, MultiPutCache
+abstract class CacheProvider implements Cache, FlushableCache, ClearableCache, MultiOperationCache
 {
     const DOCTRINE_NAMESPACE_CACHEKEY = 'DoctrineNamespaceCacheKey[%s]';
 
@@ -84,13 +85,13 @@ abstract class CacheProvider implements Cache, FlushableCache, ClearableCache, M
     public function fetchMultiple(array $keys)
     {
         if (empty($keys)) {
-            return array();
+            return [];
         }
-        
+
         // note: the array_combine() is in place to keep an association between our $keys and the $namespacedKeys
-        $namespacedKeys = array_combine($keys, array_map(array($this, 'getNamespacedId'), $keys));
+        $namespacedKeys = array_combine($keys, array_map([$this, 'getNamespacedId'], $keys));
         $items          = $this->doFetchMultiple($namespacedKeys);
-        $foundItems     = array();
+        $foundItems     = [];
 
         // no internal array function supports this sort of mapping: needs to be iterative
         // this filters and combines keys in one pass
@@ -108,7 +109,7 @@ abstract class CacheProvider implements Cache, FlushableCache, ClearableCache, M
      */
     public function saveMultiple(array $keysAndValues, $lifetime = 0)
     {
-        $namespacedKeysAndValues = array();
+        $namespacedKeysAndValues = [];
         foreach ($keysAndValues as $key => $value) {
             $namespacedKeysAndValues[$this->getNamespacedId($key)] = $value;
         }
@@ -132,6 +133,14 @@ abstract class CacheProvider implements Cache, FlushableCache, ClearableCache, M
         return $this->doSave($this->getNamespacedId($id), $data, $lifeTime);
     }
 
+    /**
+     * {@inheritdoc}
+     */
+    public function deleteMultiple(array $keys)
+    {
+        return $this->doDeleteMultiple(array_map(array($this, 'getNamespacedId'), $keys));
+    }
+
     /**
      * {@inheritdoc}
      */
@@ -180,7 +189,7 @@ abstract class CacheProvider implements Cache, FlushableCache, ClearableCache, M
      *
      * @return string The namespaced id.
      */
-    private function getNamespacedId($id)
+    private function getNamespacedId(string $id) : string
     {
         $namespaceVersion  = $this->getNamespaceVersion();
 
@@ -192,7 +201,7 @@ abstract class CacheProvider implements Cache, FlushableCache, ClearableCache, M
      *
      * @return string
      */
-    private function getNamespaceCacheKey()
+    private function getNamespaceCacheKey() : string
     {
         return sprintf(self::DOCTRINE_NAMESPACE_CACHEKEY, $this->namespace);
     }
@@ -202,14 +211,14 @@ abstract class CacheProvider implements Cache, FlushableCache, ClearableCache, M
      *
      * @return integer
      */
-    private function getNamespaceVersion()
+    private function getNamespaceVersion() : int
     {
         if (null !== $this->namespaceVersion) {
             return $this->namespaceVersion;
         }
 
-        $namespaceCacheKey = $this->getNamespaceCacheKey();
-        $this->namespaceVersion = $this->doFetch($namespaceCacheKey) ?: 1;
+        $namespaceCacheKey      = $this->getNamespaceCacheKey();
+        $this->namespaceVersion = (int) $this->doFetch($namespaceCacheKey) ?: 1;
 
         return $this->namespaceVersion;
     }
@@ -222,7 +231,7 @@ abstract class CacheProvider implements Cache, FlushableCache, ClearableCache, M
      */
     protected function doFetchMultiple(array $keys)
     {
-        $returnValues = array();
+        $returnValues = [];
 
         foreach ($keys as $key) {
             if (false !== ($item = $this->doFetch($key)) || $this->doContains($key)) {
@@ -285,6 +294,26 @@ abstract class CacheProvider implements Cache, FlushableCache, ClearableCache, M
      */
     abstract protected function doSave($id, $data, $lifeTime = 0);
 
+    /**
+     * Default implementation of doDeleteMultiple. Each driver that supports multi-delete should override it.
+     *
+     * @param array $keys Array of keys to delete from cache
+     *
+     * @return bool TRUE if the operation was successful, FALSE if it wasn't
+     */
+    protected function doDeleteMultiple(array $keys)
+    {
+        $success = true;
+
+        foreach ($keys as $key) {
+            if (! $this->doDelete($key)) {
+                $success = false;
+            }
+        }
+
+        return $success;
+    }
+
     /**
      * Deletes a cache entry.
      *
index 96c9b5479fbec039c1c883f6dceac00cf4a4c269..32534aa4e3ed76043bcf986f87afc7d85fc7bd28 100644 (file)
@@ -29,16 +29,18 @@ class ChainCache extends CacheProvider
     /**
      * @var CacheProvider[]
      */
-    private $cacheProviders = array();
+    private $cacheProviders = [];
 
     /**
      * Constructor
      *
      * @param CacheProvider[] $cacheProviders
      */
-    public function __construct($cacheProviders = array())
+    public function __construct($cacheProviders = [])
     {
-        $this->cacheProviders = $cacheProviders;
+        $this->cacheProviders = $cacheProviders instanceof \Traversable
+            ? iterator_to_array($cacheProviders, false)
+            : array_values($cacheProviders);
     }
 
     /**
@@ -74,6 +76,34 @@ class ChainCache extends CacheProvider
         return false;
     }
 
+    /**
+     * {@inheritdoc}
+     */
+    protected function doFetchMultiple(array $keys)
+    {
+        /* @var $traversedProviders CacheProvider[] */
+        $traversedProviders = [];
+        $keysCount          = count($keys);
+        $fetchedValues      = [];
+
+        foreach ($this->cacheProviders as $key => $cacheProvider) {
+            $fetchedValues = $cacheProvider->doFetchMultiple($keys);
+
+            // We populate all the previous cache layers (that are assumed to be faster)
+            if (count($fetchedValues) === $keysCount) {
+                foreach ($traversedProviders as $previousCacheProvider) {
+                    $previousCacheProvider->doSaveMultiple($fetchedValues);
+                }
+
+                return $fetchedValues;
+            }
+
+            $traversedProviders[] = $cacheProvider;
+        }
+
+        return $fetchedValues;
+    }
+
     /**
      * {@inheritDoc}
      */
@@ -102,6 +132,20 @@ class ChainCache extends CacheProvider
         return $stored;
     }
 
+    /**
+     * {@inheritdoc}
+     */
+    protected function doSaveMultiple(array $keysAndValues, $lifetime = 0)
+    {
+        $stored = true;
+
+        foreach ($this->cacheProviders as $cacheProvider) {
+            $stored = $cacheProvider->doSaveMultiple($keysAndValues, $lifetime) && $stored;
+        }
+
+        return $stored;
+    }
+
     /**
      * {@inheritDoc}
      */
@@ -116,6 +160,20 @@ class ChainCache extends CacheProvider
         return $deleted;
     }
 
+    /**
+     * {@inheritdoc}
+     */
+    protected function doDeleteMultiple(array $keys)
+    {
+        $deleted = true;
+
+        foreach ($this->cacheProviders as $cacheProvider) {
+            $deleted = $cacheProvider->doDeleteMultiple($keys) && $deleted;
+        }
+
+        return $deleted;
+    }
+
     /**
      * {@inheritDoc}
      */
@@ -136,7 +194,7 @@ class ChainCache extends CacheProvider
     protected function doGetStats()
     {
         // We return all the stats from all adapters
-        $stats = array();
+        $stats = [];
 
         foreach ($this->cacheProviders as $cacheProvider) {
             $stats[] = $cacheProvider->doGetStats();
index c21691df96290b96eaa77e9c0faab5646c228a6a..fe35533a8c0dada272470a0033d2ca0f110d54f2 100644 (file)
@@ -110,12 +110,12 @@ class CouchbaseCache extends CacheProvider
         $server  = explode(":", $servers[0]);
         $key     = $server[0] . ":" . "11210";
         $stats   = $stats[$key];
-        return array(
+        return [
             Cache::STATS_HITS   => $stats['get_hits'],
             Cache::STATS_MISSES => $stats['get_misses'],
             Cache::STATS_UPTIME => $stats['uptime'],
             Cache::STATS_MEMORY_USAGE     => $stats['bytes'],
             Cache::STATS_MEMORY_AVAILABLE => $stats['limit_maxbytes'],
-        );
+        ];
     }
 }
diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ExtMongoDBCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ExtMongoDBCache.php
new file mode 100644 (file)
index 0000000..b07cf6d
--- /dev/null
@@ -0,0 +1,221 @@
+<?php
+
+declare(strict_types=1);
+
+/*
+ * 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 MongoDB\BSON\Binary;
+use MongoDB\BSON\UTCDateTime;
+use MongoDB\Collection;
+use MongoDB\Database;
+use MongoDB\Driver\Exception\Exception;
+use MongoDB\Model\BSONDocument;
+
+/**
+ * MongoDB cache provider for ext-mongodb
+ *
+ * @internal Do not use - will be removed in 2.0. Use MongoDBCache instead
+ */
+class ExtMongoDBCache extends CacheProvider
+{
+    /**
+     * @var Database
+     */
+    private $database;
+
+    /**
+     * @var Collection
+     */
+    private $collection;
+
+    /**
+     * @var bool
+     */
+    private $expirationIndexCreated = false;
+
+    /**
+     * Constructor.
+     *
+     * This provider will default to the write concern and read preference
+     * options set on the Database instance (or inherited from MongoDB or
+     * Client). Using an unacknowledged write concern (< 1) may make the return
+     * values of delete() and save() unreliable. Reading from secondaries may
+     * make contain() and fetch() unreliable.
+     *
+     * @see http://www.php.net/manual/en/mongo.readpreferences.php
+     * @see http://www.php.net/manual/en/mongo.writeconcerns.php
+     * @param Collection $collection
+     */
+    public function __construct(Collection $collection)
+    {
+        // Ensure there is no typemap set - we want to use our own
+        $this->collection = $collection->withOptions(['typeMap' => null]);
+        $this->database = new Database($collection->getManager(), $collection->getDatabaseName());
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    protected function doFetch($id)
+    {
+        $document = $this->collection->findOne(['_id' => $id], [MongoDBCache::DATA_FIELD, MongoDBCache::EXPIRATION_FIELD]);
+
+        if ($document === null) {
+            return false;
+        }
+
+        if ($this->isExpired($document)) {
+            $this->createExpirationIndex();
+            $this->doDelete($id);
+            return false;
+        }
+
+        return unserialize($document[MongoDBCache::DATA_FIELD]->getData());
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    protected function doContains($id)
+    {
+        $document = $this->collection->findOne(['_id' => $id], [MongoDBCache::EXPIRATION_FIELD]);
+
+        if ($document === null) {
+            return false;
+        }
+
+        if ($this->isExpired($document)) {
+            $this->createExpirationIndex();
+            $this->doDelete($id);
+            return false;
+        }
+
+        return true;
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    protected function doSave($id, $data, $lifeTime = 0)
+    {
+        try {
+            $this->collection->updateOne(
+                ['_id' => $id],
+                ['$set' => [
+                    MongoDBCache::EXPIRATION_FIELD => ($lifeTime > 0 ? new UTCDateTime((time() + $lifeTime) * 1000): null),
+                    MongoDBCache::DATA_FIELD => new Binary(serialize($data), Binary::TYPE_GENERIC),
+                ]],
+                ['upsert' => true]
+            );
+        } catch (Exception $e) {
+            return false;
+        }
+
+        return true;
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    protected function doDelete($id)
+    {
+        try {
+            $this->collection->deleteOne(['_id' => $id]);
+        } catch (Exception $e) {
+            return false;
+        }
+
+        return true;
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    protected function doFlush()
+    {
+        try {
+            // Use remove() in lieu of drop() to maintain any collection indexes
+            $this->collection->deleteMany([]);
+        } catch (Exception $e) {
+            return false;
+        }
+
+        return true;
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    protected function doGetStats()
+    {
+        $uptime = null;
+        $memoryUsage = null;
+
+        try {
+            $serverStatus = $this->database->command([
+                'serverStatus' => 1,
+                'locks' => 0,
+                'metrics' => 0,
+                'recordStats' => 0,
+                'repl' => 0,
+            ])->toArray()[0];
+            $uptime = $serverStatus['uptime'] ?? null;
+        } catch (Exception $e) {
+        }
+
+        try {
+            $collStats = $this->database->command(['collStats' => $this->collection->getCollectionName()])->toArray()[0];
+            $memoryUsage = $collStats['size'] ?? null;
+        } catch (Exception $e) {
+        }
+
+        return [
+            Cache::STATS_HITS => null,
+            Cache::STATS_MISSES => null,
+            Cache::STATS_UPTIME => $uptime,
+            Cache::STATS_MEMORY_USAGE => $memoryUsage,
+            Cache::STATS_MEMORY_AVAILABLE  => null,
+        ];
+    }
+
+    /**
+     * Check if the document is expired.
+     *
+     * @param BSONDocument $document
+     *
+     * @return bool
+     */
+    private function isExpired(BSONDocument $document): bool
+    {
+        return isset($document[MongoDBCache::EXPIRATION_FIELD]) &&
+            $document[MongoDBCache::EXPIRATION_FIELD] instanceof UTCDateTime &&
+            $document[MongoDBCache::EXPIRATION_FIELD]->toDateTime() < new \DateTime();
+    }
+
+    private function createExpirationIndex(): void
+    {
+        if ($this->expirationIndexCreated) {
+            return;
+        }
+
+        $this->collection->createIndex([MongoDBCache::EXPIRATION_FIELD => 1], ['background' => true, 'expireAfterSeconds' => 0]);
+    }
+}
index b2e0427e59a9a88b38eabd851a2799b3a1cc081b..5293b8fddac20585bd5e32a08677e268892666f7 100644 (file)
@@ -202,13 +202,13 @@ abstract class FileCache extends CacheProvider
 
         $free = disk_free_space($this->directory);
 
-        return array(
+        return [
             Cache::STATS_HITS               => null,
             Cache::STATS_MISSES             => null,
             Cache::STATS_UPTIME             => null,
             Cache::STATS_MEMORY_USAGE       => $usage,
             Cache::STATS_MEMORY_AVAILABLE   => $free,
-        );
+        ];
     }
 
     /**
@@ -217,7 +217,7 @@ abstract class FileCache extends CacheProvider
      * @param string $path
      * @return bool TRUE on success or if path already exists, FALSE if path cannot be created.
      */
-    private function createPathIfNeeded($path)
+    private function createPathIfNeeded(string $path) : bool
     {
         if ( ! is_dir($path)) {
             if (false === @mkdir($path, 0777 & (~$this->umask), true) && !is_dir($path)) {
@@ -236,7 +236,7 @@ abstract class FileCache extends CacheProvider
      *
      * @return bool TRUE on success, FALSE if path cannot be created, if path is not writable or an any other error.
      */
-    protected function writeFile($filename, $content)
+    protected function writeFile(string $filename, string $content) : bool
     {
         $filepath = pathinfo($filename, PATHINFO_DIRNAME);
 
@@ -252,6 +252,7 @@ abstract class FileCache extends CacheProvider
         @chmod($tmpFile, 0666 & (~$this->umask));
 
         if (file_put_contents($tmpFile, $content) !== false) {
+            @chmod($tmpFile, 0666 & (~$this->umask));
             if (@rename($tmpFile, $filename)) {
                 return true;
             }
@@ -265,7 +266,7 @@ abstract class FileCache extends CacheProvider
     /**
      * @return \Iterator
      */
-    private function getIterator()
+    private function getIterator() : \Iterator
     {
         return new \RecursiveIteratorIterator(
             new \RecursiveDirectoryIterator($this->directory, \FilesystemIterator::SKIP_DOTS),
@@ -278,7 +279,7 @@ abstract class FileCache extends CacheProvider
      *
      * @return bool
      */
-    private function isFilenameEndingWithExtension($name)
+    private function isFilenameEndingWithExtension(string $name) : bool
     {
         return '' === $this->extension
             || strrpos($name, $this->extension) === (strlen($name) - $this->extensionStringLength);
diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/LegacyMongoDBCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/LegacyMongoDBCache.php
new file mode 100644 (file)
index 0000000..91a78bf
--- /dev/null
@@ -0,0 +1,194 @@
+<?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 MongoBinData;
+use MongoCollection;
+use MongoCursorException;
+use MongoDate;
+
+/**
+ * MongoDB cache provider.
+ *
+ * @author Jeremy Mikola <jmikola@gmail.com>
+ * @internal Do not use - will be removed in 2.0. Use MongoDBCache instead
+ */
+class LegacyMongoDBCache extends CacheProvider
+{
+    /**
+     * @var MongoCollection
+     */
+    private $collection;
+
+    /**
+     * @var bool
+     */
+    private $expirationIndexCreated = false;
+
+    /**
+     * Constructor.
+     *
+     * This provider will default to the write concern and read preference
+     * options set on the MongoCollection instance (or inherited from MongoDB or
+     * MongoClient). Using an unacknowledged write concern (< 1) may make the
+     * return values of delete() and save() unreliable. Reading from secondaries
+     * may make contain() and fetch() unreliable.
+     *
+     * @see http://www.php.net/manual/en/mongo.readpreferences.php
+     * @see http://www.php.net/manual/en/mongo.writeconcerns.php
+     * @param MongoCollection $collection
+     */
+    public function __construct(MongoCollection $collection)
+    {
+        @trigger_error('Using the legacy MongoDB cache provider is deprecated and will be removed in 2.0', E_USER_DEPRECATED);
+        $this->collection = $collection;
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    protected function doFetch($id)
+    {
+        $document = $this->collection->findOne(['_id' => $id], [MongoDBCache::DATA_FIELD, MongoDBCache::EXPIRATION_FIELD]);
+
+        if ($document === null) {
+            return false;
+        }
+
+        if ($this->isExpired($document)) {
+            $this->createExpirationIndex();
+            $this->doDelete($id);
+            return false;
+        }
+
+        return unserialize($document[MongoDBCache::DATA_FIELD]->bin);
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    protected function doContains($id)
+    {
+        $document = $this->collection->findOne(['_id' => $id], [MongoDBCache::EXPIRATION_FIELD]);
+
+        if ($document === null) {
+            return false;
+        }
+
+        if ($this->isExpired($document)) {
+            $this->createExpirationIndex();
+            $this->doDelete($id);
+            return false;
+        }
+
+        return true;
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    protected function doSave($id, $data, $lifeTime = 0)
+    {
+        try {
+            $result = $this->collection->update(
+                ['_id' => $id],
+                ['$set' => [
+                    MongoDBCache::EXPIRATION_FIELD => ($lifeTime > 0 ? new MongoDate(time() + $lifeTime) : null),
+                    MongoDBCache::DATA_FIELD => new MongoBinData(serialize($data), MongoBinData::BYTE_ARRAY),
+                ]],
+                ['upsert' => true, 'multiple' => false]
+            );
+        } catch (MongoCursorException $e) {
+            return false;
+        }
+
+        return ($result['ok'] ?? 1) == 1;
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    protected function doDelete($id)
+    {
+        $result = $this->collection->remove(['_id' => $id]);
+
+        return ($result['ok'] ?? 1) == 1;
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    protected function doFlush()
+    {
+        // Use remove() in lieu of drop() to maintain any collection indexes
+        $result = $this->collection->remove();
+
+        return ($result['ok'] ?? 1) == 1;
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    protected function doGetStats()
+    {
+        $serverStatus = $this->collection->db->command([
+            'serverStatus' => 1,
+            'locks' => 0,
+            'metrics' => 0,
+            'recordStats' => 0,
+            'repl' => 0,
+        ]);
+
+        $collStats = $this->collection->db->command(['collStats' => 1]);
+
+        return [
+            Cache::STATS_HITS => null,
+            Cache::STATS_MISSES => null,
+            Cache::STATS_UPTIME => $serverStatus['uptime'] ?? null,
+            Cache::STATS_MEMORY_USAGE => $collStats['size'] ?? null,
+            Cache::STATS_MEMORY_AVAILABLE  => null,
+        ];
+    }
+
+    /**
+     * Check if the document is expired.
+     *
+     * @param array $document
+     *
+     * @return bool
+     */
+    private function isExpired(array $document) : bool
+    {
+        return isset($document[MongoDBCache::EXPIRATION_FIELD]) &&
+            $document[MongoDBCache::EXPIRATION_FIELD] instanceof MongoDate &&
+            $document[MongoDBCache::EXPIRATION_FIELD]->sec < time();
+    }
+
+
+    private function createExpirationIndex(): void
+    {
+        if ($this->expirationIndexCreated) {
+            return;
+        }
+
+        $this->expirationIndexCreated = true;
+        $this->collection->createIndex([MongoDBCache::EXPIRATION_FIELD => 1], ['background' => true, 'expireAfterSeconds' => 0]);
+    }
+}
index 8afaeeacc2bca0bf5723cd26491b7592554c9d12..97ab90a9832310e0ee2bacfd86b9640afb203808 100644 (file)
@@ -115,12 +115,12 @@ class MemcacheCache extends CacheProvider
     protected function doGetStats()
     {
         $stats = $this->memcache->getStats();
-        return array(
+        return [
             Cache::STATS_HITS   => $stats['get_hits'],
             Cache::STATS_MISSES => $stats['get_misses'],
             Cache::STATS_UPTIME => $stats['uptime'],
             Cache::STATS_MEMORY_USAGE     => $stats['bytes'],
             Cache::STATS_MEMORY_AVAILABLE => $stats['limit_maxbytes'],
-        );
+        ];
     }
 }
index 5a0fc0eaf09676d6742e1d8b1717205aa11f89c3..7bb32a03a16b0b3c2bc43b2d66ad99d98ea45c6f 100644 (file)
@@ -110,6 +110,15 @@ class MemcachedCache extends CacheProvider
         return $this->memcached->set($id, $data, (int) $lifeTime);
     }
 
+    /**
+     * {@inheritdoc}
+     */
+    protected function doDeleteMultiple(array $keys)
+    {
+        return $this->memcached->deleteMulti($keys)
+            || $this->memcached->getResultCode() === Memcached::RES_NOTFOUND;
+    }
+
     /**
      * {@inheritdoc}
      */
@@ -136,12 +145,12 @@ class MemcachedCache extends CacheProvider
         $servers = $this->memcached->getServerList();
         $key     = $servers[0]['host'] . ':' . $servers[0]['port'];
         $stats   = $stats[$key];
-        return array(
+        return [
             Cache::STATS_HITS   => $stats['get_hits'],
             Cache::STATS_MISSES => $stats['get_misses'],
             Cache::STATS_UPTIME => $stats['uptime'],
             Cache::STATS_MEMORY_USAGE     => $stats['bytes'],
             Cache::STATS_MEMORY_AVAILABLE => $stats['limit_maxbytes'],
-        );
+        ];
     }
 }
index 75fe0ca113049f8b1278559f0e89f6d58c6c1d3d..238fde41c5ced7eb2b750734841b582573029fff 100644 (file)
 
 namespace Doctrine\Common\Cache;
 
-use MongoBinData;
 use MongoCollection;
-use MongoCursorException;
-use MongoDate;
+use MongoDB\Collection;
 
 /**
  * MongoDB cache provider.
@@ -55,26 +53,33 @@ class MongoDBCache extends CacheProvider
     const EXPIRATION_FIELD = 'e';
 
     /**
-     * @var MongoCollection
+     * @var CacheProvider
      */
-    private $collection;
+    private $provider;
 
     /**
      * Constructor.
      *
      * This provider will default to the write concern and read preference
-     * options set on the MongoCollection instance (or inherited from MongoDB or
+     * options set on the collection instance (or inherited from MongoDB or
      * MongoClient). Using an unacknowledged write concern (< 1) may make the
      * return values of delete() and save() unreliable. Reading from secondaries
      * may make contain() and fetch() unreliable.
      *
      * @see http://www.php.net/manual/en/mongo.readpreferences.php
      * @see http://www.php.net/manual/en/mongo.writeconcerns.php
-     * @param MongoCollection $collection
+     * @param MongoCollection|Collection $collection
      */
-    public function __construct(MongoCollection $collection)
+    public function __construct($collection)
     {
-        $this->collection = $collection;
+        if ($collection instanceof MongoCollection) {
+            @trigger_error('Using a MongoCollection instance for creating a cache adapter is deprecated and will be removed in 2.0', E_USER_DEPRECATED);
+            $this->provider = new LegacyMongoDBCache($collection);
+        } elseif ($collection instanceof Collection) {
+            $this->provider = new ExtMongoDBCache($collection);
+        } else {
+            throw new \InvalidArgumentException('Invalid collection given - expected a MongoCollection or MongoDB\Collection instance');
+        }
     }
 
     /**
@@ -82,18 +87,7 @@ class MongoDBCache extends CacheProvider
      */
     protected function doFetch($id)
     {
-        $document = $this->collection->findOne(array('_id' => $id), array(self::DATA_FIELD, self::EXPIRATION_FIELD));
-
-        if ($document === null) {
-            return false;
-        }
-
-        if ($this->isExpired($document)) {
-            $this->doDelete($id);
-            return false;
-        }
-
-        return unserialize($document[self::DATA_FIELD]->bin);
+        return $this->provider->doFetch($id);
     }
 
     /**
@@ -101,18 +95,7 @@ class MongoDBCache extends CacheProvider
      */
     protected function doContains($id)
     {
-        $document = $this->collection->findOne(array('_id' => $id), array(self::EXPIRATION_FIELD));
-
-        if ($document === null) {
-            return false;
-        }
-
-        if ($this->isExpired($document)) {
-            $this->doDelete($id);
-            return false;
-        }
-
-        return true;
+        return $this->provider->doContains($id);
     }
 
     /**
@@ -120,20 +103,7 @@ class MongoDBCache extends CacheProvider
      */
     protected function doSave($id, $data, $lifeTime = 0)
     {
-        try {
-            $result = $this->collection->update(
-                array('_id' => $id),
-                array('$set' => array(
-                    self::EXPIRATION_FIELD => ($lifeTime > 0 ? new MongoDate(time() + $lifeTime) : null),
-                    self::DATA_FIELD => new MongoBinData(serialize($data), MongoBinData::BYTE_ARRAY),
-                )),
-                array('upsert' => true, 'multiple' => false)
-            );
-        } catch (MongoCursorException $e) {
-            return false;
-        }
-
-        return isset($result['ok']) ? $result['ok'] == 1 : true;
+        return $this->provider->doSave($id, $data, $lifeTime);
     }
 
     /**
@@ -141,9 +111,7 @@ class MongoDBCache extends CacheProvider
      */
     protected function doDelete($id)
     {
-        $result = $this->collection->remove(array('_id' => $id));
-
-        return isset($result['ok']) ? $result['ok'] == 1 : true;
+        return $this->provider->doDelete($id);
     }
 
     /**
@@ -151,10 +119,7 @@ class MongoDBCache extends CacheProvider
      */
     protected function doFlush()
     {
-        // Use remove() in lieu of drop() to maintain any collection indexes
-        $result = $this->collection->remove();
-
-        return isset($result['ok']) ? $result['ok'] == 1 : true;
+        return $this->provider->doFlush();
     }
 
     /**
@@ -162,36 +127,6 @@ class MongoDBCache extends CacheProvider
      */
     protected function doGetStats()
     {
-        $serverStatus = $this->collection->db->command(array(
-            'serverStatus' => 1,
-            'locks' => 0,
-            'metrics' => 0,
-            'recordStats' => 0,
-            'repl' => 0,
-        ));
-
-        $collStats = $this->collection->db->command(array('collStats' => 1));
-
-        return array(
-            Cache::STATS_HITS => null,
-            Cache::STATS_MISSES => null,
-            Cache::STATS_UPTIME => (isset($serverStatus['uptime']) ? (int) $serverStatus['uptime'] : null),
-            Cache::STATS_MEMORY_USAGE => (isset($collStats['size']) ? (int) $collStats['size'] : null),
-            Cache::STATS_MEMORY_AVAILABLE  => null,
-        );
-    }
-
-    /**
-     * Check if the document is expired.
-     *
-     * @param array $document
-     *
-     * @return bool
-     */
-    private function isExpired(array $document)
-    {
-        return isset($document[self::EXPIRATION_FIELD]) &&
-            $document[self::EXPIRATION_FIELD] instanceof MongoDate &&
-            $document[self::EXPIRATION_FIELD]->sec < time();
+        return $this->provider->doGetStats();
     }
 }
diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MultiDeleteCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MultiDeleteCache.php
new file mode 100644 (file)
index 0000000..0abaea1
--- /dev/null
@@ -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\Cache;
+
+/**
+ * Interface for cache drivers that allows to put many items at once.
+ *
+ * @link   www.doctrine-project.org
+ * @since  1.7
+ * @author Benoit Burnichon <bburnichon@gmail.com>
+ *
+ * @deprecated
+ */
+interface MultiDeleteCache
+{
+    /**
+     * Deletes several cache entries.
+     *
+     * @param string[] $keys Array of keys to delete from cache
+     *
+     * @return bool TRUE if the operation was successful, FALSE if it wasn't.
+     */
+    function deleteMultiple(array $keys);
+}
index df7146d78efde37f6bac097a9445b90dd749d2f5..0d437d143beccff3bf9d9d8bbd77f9d22b3cd088 100644 (file)
@@ -25,6 +25,8 @@ namespace Doctrine\Common\Cache;
  * @link   www.doctrine-project.org
  * @since  1.4
  * @author Asmir Mustafic <goetas@gmail.com>
+ *
+ * @deprecated
  */
 interface MultiGetCache
 {
diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MultiOperationCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MultiOperationCache.php
new file mode 100644 (file)
index 0000000..7d5c0b9
--- /dev/null
@@ -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\Cache;
+
+/**
+ * Interface for cache drivers that supports multiple items manipulation.
+ *
+ * @link   www.doctrine-project.org
+ * @since  1.7
+ * @author Luís Cobucci <lcobucci@gmail.com>
+ */
+interface MultiOperationCache extends MultiGetCache, MultiDeleteCache, MultiPutCache
+{
+}
index bf87ea9f1cd668651de80b601db8474077023f43..cb20bdc619799ef01c38f40a460a41fa58fcd92c 100644 (file)
@@ -25,6 +25,8 @@ namespace Doctrine\Common\Cache;
  * @link   www.doctrine-project.org
  * @since  1.6
  * @author Daniel Gorgan <danut007ro@gmail.com>
+ *
+ * @deprecated
  */
 interface MultiPutCache
 {
index 5e7519674e3e50414772f5bd3473870f53595d12..d243ab6c74b5de064c37d215ff07c2c5126ba807 100644 (file)
@@ -29,12 +29,22 @@ class PhpFileCache extends FileCache
 {
     const EXTENSION = '.doctrinecache.php';
 
+    /**
+     * @var callable
+     *
+     * This is cached in a local static variable to avoid instantiating a closure each time we need an empty handler
+     */
+    private static $emptyErrorHandler;
+
     /**
      * {@inheritdoc}
      */
     public function __construct($directory, $extension = self::EXTENSION, $umask = 0002)
     {
         parent::__construct($directory, $extension, $umask);
+
+        self::$emptyErrorHandler = function () {
+        };
     }
 
     /**
@@ -44,7 +54,7 @@ class PhpFileCache extends FileCache
     {
         $value = $this->includeFileForId($id);
 
-        if (! $value) {
+        if ($value === null) {
             return false;
         }
 
@@ -62,7 +72,7 @@ class PhpFileCache extends FileCache
     {
         $value = $this->includeFileForId($id);
 
-        if (! $value) {
+        if ($value === null) {
             return false;
         }
 
@@ -78,23 +88,20 @@ class PhpFileCache extends FileCache
             $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);
 
-        $value = array(
+        $value = [
             'lifetime'  => $lifeTime,
             'data'      => $data
-        );
-
-        $value  = var_export($value, true);
-        $code   = sprintf('<?php return %s;', $value);
+        ];
+
+        if (is_object($data) && method_exists($data, '__set_state')) {
+            $value  = var_export($value, true);
+            $code   = sprintf('<?php return %s;', $value);
+        } else {
+            $value  = var_export(serialize($value), true);
+            $code   = sprintf('<?php return unserialize(%s);', $value);
+        }
 
         return $this->writeFile($filename, $code);
     }
@@ -102,17 +109,21 @@ class PhpFileCache extends FileCache
     /**
      * @param string $id
      *
-     * @return array|false
+     * @return array|null
      */
-    private function includeFileForId($id)
+    private function includeFileForId(string $id) : ?array
     {
         $fileName = $this->getFilename($id);
 
         // note: error suppression is still faster than `file_exists`, `is_file` and `is_readable`
-        $value = @include $fileName;
+        set_error_handler(self::$emptyErrorHandler);
+
+        $value = include $fileName;
+
+        restore_error_handler();
 
         if (! isset($value['lifetime'])) {
-            return false;
+            return null;
         }
 
         return $value;
index bcd27497e980e4abc3dea741aa752701289483d0..a0cb86f97608d3e232083c2b87b2762775d3a5b1 100644 (file)
@@ -1,4 +1,21 @@
 <?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;
 
@@ -44,7 +61,7 @@ class PredisCache extends CacheProvider
      */
     protected function doFetchMultiple(array $keys)
     {
-        $fetchedItems = call_user_func_array(array($this->client, 'mget'), $keys);
+        $fetchedItems = call_user_func_array([$this->client, 'mget'], $keys);
 
         return array_map('unserialize', array_filter(array_combine($keys, $fetchedItems)));
     }
@@ -108,6 +125,14 @@ class PredisCache extends CacheProvider
         return $this->client->del($id) >= 0;
     }
 
+    /**
+     * {@inheritdoc}
+     */
+    protected function doDeleteMultiple(array $keys)
+    {
+        return $this->client->del($keys) >= 0;
+    }
+
     /**
      * {@inheritdoc}
      */
@@ -125,12 +150,12 @@ class PredisCache extends CacheProvider
     {
         $info = $this->client->info();
 
-        return array(
+        return [
             Cache::STATS_HITS              => $info['Stats']['keyspace_hits'],
             Cache::STATS_MISSES            => $info['Stats']['keyspace_misses'],
             Cache::STATS_UPTIME            => $info['Server']['uptime_in_seconds'],
             Cache::STATS_MEMORY_USAGE      => $info['Memory']['used_memory'],
             Cache::STATS_MEMORY_AVAILABLE  => false
-        );
+        ];
     }
 }
index 22add6679b85aed2d602d85ac221552f59ccea97..3ea51d507a5c4bb38f1e0d03c22dcc539fb86c20 100644 (file)
@@ -74,7 +74,7 @@ class RedisCache extends CacheProvider
         $fetchedItems = array_combine($keys, $this->redis->mget($keys));
 
         // Redis mget returns false for keys that do not exist. So we need to filter those out unless it's the real data.
-        $foundItems   = array();
+        $foundItems   = [];
 
         foreach ($fetchedItems as $key => $value) {
             if (false !== $value || $this->redis->exists($key)) {
@@ -135,6 +135,14 @@ class RedisCache extends CacheProvider
         return $this->redis->delete($id) >= 0;
     }
 
+    /**
+     * {@inheritdoc}
+     */
+    protected function doDeleteMultiple(array $keys)
+    {
+        return $this->redis->delete($keys) >= 0;
+    }
+
     /**
      * {@inheritdoc}
      */
@@ -149,13 +157,13 @@ class RedisCache extends CacheProvider
     protected function doGetStats()
     {
         $info = $this->redis->info();
-        return array(
+        return [
             Cache::STATS_HITS   => $info['keyspace_hits'],
             Cache::STATS_MISSES => $info['keyspace_misses'],
             Cache::STATS_UPTIME => $info['uptime_in_seconds'],
             Cache::STATS_MEMORY_USAGE      => $info['used_memory'],
             Cache::STATS_MEMORY_AVAILABLE  => false
-        );
+        ];
     }
 
     /**
@@ -167,10 +175,6 @@ class RedisCache extends CacheProvider
      */
     protected function getSerializerValue()
     {
-        if (defined('HHVM_VERSION')) {
-            return Redis::SERIALIZER_PHP;
-        }
-
         if (defined('Redis::SERIALIZER_IGBINARY') && extension_loaded('igbinary')) {
             return Redis::SERIALIZER_IGBINARY;
         }
index 0baa3f2531c5bc271f68c1a1063618b07bdf2a10..8a2e59ee1fc7e42595c2b1f9394b0dfc2d653b91 100644 (file)
@@ -20,7 +20,6 @@
 namespace Doctrine\Common\Cache;
 
 use Riak\Bucket;
-use Riak\Connection;
 use Riak\Input;
 use Riak\Exception;
 use Riak\Object;
@@ -204,7 +203,7 @@ class RiakCache extends CacheProvider
      *
      * @return bool
      */
-    private function isExpired(Object $object)
+    private function isExpired(Object $object) : bool
     {
         $metadataMap = $object->getMetadataMap();
 
index 0bf6e4d44af84e5fb68da1033f2038486c6f5a85..5b98538e58ca07ba5512e93350cc9f79e660b27f 100644 (file)
@@ -59,7 +59,7 @@ class SQLite3Cache extends CacheProvider
     /**
      * Constructor.
      *
-     * Calling the constructor will ensure that the database file and table 
+     * Calling the constructor will ensure that the database file and table
      * exist and will create both if they don't.
      *
      * @param SQLite3 $sqlite
@@ -86,11 +86,13 @@ class SQLite3Cache extends CacheProvider
      */
     protected function doFetch($id)
     {
-        if ($item = $this->findById($id)) {
-            return unserialize($item[self::DATA_FIELD]);
+        $item = $this->findById($id);
+
+        if (!$item) {
+            return false;
         }
 
-        return false;
+        return unserialize($item[self::DATA_FIELD]);
     }
 
     /**
@@ -161,7 +163,7 @@ class SQLite3Cache extends CacheProvider
      *
      * @return array|null
      */
-    private function findById($id, $includeData = true)
+    private function findById($id, bool $includeData = true) : ?array
     {
         list($idField) = $fields = $this->getFields();
 
@@ -199,9 +201,9 @@ class SQLite3Cache extends CacheProvider
      *
      * @return array
      */
-    private function getFields()
+    private function getFields() : array
     {
-        return array(static::ID_FIELD, static::DATA_FIELD, static::EXPIRATION_FIELD);
+        return [static::ID_FIELD, static::DATA_FIELD, static::EXPIRATION_FIELD];
     }
 
     /**
@@ -211,7 +213,7 @@ class SQLite3Cache extends CacheProvider
      *
      * @return bool
      */
-    private function isExpired(array $item)
+    private function isExpired(array $item) : bool
     {
         return isset($item[static::EXPIRATION_FIELD]) &&
             $item[self::EXPIRATION_FIELD] !== null &&
index a6399ecc193329a5749fa3ff832893b165d364b5..71b8b6f8047aceeca22ce1465483ed892ab4f75d 100644 (file)
@@ -21,5 +21,5 @@ namespace Doctrine\Common\Cache;
 
 class Version
 {
-    const VERSION = '1.6.1-DEV';
+    const VERSION = '1.7.1';
 }
index 8a250b29a877e349317fcf00355c45d297fa4365..905ccbc27bd92b82a061823825a947f7e71ee5b1 100644 (file)
@@ -90,6 +90,16 @@ class WinCacheCache extends CacheProvider
         return empty($result);
     }
 
+    /**
+     * {@inheritdoc}
+     */
+    protected function doDeleteMultiple(array $keys)
+    {
+        $result = wincache_ucache_delete($keys);
+
+        return is_array($result) && count($result) !== count($keys);
+    }
+
     /**
      * {@inheritdoc}
      */
@@ -98,12 +108,12 @@ class WinCacheCache extends CacheProvider
         $info    = wincache_ucache_info();
         $meminfo = wincache_ucache_meminfo();
 
-        return array(
+        return [
             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_AVAILABLE => $meminfo['memory_free'],
-        );
+        ];
     }
 }
index a2c4ca5662e2502e0db2c4f130387545192be5aa..799a5fc5bc2329d98bb06a20f93eed2fd8fb303c 100644 (file)
@@ -101,12 +101,12 @@ class XcacheCache extends CacheProvider
         $this->checkAuthorization();
 
         $info = xcache_info(XC_TYPE_VAR, 0);
-        return array(
+        return [
             Cache::STATS_HITS   => $info['hits'],
             Cache::STATS_MISSES => $info['misses'],
             Cache::STATS_UPTIME => null,
             Cache::STATS_MEMORY_USAGE      => $info['size'],
             Cache::STATS_MEMORY_AVAILABLE  => $info['avail'],
-        );
+        ];
     }
 }
diff --git a/vendor/doctrine/cache/phpunit.xml.dist b/vendor/doctrine/cache/phpunit.xml.dist
deleted file mode 100644 (file)
index 40cc24d..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<phpunit
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
-    backupGlobals="false"
-    colors="true"
-    bootstrap="vendor/autoload.php"
->
-    <php>
-        <ini name="error_reporting" value="-1" />
-    </php>
-
-    <testsuites>
-        <testsuite name="Doctrine Cache Test Suite">
-            <directory>./tests/Doctrine/</directory>
-        </testsuite>
-    </testsuites>
-
-    <filter>
-        <whitelist>
-            <directory>./lib/Doctrine/</directory>
-        </whitelist>
-    </filter>
-</phpunit>
diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/ApcCacheTest.php b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/ApcCacheTest.php
deleted file mode 100644 (file)
index 5becdf9..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-
-namespace Doctrine\Tests\Common\Cache;
-
-use Doctrine\Common\Cache\ApcCache;
-
-/**
- * @requires extension apc
- */
-class ApcCacheTest extends CacheTest
-{
-    protected function setUp()
-    {
-        if (!ini_get('apc.enable_cli')) {
-            $this->markTestSkipped('APC must be enabled for the CLI with the ini setting apc.enable_cli=1');
-        }
-    }
-
-    protected function _getCacheDriver()
-    {
-        return new ApcCache();
-    }
-
-    public function testLifetime()
-    {
-        $this->markTestSkipped('The APC cache TTL is not working in a single process/request. See https://bugs.php.net/bug.php?id=58084');
-    }
-}
diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/ApcuCacheTest.php b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/ApcuCacheTest.php
deleted file mode 100644 (file)
index 27764cd..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-
-namespace Doctrine\Tests\Common\Cache;
-
-use Doctrine\Common\Cache\ApcuCache;
-
-/**
- * @requires extension apcu
- */
-class ApcuCacheTest extends CacheTest
-{
-    protected function setUp()
-    {
-        if (!ini_get('apc.enable_cli')) {
-            $this->markTestSkipped('APC must be enabled for the CLI with the ini setting apc.enable_cli=1');
-        }
-    }
-
-    protected function _getCacheDriver()
-    {
-        return new ApcuCache();
-    }
-
-    public function testLifetime()
-    {
-        $this->markTestSkipped('The APC cache TTL is not working in a single process/request. See https://bugs.php.net/bug.php?id=58084');
-    }
-}
diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/ArrayCacheTest.php b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/ArrayCacheTest.php
deleted file mode 100644 (file)
index 3be94c6..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-
-namespace Doctrine\Tests\Common\Cache;
-
-use Doctrine\Common\Cache\ArrayCache;
-use Doctrine\Common\Cache\Cache;
-
-class ArrayCacheTest extends CacheTest
-{
-    protected function _getCacheDriver()
-    {
-        return new ArrayCache();
-    }
-
-    public function testGetStats()
-    {
-        $cache = $this->_getCacheDriver();
-        $cache->fetch('test1');
-        $cache->fetch('test2');
-        $cache->fetch('test3');
-
-        $cache->save('test1', 123);
-        $cache->save('test2', 123);
-
-        $cache->fetch('test1');
-        $cache->fetch('test2');
-        $cache->fetch('test3');
-
-        $stats = $cache->getStats();
-        $this->assertEquals(2, $stats[Cache::STATS_HITS]);
-        $this->assertEquals(5, $stats[Cache::STATS_MISSES]); // +1 for internal call to DoctrineNamespaceCacheKey
-        $this->assertNotNull($stats[Cache::STATS_UPTIME]);
-        $this->assertNull($stats[Cache::STATS_MEMORY_USAGE]);
-        $this->assertNull($stats[Cache::STATS_MEMORY_AVAILABLE]);
-
-        $cache->delete('test1');
-        $cache->delete('test2');
-
-        $cache->fetch('test1');
-        $cache->fetch('test2');
-        $cache->fetch('test3');
-
-        $stats = $cache->getStats();
-        $this->assertEquals(2, $stats[Cache::STATS_HITS]);
-        $this->assertEquals(8, $stats[Cache::STATS_MISSES]); // +1 for internal call to DoctrineNamespaceCacheKey
-    }
-
-    protected function isSharedStorage()
-    {
-        return false;
-    }
-}
\ No newline at end of file
diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/BaseFileCacheTest.php b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/BaseFileCacheTest.php
deleted file mode 100644 (file)
index c1256ee..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-<?php
-
-namespace Doctrine\Tests\Common\Cache;
-
-use Doctrine\Common\Cache\FileCache;
-use RecursiveDirectoryIterator;
-use RecursiveIteratorIterator;
-
-abstract class BaseFileCacheTest extends CacheTest
-{
-    protected $directory;
-
-    protected function setUp()
-    {
-        do {
-            $this->directory = sys_get_temp_dir() . '/doctrine_cache_'. uniqid();
-        } while (file_exists($this->directory));
-    }
-
-    protected function tearDown()
-    {
-        if ( ! is_dir($this->directory)) {
-            return;
-        }
-
-        $iterator = new RecursiveDirectoryIterator($this->directory);
-
-        foreach (new RecursiveIteratorIterator($iterator, RecursiveIteratorIterator::CHILD_FIRST) as $file) {
-            if ($file->isFile()) {
-                @unlink($file->getRealPath());
-            } elseif ($file->isDir()) {
-                @rmdir($file->getRealPath());
-            }
-        }
-
-        @rmdir($this->directory);
-    }
-
-    public function testFlushAllRemovesBalancingDirectories()
-    {
-        $cache = $this->_getCacheDriver();
-
-        $this->assertTrue($cache->save('key1', 1));
-        $this->assertTrue($cache->save('key2', 2));
-        $this->assertTrue($cache->flushAll());
-
-        $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->directory, \FilesystemIterator::SKIP_DOTS), \RecursiveIteratorIterator::CHILD_FIRST);
-
-        $this->assertCount(0, $iterator);
-    }
-
-    protected function isSharedStorage()
-    {
-        return false;
-    }
-
-    public function getPathLengthsToTest()
-    {
-        // Windows officially supports 260 bytes including null terminator
-        // 258 bytes available to use due to php bug #70943
-        // Windows officially supports 260 bytes including null terminator
-        // 259 characters is too large due to PHP bug (https://bugs.php.net/bug.php?id=70943)
-        // 260 characters is too large - null terminator is included in allowable length
-        return array(
-            array(257, false),
-            array(258, false),
-            array(259, true),
-            array(260, true)
-        );
-    }
-
-    private static function getBasePathForWindowsPathLengthTests($pathLength)
-    {
-        return FileCacheTest::getBasePathForWindowsPathLengthTests($pathLength);
-    }
-
-    /**
-     * @param int    $length
-     * @param string $basePath
-     *
-     * @return array
-     */
-    private static function getKeyAndPathFittingLength($length, $basePath)
-    {
-        $baseDirLength = strlen($basePath);
-        $extensionLength = strlen('.doctrine.cache');
-        $directoryLength = strlen(DIRECTORY_SEPARATOR . 'aa' . DIRECTORY_SEPARATOR);
-        $namespaceAndBracketLength = strlen(bin2hex("[][1]"));
-        $keyLength = $length
-            - ($baseDirLength
-                + $extensionLength
-                + $directoryLength
-                + $namespaceAndBracketLength);
-
-        $key = str_repeat('a', floor($keyLength / 2));
-        $namespacedKey = '[' . $key . '][1]';
-
-        $keyHash = hash('sha256', $namespacedKey);
-
-        $keyPath = $basePath
-            . DIRECTORY_SEPARATOR
-            . substr($keyHash, 0, 2)
-            . DIRECTORY_SEPARATOR
-            . bin2hex($namespacedKey)
-            . '.doctrine.cache';
-
-        $hashedKeyPath = $basePath
-            . DIRECTORY_SEPARATOR
-            . substr($keyHash, 0, 2)
-            . DIRECTORY_SEPARATOR
-            . '_' . $keyHash
-            . '.doctrine.cache';
-
-        return array($key, $keyPath, $hashedKeyPath);
-    }
-
-    /**
-     * @dataProvider getPathLengthsToTest
-     *
-     * @param int  $length
-     * @param bool $pathShouldBeHashed
-     */
-    public function testWindowsPathLengthLimitIsCorrectlyHandled($length, $pathShouldBeHashed)
-    {
-        $this->directory = self::getBasePathForWindowsPathLengthTests($length);
-
-        list($key, $keyPath, $hashedKeyPath) = self::getKeyAndPathFittingLength($length, $this->directory);
-
-        $this->assertEquals($length, strlen($keyPath), 'Unhashed path should be of correct length.');
-
-        $cacheClass = get_class($this->_getCacheDriver());
-        /* @var $cache \Doctrine\Common\Cache\FileCache */
-        $cache = new $cacheClass($this->directory, '.doctrine.cache');
-
-        // Trick it into thinking this is windows.
-        $reflClass = new \ReflectionClass(FileCache::class);
-        $reflProp = $reflClass->getProperty('isRunningOnWindows');
-        $reflProp->setAccessible(true);
-        $reflProp->setValue($cache, true);
-        $reflProp->setAccessible(false);
-
-        $value = uniqid('value', true);
-
-        $cache->save($key, $value);
-        $this->assertEquals($value, $cache->fetch($key));
-
-        if ($pathShouldBeHashed) {
-            $this->assertFileExists($hashedKeyPath, 'Path generated for key should be hashed.');
-            unlink($hashedKeyPath);
-        } else {
-            $this->assertFileExists($keyPath, 'Path generated for key should not be hashed.');
-            unlink($keyPath);
-        }
-    }
-}
diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/CacheProviderTest.php b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/CacheProviderTest.php
deleted file mode 100644 (file)
index 5e11652..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-<?php
-
-namespace Doctrine\Tests\Common\Cache;
-
-class CacheProviderTest extends \Doctrine\Tests\DoctrineTestCase
-{
-    public function testFetchMultiWillFilterNonRequestedKeys()
-    {
-        /* @var $cache \Doctrine\Common\Cache\CacheProvider|\PHPUnit_Framework_MockObject_MockObject */
-        $cache = $this->getMockForAbstractClass(
-            'Doctrine\Common\Cache\CacheProvider',
-            array(),
-            '',
-            true,
-            true,
-            true,
-            array('doFetchMultiple')
-        );
-
-        $cache
-            ->expects($this->once())
-            ->method('doFetchMultiple')
-            ->will($this->returnValue(array(
-                '[foo][1]' => 'bar',
-                '[bar][1]' => 'baz',
-                '[baz][1]' => 'tab',
-            )));
-
-        $this->assertEquals(
-            array('foo' => 'bar', 'bar' => 'baz'),
-            $cache->fetchMultiple(array('foo', 'bar'))
-        );
-    }
-
-    public function testFailedDeleteAllDoesNotChangeNamespaceVersion()
-    {
-        /* @var $cache \Doctrine\Common\Cache\CacheProvider|\PHPUnit_Framework_MockObject_MockObject */
-        $cache = $this->getMockForAbstractClass(
-            'Doctrine\Common\Cache\CacheProvider',
-            array(),
-            '',
-            true,
-            true,
-            true,
-            array('doFetch', 'doSave', 'doContains')
-        );
-
-        $cache
-            ->expects($this->once())
-            ->method('doFetch')
-            ->with('DoctrineNamespaceCacheKey[]')
-            ->will($this->returnValue(false));
-
-        // doSave is only called once from deleteAll as we do not need to persist the default version in getNamespaceVersion()
-        $cache
-            ->expects($this->once())
-            ->method('doSave')
-            ->with('DoctrineNamespaceCacheKey[]')
-            ->will($this->returnValue(false));
-
-        // After a failed deleteAll() the local namespace version is not increased (still 1). Otherwise all data written afterwards
-        // would be lost outside the current instance.
-        $cache
-            ->expects($this->once())
-            ->method('doContains')
-            ->with('[key][1]')
-            ->will($this->returnValue(true));
-
-        $this->assertFalse($cache->deleteAll(), 'deleteAll() returns false when saving the namespace version fails');
-        $cache->contains('key');
-    }
-
-    public function testSaveMultipleNoFail()
-    {
-        /* @var $cache \Doctrine\Common\Cache\CacheProvider|\PHPUnit_Framework_MockObject_MockObject */
-        $cache = $this->getMockForAbstractClass(
-            'Doctrine\Common\Cache\CacheProvider',
-            array(),
-            '',
-            true,
-            true,
-            true,
-            array('doSave')
-        );
-
-        $cache
-            ->expects($this->at(1))
-            ->method('doSave')
-            ->with('[kerr][1]', 'verr', 0)
-            ->will($this->returnValue(false));
-
-        $cache
-            ->expects($this->at(2))
-            ->method('doSave')
-            ->with('[kok][1]', 'vok', 0)
-            ->will($this->returnValue(true));
-
-        $cache->saveMultiple(array(
-            'kerr'  => 'verr',
-            'kok'   => 'vok',
-        ));
-    }
-}
diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/CacheTest.php b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/CacheTest.php
deleted file mode 100644 (file)
index fb16e63..0000000
+++ /dev/null
@@ -1,473 +0,0 @@
-<?php
-
-namespace Doctrine\Tests\Common\Cache;
-
-use Doctrine\Common\Cache\Cache;
-use ArrayObject;
-
-abstract class CacheTest extends \Doctrine\Tests\DoctrineTestCase
-{
-    /**
-     * @dataProvider provideDataToCache
-     */
-    public function testSetContainsFetchDelete($value)
-    {
-        $cache = $this->_getCacheDriver();
-
-        // Test saving a value, checking if it exists, and fetching it back
-        $this->assertTrue($cache->save('key', $value));
-        $this->assertTrue($cache->contains('key'));
-        if (is_object($value)) {
-            $this->assertEquals($value, $cache->fetch('key'), 'Objects retrieved from the cache must be equal but not necessarily the same reference');
-        } else {
-            $this->assertSame($value, $cache->fetch('key'), 'Scalar and array data retrieved from the cache must be the same as the original, e.g. same type');
-        }
-
-        // Test deleting a value
-        $this->assertTrue($cache->delete('key'));
-        $this->assertFalse($cache->contains('key'));
-        $this->assertFalse($cache->fetch('key'));
-    }
-
-    /**
-     * @dataProvider provideDataToCache
-     */
-    public function testUpdateExistingEntry($value)
-    {
-        $cache = $this->_getCacheDriver();
-
-        $this->assertTrue($cache->save('key', 'old-value'));
-        $this->assertTrue($cache->contains('key'));
-
-        $this->assertTrue($cache->save('key', $value));
-        $this->assertTrue($cache->contains('key'));
-        if (is_object($value)) {
-            $this->assertEquals($value, $cache->fetch('key'), 'Objects retrieved from the cache must be equal but not necessarily the same reference');
-        } else {
-            $this->assertSame($value, $cache->fetch('key'), 'Scalar and array data retrieved from the cache must be the same as the original, e.g. same type');
-        }
-    }
-
-    public function testCacheKeyIsCaseSensitive()
-    {
-        $cache = $this->_getCacheDriver();
-
-        $this->assertTrue($cache->save('key', 'value'));
-        $this->assertTrue($cache->contains('key'));
-        $this->assertSame('value', $cache->fetch('key'));
-
-        $this->assertFalse($cache->contains('KEY'));
-        $this->assertFalse($cache->fetch('KEY'));
-
-        $cache->delete('KEY');
-        $this->assertTrue($cache->contains('key', 'Deleting cache item with different case must not affect other cache item'));
-    }
-
-    public function testFetchMultiple()
-    {
-        $cache  = $this->_getCacheDriver();
-        $values = $this->provideDataToCache();
-        $saved  = array();
-
-        foreach ($values as $key => $value) {
-            $cache->save($key, $value[0]);
-
-            $saved[$key] = $value[0];
-        }
-
-        $keys = array_keys($saved);
-
-        $this->assertEquals(
-            $saved,
-            $cache->fetchMultiple($keys),
-            'Testing fetchMultiple with different data types'
-        );
-        $this->assertEquals(
-            array_slice($saved, 0, 1),
-            $cache->fetchMultiple(array_slice($keys, 0, 1)),
-            'Testing fetchMultiple with a single key'
-        );
-
-        $keysWithNonExisting = array();
-        $keysWithNonExisting[] = 'non_existing1';
-        $keysWithNonExisting[] = $keys[0];
-        $keysWithNonExisting[] = 'non_existing2';
-        $keysWithNonExisting[] = $keys[1];
-        $keysWithNonExisting[] = 'non_existing3';
-
-        $this->assertEquals(
-            array_slice($saved, 0, 2),
-            $cache->fetchMultiple($keysWithNonExisting),
-            'Testing fetchMultiple with a subset of keys and mixed with non-existing ones'
-        );
-    }
-
-    public function testFetchMultipleWithNoKeys()
-    {
-        $cache = $this->_getCacheDriver();
-
-        $this->assertSame(array(), $cache->fetchMultiple(array()));
-    }
-
-    public function testSaveMultiple()
-    {
-        $cache = $this->_getCacheDriver();
-        $cache->deleteAll();
-
-        $data = array_map(function ($value) {
-            return $value[0];
-        }, $this->provideDataToCache());
-
-        $this->assertTrue($cache->saveMultiple($data));
-
-        $keys = array_keys($data);
-
-        $this->assertEquals($data, $cache->fetchMultiple($keys));
-    }
-
-    public function provideDataToCache()
-    {
-        $obj = new \stdClass();
-        $obj->foo = 'bar';
-        $obj2 = new \stdClass();
-        $obj2->bar = 'foo';
-        $obj2->obj = $obj;
-        $obj->obj2 = $obj2;
-
-        return array(
-            'array' => array(array('one', 2, 3.01)),
-            'string' => array('value'),
-            'string_invalid_utf8' => array("\xc3\x28"),
-            'string_null_byte' => array('with'."\0".'null char'),
-            'integer' => array(1),
-            'float' => array(1.5),
-            'object' => array(new ArrayObject(array('one', 2, 3.01))),
-            'object_recursive' => array($obj),
-            'true' => array(true),
-            // the following are considered FALSE in boolean context, but caches should still recognize their existence
-            'null' => array(null),
-            'false' => array(false),
-            'array_empty' => array(array()),
-            'string_zero' => array('0'),
-            'integer_zero' => array(0),
-            'float_zero' => array(0.0),
-            'string_empty' => array(''),
-        );
-    }
-
-    public function testDeleteIsSuccessfulWhenKeyDoesNotExist()
-    {
-        $cache = $this->_getCacheDriver();
-
-        $cache->delete('key');
-        $this->assertFalse($cache->contains('key'));
-        $this->assertTrue($cache->delete('key'));
-    }
-
-    public function testDeleteAll()
-    {
-        $cache = $this->_getCacheDriver();
-
-        $this->assertTrue($cache->save('key1', 1));
-        $this->assertTrue($cache->save('key2', 2));
-        $this->assertTrue($cache->deleteAll());
-        $this->assertFalse($cache->contains('key1'));
-        $this->assertFalse($cache->contains('key2'));
-    }
-
-    /**
-     * @dataProvider provideCacheIds
-     */
-    public function testCanHandleSpecialCacheIds($id)
-    {
-        $cache = $this->_getCacheDriver();
-
-        $this->assertTrue($cache->save($id, 'value'));
-        $this->assertTrue($cache->contains($id));
-        $this->assertEquals('value', $cache->fetch($id));
-
-        $this->assertTrue($cache->delete($id));
-        $this->assertFalse($cache->contains($id));
-        $this->assertFalse($cache->fetch($id));
-    }
-
-    public function testNoCacheIdCollisions()
-    {
-        $cache = $this->_getCacheDriver();
-
-        $ids = $this->provideCacheIds();
-
-        // fill cache with each id having a different value
-        foreach ($ids as $index => $id) {
-            $cache->save($id[0], $index);
-        }
-
-        // then check value of each cache id
-        foreach ($ids as $index => $id) {
-            $value = $cache->fetch($id[0]);
-            $this->assertNotFalse($value, sprintf('Failed to retrieve data for cache id "%s".', $id[0]));
-            if ($index !== $value) {
-                $this->fail(sprintf('Cache id "%s" collides with id "%s".', $id[0], $ids[$value][0]));
-            }
-        }
-    }
-
-    /**
-     * Returns cache ids with special characters that should still work.
-     *
-     * For example, the characters :\/<>"*?| are not valid in Windows filenames. So they must be encoded properly.
-     * Each cache id should be considered different from the others.
-     *
-     * @return array
-     */
-    public function provideCacheIds()
-    {
-        return array(
-            array(':'),
-            array('\\'),
-            array('/'),
-            array('<'),
-            array('>'),
-            array('"'),
-            array('*'),
-            array('?'),
-            array('|'),
-            array('['),
-            array(']'),
-            array('ä'),
-            array('a'),
-            array('é'),
-            array('e'),
-            array('.'), // directory traversal
-            array('..'), // directory traversal
-            array('-'),
-            array('_'),
-            array('$'),
-            array('%'),
-            array(' '),
-            array("\0"),
-            array(''),
-            array(str_repeat('a', 300)), // long key
-            array(str_repeat('a', 113)),
-        );
-    }
-
-    public function testLifetime()
-    {
-        $cache = $this->_getCacheDriver();
-        $cache->save('expire', 'value', 1);
-        $this->assertTrue($cache->contains('expire'), 'Data should not be expired yet');
-        // @TODO should more TTL-based tests pop up, so then we should mock the `time` API instead
-        sleep(2);
-        $this->assertFalse($cache->contains('expire'), 'Data should be expired');
-    }
-
-    public function testNoExpire()
-    {
-        $cache = $this->_getCacheDriver();
-        $cache->save('noexpire', 'value', 0);
-        // @TODO should more TTL-based tests pop up, so then we should mock the `time` API instead
-        sleep(1);
-        $this->assertTrue($cache->contains('noexpire'), 'Data with lifetime of zero should not expire');
-    }
-
-    public function testLongLifetime()
-    {
-        $cache = $this->_getCacheDriver();
-        $cache->save('longlifetime', 'value', 30 * 24 * 3600 + 1);
-        $this->assertTrue($cache->contains('longlifetime'), 'Data with lifetime > 30 days should be accepted');
-    }
-
-    public function testDeleteAllAndNamespaceVersioningBetweenCaches()
-    {
-        if ( ! $this->isSharedStorage()) {
-            $this->markTestSkipped('The cache storage needs to be shared.');
-        }
-
-        $cache1 = $this->_getCacheDriver();
-        $cache2 = $this->_getCacheDriver();
-
-        $this->assertTrue($cache1->save('key1', 1));
-        $this->assertTrue($cache2->save('key2', 2));
-
-        /* Both providers are initialized with the same namespace version, so
-         * they can see entries set by each other.
-         */
-        $this->assertTrue($cache1->contains('key1'));
-        $this->assertTrue($cache1->contains('key2'));
-        $this->assertTrue($cache2->contains('key1'));
-        $this->assertTrue($cache2->contains('key2'));
-
-        /* Deleting all entries through one provider will only increment the
-         * namespace version on that object (and in the cache itself, which new
-         * instances will use to initialize). The second provider will retain
-         * its original version and still see stale data.
-         */
-        $this->assertTrue($cache1->deleteAll());
-        $this->assertFalse($cache1->contains('key1'));
-        $this->assertFalse($cache1->contains('key2'));
-        $this->assertTrue($cache2->contains('key1'));
-        $this->assertTrue($cache2->contains('key2'));
-
-        /* A new cache provider should not see the deleted entries, since its
-         * namespace version will be initialized.
-         */
-        $cache3 = $this->_getCacheDriver();
-        $this->assertFalse($cache3->contains('key1'));
-        $this->assertFalse($cache3->contains('key2'));
-    }
-
-    public function testFlushAll()
-    {
-        $cache = $this->_getCacheDriver();
-
-        $this->assertTrue($cache->save('key1', 1));
-        $this->assertTrue($cache->save('key2', 2));
-        $this->assertTrue($cache->flushAll());
-        $this->assertFalse($cache->contains('key1'));
-        $this->assertFalse($cache->contains('key2'));
-    }
-
-    public function testFlushAllAndNamespaceVersioningBetweenCaches()
-    {
-        if ( ! $this->isSharedStorage()) {
-            $this->markTestSkipped('The cache storage needs to be shared.');
-        }
-
-        $cache1 = $this->_getCacheDriver();
-        $cache2 = $this->_getCacheDriver();
-
-        /* Deleting all elements from the first provider should increment its
-         * namespace version before saving the first entry.
-         */
-        $cache1->deleteAll();
-        $this->assertTrue($cache1->save('key1', 1));
-
-        /* The second provider will be initialized with the same namespace
-         * version upon its first save operation.
-         */
-        $this->assertTrue($cache2->save('key2', 2));
-
-        /* Both providers have the same namespace version and can see entries
-         * set by each other.
-         */
-        $this->assertTrue($cache1->contains('key1'));
-        $this->assertTrue($cache1->contains('key2'));
-        $this->assertTrue($cache2->contains('key1'));
-        $this->assertTrue($cache2->contains('key2'));
-
-        /* Flushing all entries through one cache will remove all entries from
-         * the cache but leave their namespace version as-is.
-         */
-        $this->assertTrue($cache1->flushAll());
-        $this->assertFalse($cache1->contains('key1'));
-        $this->assertFalse($cache1->contains('key2'));
-        $this->assertFalse($cache2->contains('key1'));
-        $this->assertFalse($cache2->contains('key2'));
-
-        /* Inserting a new entry will use the same, incremented namespace
-         * version, and it will be visible to both providers.
-         */
-        $this->assertTrue($cache1->save('key1', 1));
-        $this->assertTrue($cache1->contains('key1'));
-        $this->assertTrue($cache2->contains('key1'));
-
-        /* A new cache provider will be initialized with the original namespace
-         * version and not share any visibility with the first two providers.
-         */
-        $cache3 = $this->_getCacheDriver();
-        $this->assertFalse($cache3->contains('key1'));
-        $this->assertFalse($cache3->contains('key2'));
-        $this->assertTrue($cache3->save('key3', 3));
-        $this->assertTrue($cache3->contains('key3'));
-    }
-
-    public function testNamespace()
-    {
-        $cache = $this->_getCacheDriver();
-
-        $cache->setNamespace('ns1_');
-
-        $this->assertTrue($cache->save('key1', 1));
-        $this->assertTrue($cache->contains('key1'));
-
-        $cache->setNamespace('ns2_');
-
-        $this->assertFalse($cache->contains('key1'));
-    }
-
-    public function testDeleteAllNamespace()
-    {
-        $cache = $this->_getCacheDriver();
-
-        $cache->setNamespace('ns1');
-        $this->assertFalse($cache->contains('key1'));
-        $cache->save('key1', 'test');
-        $this->assertTrue($cache->contains('key1'));
-
-        $cache->setNamespace('ns2');
-        $this->assertFalse($cache->contains('key1'));
-        $cache->save('key1', 'test');
-        $this->assertTrue($cache->contains('key1'));
-
-        $cache->setNamespace('ns1');
-        $this->assertTrue($cache->contains('key1'));
-        $cache->deleteAll();
-        $this->assertFalse($cache->contains('key1'));
-
-        $cache->setNamespace('ns2');
-        $this->assertTrue($cache->contains('key1'));
-        $cache->deleteAll();
-        $this->assertFalse($cache->contains('key1'));
-    }
-
-    /**
-     * @group DCOM-43
-     */
-    public function testGetStats()
-    {
-        $cache = $this->_getCacheDriver();
-        $stats = $cache->getStats();
-
-        $this->assertArrayHasKey(Cache::STATS_HITS, $stats);
-        $this->assertArrayHasKey(Cache::STATS_MISSES, $stats);
-        $this->assertArrayHasKey(Cache::STATS_UPTIME, $stats);
-        $this->assertArrayHasKey(Cache::STATS_MEMORY_USAGE, $stats);
-        $this->assertArrayHasKey(Cache::STATS_MEMORY_AVAILABLE, $stats);
-    }
-
-    public function testSaveReturnsTrueWithAndWithoutTTlSet()
-    {
-        $cache = $this->_getCacheDriver();
-        $cache->deleteAll();
-        $this->assertTrue($cache->save('without_ttl', 'without_ttl'));
-        $this->assertTrue($cache->save('with_ttl', 'with_ttl', 3600));
-    }
-
-    public function testValueThatIsFalseBooleanIsProperlyRetrieved()
-    {
-        $cache = $this->_getCacheDriver();
-        $cache->deleteAll();
-
-        $this->assertTrue($cache->save('key1', false));
-        $this->assertTrue($cache->contains('key1'));
-        $this->assertFalse($cache->fetch('key1'));
-    }
-
-    /**
-     * Return whether multiple cache providers share the same storage.
-     *
-     * This is used for skipping certain tests for shared storage behavior.
-     *
-     * @return bool
-     */
-    protected function isSharedStorage()
-    {
-        return true;
-    }
-
-    /**
-     * @return \Doctrine\Common\Cache\CacheProvider
-     */
-    abstract protected function _getCacheDriver();
-}
diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/ChainCacheTest.php b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/ChainCacheTest.php
deleted file mode 100644 (file)
index a3c013b..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-<?php
-
-namespace Doctrine\Tests\Common\Cache;
-
-use Doctrine\Common\Cache\ApcCache;
-use Doctrine\Common\Cache\ArrayCache;
-use Doctrine\Common\Cache\ChainCache;
-
-class ChainCacheTest extends CacheTest
-{
-    protected function _getCacheDriver()
-    {
-        return new ChainCache(array(new ArrayCache()));
-    }
-
-    public function testLifetime()
-    {
-        $this->markTestSkipped('The ChainCache test uses ArrayCache which does not implement TTL currently.');
-    }
-
-    public function testGetStats()
-    {
-        $cache = $this->_getCacheDriver();
-        $stats = $cache->getStats();
-
-        $this->assertInternalType('array', $stats);
-    }
-
-    public function testOnlyFetchFirstOne()
-    {
-        $cache1 = new ArrayCache();
-        $cache2 = $this->getMockForAbstractClass('Doctrine\Common\Cache\CacheProvider');
-
-        $cache2->expects($this->never())->method('doFetch');
-
-        $chainCache = new ChainCache(array($cache1, $cache2));
-        $chainCache->save('id', 'bar');
-
-        $this->assertEquals('bar', $chainCache->fetch('id'));
-    }
-
-    public function testFetchPropagateToFastestCache()
-    {
-        $cache1 = new ArrayCache();
-        $cache2 = new ArrayCache();
-
-        $cache2->save('bar', 'value');
-
-        $chainCache = new ChainCache(array($cache1, $cache2));
-
-        $this->assertFalse($cache1->contains('bar'));
-
-        $result = $chainCache->fetch('bar');
-
-        $this->assertEquals('value', $result);
-        $this->assertTrue($cache2->contains('bar'));
-    }
-
-    public function testNamespaceIsPropagatedToAllProviders()
-    {
-        $cache1 = new ArrayCache();
-        $cache2 = new ArrayCache();
-
-        $chainCache = new ChainCache(array($cache1, $cache2));
-        $chainCache->setNamespace('bar');
-
-        $this->assertEquals('bar', $cache1->getNamespace());
-        $this->assertEquals('bar', $cache2->getNamespace());
-    }
-
-    public function testDeleteToAllProviders()
-    {
-        $cache1 = $this->getMockForAbstractClass('Doctrine\Common\Cache\CacheProvider');
-        $cache2 = $this->getMockForAbstractClass('Doctrine\Common\Cache\CacheProvider');
-
-        $cache1->expects($this->once())->method('doDelete');
-        $cache2->expects($this->once())->method('doDelete');
-
-        $chainCache = new ChainCache(array($cache1, $cache2));
-        $chainCache->delete('bar');
-    }
-
-    public function testFlushToAllProviders()
-    {
-        $cache1 = $this->getMockForAbstractClass('Doctrine\Common\Cache\CacheProvider');
-        $cache2 = $this->getMockForAbstractClass('Doctrine\Common\Cache\CacheProvider');
-
-        $cache1->expects($this->once())->method('doFlush');
-        $cache2->expects($this->once())->method('doFlush');
-
-        $chainCache = new ChainCache(array($cache1, $cache2));
-        $chainCache->flushAll();
-    }
-
-    protected function isSharedStorage()
-    {
-        return false;
-    }
-}
\ No newline at end of file
diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/CouchbaseCacheTest.php b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/CouchbaseCacheTest.php
deleted file mode 100644 (file)
index f42b3a7..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-
-namespace Doctrine\Tests\Common\Cache;
-
-use Couchbase;
-use Doctrine\Common\Cache\CouchbaseCache;
-
-/**
- * @requires extension couchbase
- */
-class CouchbaseCacheTest extends CacheTest
-{
-    private $couchbase;
-
-    protected function setUp()
-    {
-        try {
-            $this->couchbase = new Couchbase('127.0.0.1', 'Administrator', 'password', 'default');
-        } catch(Exception $ex) {
-             $this->markTestSkipped('Could not instantiate the Couchbase cache because of: ' . $ex);
-        }
-    }
-
-    protected function _getCacheDriver()
-    {
-        $driver = new CouchbaseCache();
-        $driver->setCouchbase($this->couchbase);
-        return $driver;
-    }
-}
\ No newline at end of file
diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/FileCacheTest.php b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/FileCacheTest.php
deleted file mode 100644 (file)
index f27d542..0000000
+++ /dev/null
@@ -1,268 +0,0 @@
-<?php
-
-namespace Doctrine\Tests\Common\Cache;
-
-use Doctrine\Common\Cache\Cache;
-
-/**
- * @group DCOM-101
- */
-class FileCacheTest extends \Doctrine\Tests\DoctrineTestCase
-{
-    /**
-     * @var \Doctrine\Common\Cache\FileCache
-     */
-    private $driver;
-
-    protected function setUp()
-    {
-        $this->driver = $this->getMock(
-            'Doctrine\Common\Cache\FileCache',
-            array('doFetch', 'doContains', 'doSave'),
-            array(), '', false
-        );
-    }
-
-    public function testFilenameShouldCreateThePathWithOneSubDirectory()
-    {
-        $cache          = $this->driver;
-        $method         = new \ReflectionMethod($cache, 'getFilename');
-        $key            = 'item-key';
-        $expectedDir    = array(
-            '84',
-        );
-        $expectedDir    = implode(DIRECTORY_SEPARATOR, $expectedDir);
-
-        $method->setAccessible(true);
-
-        $path       = $method->invoke($cache, $key);
-        $dirname    = pathinfo($path, PATHINFO_DIRNAME);
-
-        $this->assertEquals(DIRECTORY_SEPARATOR . $expectedDir, $dirname);
-    }
-
-    public function testFileExtensionCorrectlyEscaped()
-    {
-        $driver1 = $this->getMock(
-            'Doctrine\Common\Cache\FileCache',
-            array('doFetch', 'doContains', 'doSave'),
-            array(__DIR__, '.*')
-        );
-        $driver2 = $this->getMock(
-            'Doctrine\Common\Cache\FileCache',
-            array('doFetch', 'doContains', 'doSave'),
-            array(__DIR__, '.php')
-        );
-
-        $doGetStats = new \ReflectionMethod($driver1, 'doGetStats');
-
-        $doGetStats->setAccessible(true);
-
-        $stats1 = $doGetStats->invoke($driver1);
-        $stats2 = $doGetStats->invoke($driver2);
-
-        $this->assertSame(0, $stats1[Cache::STATS_MEMORY_USAGE]);
-        $this->assertGreaterThan(0, $stats2[Cache::STATS_MEMORY_USAGE]);
-    }
-
-    /**
-     * @group DCOM-266
-     */
-    public function testFileExtensionSlashCorrectlyEscaped()
-    {
-        $driver = $this->getMock(
-            'Doctrine\Common\Cache\FileCache',
-            array('doFetch', 'doContains', 'doSave'),
-            array(__DIR__ . '/../', DIRECTORY_SEPARATOR . basename(__FILE__))
-        );
-
-        $doGetStats = new \ReflectionMethod($driver, 'doGetStats');
-
-        $doGetStats->setAccessible(true);
-
-        $stats = $doGetStats->invoke($driver);
-
-        $this->assertGreaterThan(0, $stats[Cache::STATS_MEMORY_USAGE]);
-    }
-
-    public function testNonIntUmaskThrowsInvalidArgumentException()
-    {
-        $this->setExpectedException('InvalidArgumentException');
-
-        $this->getMock(
-            'Doctrine\Common\Cache\FileCache',
-            array('doFetch', 'doContains', 'doSave'),
-            array('', '', 'invalid')
-        );
-    }
-
-    public function testGetDirectoryReturnsRealpathDirectoryString()
-    {
-        $directory = __DIR__ . '/../';
-        $driver = $this->getMock(
-            'Doctrine\Common\Cache\FileCache',
-            array('doFetch', 'doContains', 'doSave'),
-            array($directory)
-        );
-
-        $doGetDirectory = new \ReflectionMethod($driver, 'getDirectory');
-
-        $actualDirectory = $doGetDirectory->invoke($driver);
-        $expectedDirectory = realpath($directory);
-
-        $this->assertEquals($expectedDirectory, $actualDirectory);
-    }
-
-    public function testGetExtensionReturnsExtensionString()
-    {
-        $directory = __DIR__ . '/../';
-        $extension = DIRECTORY_SEPARATOR . basename(__FILE__);
-        $driver = $this->getMock(
-            'Doctrine\Common\Cache\FileCache',
-            array('doFetch', 'doContains', 'doSave'),
-            array($directory, $extension)
-        );
-
-        $doGetExtension = new \ReflectionMethod($driver, 'getExtension');
-
-        $actualExtension = $doGetExtension->invoke($driver);
-
-        $this->assertEquals($extension, $actualExtension);
-    }
-
-    const WIN_MAX_PATH_LEN = 258;
-
-    public static function getBasePathForWindowsPathLengthTests($pathLength)
-    {
-        // Not using __DIR__ because it can get screwed up when xdebug debugger is attached.
-        $basePath = realpath(sys_get_temp_dir()) . '/' . uniqid('doctrine-cache', true);
-
-        /** @noinspection MkdirRaceConditionInspection */
-        @mkdir($basePath);
-
-        $basePath = realpath($basePath);
-
-        // Test whether the desired path length is odd or even.
-        $desiredPathLengthIsOdd = ($pathLength % 2) == 1;
-
-        // If the cache key is not too long, the filecache codepath will add
-        // a slash and bin2hex($key). The length of the added portion will be an odd number.
-        // len(desired) = len(base path) + len(slash . bin2hex($key))
-        //          odd = even           + odd
-        //         even = odd            + odd
-        $basePathLengthShouldBeOdd = !$desiredPathLengthIsOdd;
-
-        $basePathLengthIsOdd = (strlen($basePath) % 2) == 1;
-
-        // If the base path needs to be odd or even where it is not, we add an odd number of
-        // characters as a pad. In this case, we're adding '\aa' (or '/aa' depending on platform)
-        // This is all to make it so that the key we're testing would result in
-        // a path that is exactly the length we want to test IF the path length limit
-        // were not in place in FileCache.
-        if ($basePathLengthIsOdd != $basePathLengthShouldBeOdd) {
-            $basePath .= DIRECTORY_SEPARATOR . "aa";
-        }
-
-        return $basePath;
-    }
-
-    /**
-     * @param int    $length
-     * @param string $basePath
-     *
-     * @return array
-     */
-    public static function getKeyAndPathFittingLength($length, $basePath)
-    {
-        $baseDirLength = strlen($basePath);
-        $extensionLength = strlen('.doctrine.cache');
-        $directoryLength = strlen(DIRECTORY_SEPARATOR . 'aa' . DIRECTORY_SEPARATOR);
-        $keyLength = $length - ($baseDirLength + $extensionLength + $directoryLength); // - 1 because of slash
-
-        $key = str_repeat('a', floor($keyLength / 2));
-
-        $keyHash = hash('sha256', $key);
-
-        $keyPath = $basePath
-            . DIRECTORY_SEPARATOR
-            . substr($keyHash, 0, 2)
-            . DIRECTORY_SEPARATOR
-            . bin2hex($key)
-            . '.doctrine.cache';
-
-        $hashedKeyPath = $basePath
-            . DIRECTORY_SEPARATOR
-            . substr($keyHash, 0, 2)
-            . DIRECTORY_SEPARATOR
-            . '_' . $keyHash
-            . '.doctrine.cache';
-
-        return array($key, $keyPath, $hashedKeyPath);
-    }
-
-    public function getPathLengthsToTest()
-    {
-        // Windows officially supports 260 bytes including null terminator
-        // 259 characters is too large due to PHP bug (https://bugs.php.net/bug.php?id=70943)
-        // 260 characters is too large - null terminator is included in allowable length
-        return array(
-            array(257, false),
-            array(258, false),
-            array(259, true),
-            array(260, true)
-        );
-    }
-
-    /**
-     * @runInSeparateProcess
-     * @dataProvider getPathLengthsToTest
-     *
-     * @covers \Doctrine\Common\Cache\FileCache::getFilename
-     *
-     * @param int  $length
-     * @param bool $pathShouldBeHashed
-     */
-    public function testWindowsPathLengthLimitationsAreCorrectlyRespected($length, $pathShouldBeHashed)
-    {
-        if (! defined('PHP_WINDOWS_VERSION_BUILD')) {
-            define('PHP_WINDOWS_VERSION_BUILD', 'Yes, this is the "usual suspect", with the usual limitations');
-        }
-
-        $basePath = self::getBasePathForWindowsPathLengthTests($length);
-
-        $fileCache = $this->getMockForAbstractClass(
-            'Doctrine\Common\Cache\FileCache',
-            array($basePath, '.doctrine.cache')
-        );
-
-        list($key, $keyPath, $hashedKeyPath) = self::getKeyAndPathFittingLength($length, $basePath);
-
-        $getFileName = new \ReflectionMethod($fileCache, 'getFilename');
-
-        $getFileName->setAccessible(true);
-
-        $this->assertEquals(
-            $length,
-            strlen($keyPath),
-            sprintf('Path expected to be %d characters long is %d characters long', $length, strlen($keyPath))
-        );
-
-        if ($pathShouldBeHashed) {
-            $keyPath = $hashedKeyPath;
-        }
-
-        if ($pathShouldBeHashed) {
-            $this->assertSame(
-                $hashedKeyPath,
-                $getFileName->invoke($fileCache, $key),
-                'Keys should be hashed correctly if they are over the limit.'
-            );
-        } else {
-            $this->assertSame(
-                $keyPath,
-                $getFileName->invoke($fileCache, $key),
-                'Keys below limit of the allowed length are used directly, unhashed'
-            );
-        }
-    }
-}
diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/FilesystemCacheTest.php b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/FilesystemCacheTest.php
deleted file mode 100644 (file)
index 9e7c9e8..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-
-namespace Doctrine\Tests\Common\Cache;
-
-use Doctrine\Common\Cache\Cache;
-use Doctrine\Common\Cache\FilesystemCache;
-
-/**
- * @group DCOM-101
- */
-class FilesystemCacheTest extends BaseFileCacheTest
-{
-    public function testGetStats()
-    {
-        $cache = $this->_getCacheDriver();
-        $stats = $cache->getStats();
-
-        $this->assertNull($stats[Cache::STATS_HITS]);
-        $this->assertNull($stats[Cache::STATS_MISSES]);
-        $this->assertNull($stats[Cache::STATS_UPTIME]);
-        $this->assertEquals(0, $stats[Cache::STATS_MEMORY_USAGE]);
-        $this->assertGreaterThan(0, $stats[Cache::STATS_MEMORY_AVAILABLE]);
-    }
-
-    public function testCacheInSharedDirectoryIsPerExtension()
-    {
-        $cache1 = new FilesystemCache($this->directory, '.foo');
-        $cache2 = new FilesystemCache($this->directory, '.bar');
-
-        $this->assertTrue($cache1->save('key1', 11));
-        $this->assertTrue($cache1->save('key2', 12));
-
-        $this->assertTrue($cache2->save('key1', 21));
-        $this->assertTrue($cache2->save('key2', 22));
-
-        $this->assertSame(11, $cache1->fetch('key1'), 'Cache value must not be influenced by a different cache in the same directory but different extension');
-        $this->assertSame(12, $cache1->fetch('key2'));
-        $this->assertTrue($cache1->flushAll());
-        $this->assertFalse($cache1->fetch('key1'), 'flushAll() must delete all items with the current extension');
-        $this->assertFalse($cache1->fetch('key2'));
-
-        $this->assertSame(21, $cache2->fetch('key1'), 'flushAll() must not remove items with a different extension in a shared directory');
-        $this->assertSame(22, $cache2->fetch('key2'));
-    }
-
-    public function testFlushAllWithNoExtension()
-    {
-        $cache = new FilesystemCache($this->directory, '');
-
-        $this->assertTrue($cache->save('key1', 1));
-        $this->assertTrue($cache->save('key2', 2));
-        $this->assertTrue($cache->flushAll());
-        $this->assertFalse($cache->contains('key1'));
-        $this->assertFalse($cache->contains('key2'));
-    }
-
-    protected function _getCacheDriver()
-    {
-        return new FilesystemCache($this->directory);
-    }
-}
diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/MemcacheCacheTest.php b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/MemcacheCacheTest.php
deleted file mode 100644 (file)
index 74853b8..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-
-namespace Doctrine\Tests\Common\Cache;
-
-use Doctrine\Common\Cache\MemcacheCache;
-use Memcache;
-
-/**
- * @requires extension memcache
- */
-class MemcacheCacheTest extends CacheTest
-{
-    private $memcache;
-
-    protected function setUp()
-    {
-        $this->memcache = new Memcache();
-
-        if (@$this->memcache->connect('localhost', 11211) === false) {
-            unset($this->memcache);
-            $this->markTestSkipped('Cannot connect to Memcache.');
-        }
-    }
-
-    protected function tearDown()
-    {
-        if ($this->memcache instanceof Memcache) {
-            $this->memcache->flush();
-        }
-    }
-
-    /**
-     * {@inheritdoc}
-     *
-     * Memcache does not support " " and null byte as key so we remove them from the tests.
-     */
-    public function provideCacheIds()
-    {
-        $ids = parent::provideCacheIds();
-        unset($ids[21], $ids[22]);
-
-        return $ids;
-    }
-
-    public function testGetMemcacheReturnsInstanceOfMemcache()
-    {
-        $this->assertInstanceOf('Memcache', $this->_getCacheDriver()->getMemcache());
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    protected function _getCacheDriver()
-    {
-        $driver = new MemcacheCache();
-        $driver->setMemcache($this->memcache);
-        return $driver;
-    }
-}
diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/MemcachedCacheTest.php b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/MemcachedCacheTest.php
deleted file mode 100644 (file)
index fbcf5c3..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-
-namespace Doctrine\Tests\Common\Cache;
-
-use Doctrine\Common\Cache\MemcachedCache;
-use Memcached;
-
-/**
- * @requires extension memcached
- */
-class MemcachedCacheTest extends CacheTest
-{
-    private $memcached;
-
-    protected function setUp()
-    {
-        $this->memcached = new Memcached();
-        $this->memcached->setOption(Memcached::OPT_COMPRESSION, false);
-        $this->memcached->addServer('127.0.0.1', 11211);
-
-        if (@fsockopen('127.0.0.1', 11211) === false) {
-            unset($this->memcached);
-            $this->markTestSkipped('Cannot connect to Memcached.');
-        }
-    }
-
-    protected function tearDown()
-    {
-        if ($this->memcached instanceof Memcached) {
-            $this->memcached->flush();
-        }
-    }
-
-    /**
-     * {@inheritdoc}
-     *
-     * Memcached does not support " ", null byte and very long keys so we remove them from the tests.
-     */
-    public function provideCacheIds()
-    {
-        $ids = parent::provideCacheIds();
-        unset($ids[21], $ids[22], $ids[24]);
-
-        return $ids;
-    }
-
-    public function testGetMemcachedReturnsInstanceOfMemcached()
-    {
-        $this->assertInstanceOf('Memcached', $this->_getCacheDriver()->getMemcached());
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    protected function _getCacheDriver()
-    {
-        $driver = new MemcachedCache();
-        $driver->setMemcached($this->memcached);
-        return $driver;
-    }
-}
diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/MongoDBCacheTest.php b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/MongoDBCacheTest.php
deleted file mode 100644 (file)
index fa7cfac..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-
-namespace Doctrine\Tests\Common\Cache;
-
-use Doctrine\Common\Cache\Cache;
-use Doctrine\Common\Cache\MongoDBCache;
-use MongoClient;
-use MongoCollection;
-
-/**
- * @requires extension mongo
- */
-class MongoDBCacheTest extends CacheTest
-{
-    /**
-     * @var MongoCollection
-     */
-    private $collection;
-
-    protected function setUp()
-    {
-        if ( ! version_compare(phpversion('mongo'), '1.3.0', '>=')) {
-            $this->markTestSkipped('Mongo >= 1.3.0 is required.');
-        }
-
-        $mongo = new MongoClient();
-        $this->collection = $mongo->selectCollection('doctrine_common_cache', 'test');
-    }
-
-    protected function tearDown()
-    {
-        if ($this->collection instanceof MongoCollection) {
-            $this->collection->drop();
-        }
-    }
-
-    public function testGetStats()
-    {
-        $cache = $this->_getCacheDriver();
-        $stats = $cache->getStats();
-
-        $this->assertNull($stats[Cache::STATS_HITS]);
-        $this->assertNull($stats[Cache::STATS_MISSES]);
-        $this->assertGreaterThan(0, $stats[Cache::STATS_UPTIME]);
-        $this->assertEquals(0, $stats[Cache::STATS_MEMORY_USAGE]);
-        $this->assertNull($stats[Cache::STATS_MEMORY_AVAILABLE]);
-    }
-
-    /**
-     * @group 108
-     */
-    public function testMongoCursorExceptionsDoNotBubbleUp()
-    {
-        /* @var $collection \MongoCollection|\PHPUnit_Framework_MockObject_MockObject */
-        $collection = $this->getMock('MongoCollection', array(), array(), '', false);
-
-        $collection->expects(self::once())->method('update')->willThrowException(new \MongoCursorException());
-
-        $cache = new MongoDBCache($collection);
-
-        self::assertFalse($cache->save('foo', 'bar'));
-    }
-
-    protected function _getCacheDriver()
-    {
-        return new MongoDBCache($this->collection);
-    }
-}
diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/PhpFileCacheTest.php b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/PhpFileCacheTest.php
deleted file mode 100644 (file)
index d1851cb..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-<?php
-
-namespace Doctrine\Tests\Common\Cache;
-
-use Doctrine\Common\Cache\Cache;
-use Doctrine\Common\Cache\PhpFileCache;
-
-/**
- * @group DCOM-101
- */
-class PhpFileCacheTest extends BaseFileCacheTest
-{
-    public function provideDataToCache()
-    {
-        $data = parent::provideDataToCache();
-
-        unset($data['object'], $data['object_recursive']); // PhpFileCache only allows objects that implement __set_state() and fully support var_export()
-
-        if (PHP_VERSION_ID < 70002) {
-            unset($data['float_zero']); // var_export exports float(0) as int(0): https://bugs.php.net/bug.php?id=66179
-        }
-
-        return $data;
-    }
-
-    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[Cache::STATS_HITS]);
-        $this->assertNull($stats[Cache::STATS_MISSES]);
-        $this->assertNull($stats[Cache::STATS_UPTIME]);
-        $this->assertEquals(0, $stats[Cache::STATS_MEMORY_USAGE]);
-        $this->assertGreaterThan(0, $stats[Cache::STATS_MEMORY_AVAILABLE]);
-    }
-
-    protected function _getCacheDriver()
-    {
-        return new PhpFileCache($this->directory);
-    }
-}
-
-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/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/PredisCacheTest.php b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/PredisCacheTest.php
deleted file mode 100644 (file)
index e20839d..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-<?php
-
-namespace Doctrine\Tests\Common\Cache;
-
-use Doctrine\Common\Cache\Cache;
-use Doctrine\Common\Cache\PredisCache;
-use Predis\Client;
-use Predis\Connection\ConnectionException;
-
-class PredisCacheTest extends CacheTest
-{
-    private $client;
-
-    protected function setUp()
-    {
-        if (!class_exists('Predis\Client')) {
-            $this->markTestSkipped('Predis\Client is missing. Make sure to "composer install" to have all dev dependencies.');
-        }
-
-        $this->client = new Client();
-
-        try {
-            $this->client->connect();
-        } catch (ConnectionException $e) {
-            $this->markTestSkipped('Cannot connect to Redis because of: ' . $e);
-        }
-    }
-
-    public function testHitMissesStatsAreProvided()
-    {
-        $cache = $this->_getCacheDriver();
-        $stats = $cache->getStats();
-
-        $this->assertNotNull($stats[Cache::STATS_HITS]);
-        $this->assertNotNull($stats[Cache::STATS_MISSES]);
-    }
-
-    /**
-     * @return PredisCache
-     */
-    protected function _getCacheDriver()
-    {
-        return new PredisCache($this->client);
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * @dataProvider provideDataToCache
-     */
-    public function testSetContainsFetchDelete($value)
-    {
-        if (array() === $value) {
-            $this->markTestIncomplete(
-                'Predis currently doesn\'t support saving empty array values. '
-                . 'See https://github.com/nrk/predis/issues/241'
-            );
-        }
-
-        parent::testSetContainsFetchDelete($value);
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * @dataProvider provideDataToCache
-     */
-    public function testUpdateExistingEntry($value)
-    {
-        if (array() === $value) {
-            $this->markTestIncomplete(
-                'Predis currently doesn\'t support saving empty array values. '
-                . 'See https://github.com/nrk/predis/issues/241'
-            );
-        }
-
-        parent::testUpdateExistingEntry($value);
-    }
-
-    public function testAllowsGenericPredisClient()
-    {
-        /* @var $predisClient \Predis\ClientInterface */
-        $predisClient = $this->getMock('Predis\\ClientInterface');
-
-        $this->assertInstanceOf('Doctrine\\Common\\Cache\\PredisCache', new PredisCache($predisClient));
-    }
-}
diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/RedisCacheTest.php b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/RedisCacheTest.php
deleted file mode 100644 (file)
index 5fb6a11..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-
-namespace Doctrine\Tests\Common\Cache;
-
-use Doctrine\Common\Cache\RedisCache;
-use Doctrine\Common\Cache\Cache;
-
-/**
- * @requires extension redis
- */
-class RedisCacheTest extends CacheTest
-{
-    private $_redis;
-
-    protected function setUp()
-    {
-        $this->_redis = new \Redis();
-        $ok = @$this->_redis->connect('127.0.0.1');
-        if (!$ok) {
-            $this->markTestSkipped('Cannot connect to Redis.');
-        }
-    }
-
-    public function testHitMissesStatsAreProvided()
-    {
-        $cache = $this->_getCacheDriver();
-        $stats = $cache->getStats();
-
-        $this->assertNotNull($stats[Cache::STATS_HITS]);
-        $this->assertNotNull($stats[Cache::STATS_MISSES]);
-    }
-
-    public function testGetRedisReturnsInstanceOfRedis()
-    {
-        $this->assertInstanceOf('Redis', $this->_getCacheDriver()->getRedis());
-    }
-
-    public function testSerializerOptionWithOutIgbinaryExtension()
-    {
-        if (defined('Redis::SERIALIZER_IGBINARY') && extension_loaded('igbinary')) {
-            $this->markTestSkipped('Extension igbinary is loaded.');
-        }
-
-        $this->assertEquals(
-            \Redis::SERIALIZER_PHP,
-            $this->_getCacheDriver()->getRedis()->getOption(\Redis::OPT_SERIALIZER)
-        );
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    protected function _getCacheDriver()
-    {
-        $driver = new RedisCache();
-        $driver->setRedis($this->_redis);
-        return $driver;
-    }
-}
diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/RiakCacheTest.php b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/RiakCacheTest.php
deleted file mode 100644 (file)
index e7d5f3d..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-<?php
-
-namespace Doctrine\Tests\Common\Cache;
-
-use Riak\Bucket;
-use Riak\Connection;
-use Riak\Exception;
-use Doctrine\Common\Cache\RiakCache;
-
-/**
- * RiakCache test
- *
- * @group Riak
- * @requires extension riak
- */
-class RiakCacheTest extends CacheTest
-{
-    /**
-     * @var \Riak\Connection
-     */
-    private $connection;
-
-    /**
-     * @var \Riak\Bucket
-     */
-    private $bucket;
-
-    protected function setUp()
-    {
-        try {
-            $this->connection = new Connection('127.0.0.1', 8087);
-            $this->bucket     = new Bucket($this->connection, 'test');
-        } catch (Exception\RiakException $e) {
-            $this->markTestSkipped('Cannot connect to Riak.');
-        }
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function testGetStats()
-    {
-        $cache = $this->_getCacheDriver();
-        $stats = $cache->getStats();
-
-        $this->assertNull($stats);
-    }
-
-    /**
-     * Retrieve RiakCache instance.
-     *
-     * @return \Doctrine\Common\Cache\RiakCache
-     */
-    protected function _getCacheDriver()
-    {
-        return new RiakCache($this->bucket);
-    }
-}
diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/SQLite3CacheTest.php b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/SQLite3CacheTest.php
deleted file mode 100644 (file)
index f0c5b0b..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-
-namespace Doctrine\Tests\Common\Cache;
-
-use Doctrine\Common\Cache\Cache;
-use Doctrine\Common\Cache\SQLite3Cache;
-use SQLite3;
-
-/**
- * @requires extension sqlite3
- */
-class SQLite3Test extends CacheTest
-{
-    private $file;
-    private $sqlite;
-
-    protected function setUp()
-    {
-        $this->file = tempnam(null, 'doctrine-cache-test-');
-        unlink($this->file);
-        $this->sqlite = new SQLite3($this->file);
-    }
-
-    protected function tearDown()
-    {
-        $this->sqlite = null;  // DB must be closed before
-        unlink($this->file);
-    }
-
-    public function testGetStats()
-    {
-        $this->assertNull($this->_getCacheDriver()->getStats());
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    protected function _getCacheDriver()
-    {
-        return new SQLite3Cache($this->sqlite, 'test_table');
-    }
-}
diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/VoidCacheTest.php b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/VoidCacheTest.php
deleted file mode 100644 (file)
index 8ab7e5b..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-<?php
-
-namespace Doctrine\Tests\Common\Cache;
-
-use Doctrine\Common\Cache\VoidCache;
-
-/**
- * @covers \Doctrine\Common\Cache\VoidCache
- */
-class VoidCacheTest extends \PHPUnit_Framework_TestCase
-{
-    public function testShouldAlwaysReturnFalseOnContains()
-    {
-        $cache = new VoidCache();
-
-        $this->assertFalse($cache->contains('foo'));
-        $this->assertFalse($cache->contains('bar'));
-    }
-
-    public function testShouldAlwaysReturnFalseOnFetch()
-    {
-        $cache = new VoidCache();
-
-        $this->assertFalse($cache->fetch('foo'));
-        $this->assertFalse($cache->fetch('bar'));
-    }
-
-    public function testShouldAlwaysReturnTrueOnSaveButNotStoreAnything()
-    {
-        $cache = new VoidCache();
-
-        $this->assertTrue($cache->save('foo', 'fooVal'));
-
-        $this->assertFalse($cache->contains('foo'));
-        $this->assertFalse($cache->fetch('foo'));
-    }
-
-    public function testShouldAlwaysReturnTrueOnDelete()
-    {
-        $cache = new VoidCache();
-
-        $this->assertTrue($cache->delete('foo'));
-    }
-
-    public function testShouldAlwaysReturnNullOnGetStatus()
-    {
-        $cache = new VoidCache();
-
-        $this->assertNull($cache->getStats());
-    }
-
-    public function testShouldAlwaysReturnTrueOnFlush()
-    {
-        $cache = new VoidCache();
-
-        $this->assertTrue($cache->flushAll());
-    }
-}
diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/WinCacheCacheTest.php b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/WinCacheCacheTest.php
deleted file mode 100644 (file)
index 1dded42..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-
-namespace Doctrine\Tests\Common\Cache;
-
-use Doctrine\Common\Cache\WincacheCache;
-
-/**
- * @requires extension wincache
- */
-class WincacheCacheTest extends CacheTest
-{
-    protected function _getCacheDriver()
-    {
-        return new WincacheCache();
-    }
-}
\ No newline at end of file
diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/XcacheCacheTest.php b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/XcacheCacheTest.php
deleted file mode 100644 (file)
index 93deca4..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-
-namespace Doctrine\Tests\Common\Cache;
-
-use Doctrine\Common\Cache\XcacheCache;
-
-/**
- * @requires extension xcache
- */
-class XcacheCacheTest extends CacheTest
-{
-    protected function _getCacheDriver()
-    {
-        return new XcacheCache();
-    }
-}
\ No newline at end of file
diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/ZendDataCacheTest.php b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/ZendDataCacheTest.php
deleted file mode 100644 (file)
index b39b9e8..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-
-namespace Doctrine\Tests\Common\Cache;
-
-use Doctrine\Common\Cache\ZendDataCache;
-
-/**
- * @requires function zend_shm_cache_fetch
- */
-class ZendDataCacheTest extends CacheTest
-{
-    protected function setUp()
-    {
-        if ('apache2handler' !== php_sapi_name()) {
-            $this->markTestSkipped('Zend Data Cache only works in apache2handler SAPI.');
-        }
-    }
-
-    public function testGetStats()
-    {
-        $cache = $this->_getCacheDriver();
-        $stats = $cache->getStats();
-
-        $this->assertNull($stats);
-    }
-
-    protected function _getCacheDriver()
-    {
-        return new ZendDataCache();
-    }
-}
\ No newline at end of file
diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/DoctrineTestCase.php b/vendor/doctrine/cache/tests/Doctrine/Tests/DoctrineTestCase.php
deleted file mode 100644 (file)
index e8323d2..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<?php
-
-namespace Doctrine\Tests;
-
-/**
- * Base testcase class for all Doctrine testcases.
- */
-abstract class DoctrineTestCase extends \PHPUnit_Framework_TestCase
-{
-}
\ No newline at end of file
diff --git a/vendor/doctrine/cache/tests/travis/php.ini b/vendor/doctrine/cache/tests/travis/php.ini
deleted file mode 100644 (file)
index 105af36..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-extension="mongo.so"
-extension="memcache.so"
-extension="memcached.so"
-extension="redis.so"
-
-apc.enabled=1
-apc.enable_cli=1
diff --git a/vendor/doctrine/cache/tests/travis/phpunit.travis.xml b/vendor/doctrine/cache/tests/travis/phpunit.travis.xml
deleted file mode 100644 (file)
index fc387ca..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
-         backupGlobals="false"
-         colors="true"
-         bootstrap="../../vendor/autoload.php"
->
-    <php>
-        <ini name="error_reporting" value="-1" />
-    </php>
-
-    <logging>
-        <log type="coverage-clover" target="../../build/logs/clover.xml"/>
-    </logging>
-
-    <testsuites>
-        <testsuite name="Doctrine Cache Test Suite">
-            <directory>../Doctrine/</directory>
-        </testsuite>
-    </testsuites>
-
-    <filter>
-        <whitelist>
-            <directory>../../lib/Doctrine/</directory>
-        </whitelist>
-    </filter>
-    
-    <groups>
-        <exclude>
-            <group>performance</group>
-        </exclude>
-    </groups>
-</phpunit>
index 385fa93d25049a28d7437bd8619f65955cfc9c61..b42dbb9b11fa7a6748ac25e53d5ea2fa6c92a8f8 100644 (file)
@@ -13,7 +13,7 @@
         {"name": "Johannes Schmitt", "email": "schmittjoh@gmail.com"}
     ],
     "require": {
-        "php": "^5.6 || ^7.0"
+        "php": "^7.1"
     },
     "require-dev": {
         "phpunit/phpunit": "^5.7",
index b907f8b02a00cf7fec00672e375aca29be1e039f..746ae7105ad809d5e95663235418c3b2f11848e4 100644 (file)
@@ -37,7 +37,7 @@ abstract class AbstractLazyCollection implements Collection
     protected $collection;
 
     /**
-     * @var boolean
+     * @var bool
      */
     protected $initialized = false;
 
index 7ddd068e56264f73e8a2e492c5c7e9b71daf8876..0bebce20005efa240ccd6b60b1da429c00f6eff8 100644 (file)
@@ -50,7 +50,7 @@ class ArrayCollection implements Collection, Selectable
      *
      * @param array $elements
      */
-    public function __construct(array $elements = array())
+    public function __construct(array $elements = [])
     {
         $this->elements = $elements;
     }
@@ -177,7 +177,8 @@ class ArrayCollection implements Collection, Selectable
     public function offsetSet($offset, $value)
     {
         if ( ! isset($offset)) {
-            return $this->add($value);
+            $this->add($value);
+            return;
         }
 
         $this->set($offset, $value);
@@ -190,7 +191,7 @@ class ArrayCollection implements Collection, Selectable
      */
     public function offsetUnset($offset)
     {
-        return $this->remove($offset);
+        $this->remove($offset);
     }
 
     /**
@@ -236,7 +237,7 @@ class ArrayCollection implements Collection, Selectable
      */
     public function get($key)
     {
-        return isset($this->elements[$key]) ? $this->elements[$key] : null;
+        return $this->elements[$key] ?? null;
     }
 
     /**
@@ -301,6 +302,8 @@ class ArrayCollection implements Collection, Selectable
 
     /**
      * {@inheritDoc}
+     *
+     * @return static
      */
     public function map(Closure $func)
     {
@@ -309,6 +312,8 @@ class ArrayCollection implements Collection, Selectable
 
     /**
      * {@inheritDoc}
+     *
+     * @return static
      */
     public function filter(Closure $p)
     {
@@ -334,7 +339,7 @@ class ArrayCollection implements Collection, Selectable
      */
     public function partition(Closure $p)
     {
-        $matches = $noMatches = array();
+        $matches = $noMatches = [];
 
         foreach ($this->elements as $key => $element) {
             if ($p($key, $element)) {
@@ -344,7 +349,7 @@ class ArrayCollection implements Collection, Selectable
             }
         }
 
-        return array($this->createFrom($matches), $this->createFrom($noMatches));
+        return [$this->createFrom($matches), $this->createFrom($noMatches)];
     }
 
     /**
@@ -362,7 +367,7 @@ class ArrayCollection implements Collection, Selectable
      */
     public function clear()
     {
-        $this->elements = array();
+        $this->elements = [];
     }
 
     /**
index 8792f7a5b6634896bc607b42b83a66294cffc7ec..d4777fccc0c7abcb9a3ff7392907d3d819121260 100644 (file)
@@ -53,7 +53,7 @@ interface Collection extends Countable, IteratorAggregate, ArrayAccess
      *
      * @param mixed $element The element to add.
      *
-     * @return boolean Always TRUE.
+     * @return bool Always TRUE.
      */
     public function add($element);
 
@@ -70,21 +70,21 @@ interface Collection extends Countable, IteratorAggregate, ArrayAccess
      *
      * @param mixed $element The element to search for.
      *
-     * @return boolean TRUE if the collection contains the element, FALSE otherwise.
+     * @return bool TRUE if the collection contains the element, FALSE otherwise.
      */
     public function contains($element);
 
     /**
      * Checks whether the collection is empty (contains no elements).
      *
-     * @return boolean TRUE if the collection is empty, FALSE otherwise.
+     * @return bool TRUE if the collection is empty, FALSE otherwise.
      */
     public function isEmpty();
 
     /**
      * Removes the element at the specified index from the collection.
      *
-     * @param string|integer $key The kex/index of the element to remove.
+     * @param string|int $key The kex/index of the element to remove.
      *
      * @return mixed The removed element or NULL, if the collection did not contain the element.
      */
@@ -95,24 +95,24 @@ interface Collection extends Countable, IteratorAggregate, ArrayAccess
      *
      * @param mixed $element The element to remove.
      *
-     * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
+     * @return bool TRUE if this collection contained the specified element, FALSE otherwise.
      */
     public function removeElement($element);
 
     /**
      * Checks whether the collection contains an element with the specified key/index.
      *
-     * @param string|integer $key The key/index to check for.
+     * @param string|int $key The key/index to check for.
      *
-     * @return boolean TRUE if the collection contains an element with the specified key/index,
-     *                 FALSE otherwise.
+     * @return bool TRUE if the collection contains an element with the specified key/index,
+     *              FALSE otherwise.
      */
     public function containsKey($key);
 
     /**
      * Gets the element at the specified key/index.
      *
-     * @param string|integer $key The key/index of the element to retrieve.
+     * @param string|int $key The key/index of the element to retrieve.
      *
      * @return mixed
      */
@@ -137,8 +137,8 @@ interface Collection extends Countable, IteratorAggregate, ArrayAccess
     /**
      * Sets an element in the collection at the specified key/index.
      *
-     * @param string|integer $key   The key/index of the element to set.
-     * @param mixed          $value The element to set.
+     * @param string|int $key   The key/index of the element to set.
+     * @param mixed      $value The element to set.
      *
      * @return void
      */
@@ -191,7 +191,7 @@ interface Collection extends Countable, IteratorAggregate, ArrayAccess
      *
      * @param Closure $p The predicate.
      *
-     * @return boolean TRUE if the predicate is TRUE for at least one element, FALSE otherwise.
+     * @return bool TRUE if the predicate is TRUE for at least one element, FALSE otherwise.
      */
     public function exists(Closure $p);
 
@@ -210,7 +210,7 @@ interface Collection extends Countable, IteratorAggregate, ArrayAccess
      *
      * @param Closure $p The predicate.
      *
-     * @return boolean TRUE, if the predicate yields TRUE for all elements, FALSE otherwise.
+     * @return bool TRUE, if the predicate yields TRUE for all elements, FALSE otherwise.
      */
     public function forAll(Closure $p);
 
@@ -230,9 +230,9 @@ interface Collection extends Countable, IteratorAggregate, ArrayAccess
      *
      * @param Closure $p The predicate on which to partition.
      *
-     * @return array An array with two elements. The first element contains the collection
-     *               of elements where the predicate returned TRUE, the second element
-     *               contains the collection of elements where the predicate returned FALSE.
+     * @return Collection[] An array with two elements. The first element contains the collection
+     *                      of elements where the predicate returned TRUE, the second element
+     *                      contains the collection of elements where the predicate returned FALSE.
      */
     public function partition(Closure $p);
 
index 3f9d43a8294e7ccce12a7ec137c48c3d9854108a..748a08474800f190d79884071b5fe4cac7c59053 100644 (file)
@@ -53,7 +53,7 @@ class Criteria
     /**
      * @var string[]
      */
-    private $orderings = array();
+    private $orderings = [];
 
     /**
      * @var int|null
@@ -137,9 +137,10 @@ class Criteria
             return $this->where($expression);
         }
 
-        $this->expression = new CompositeExpression(CompositeExpression::TYPE_AND, array(
-            $this->expression, $expression
-        ));
+        $this->expression = new CompositeExpression(
+            CompositeExpression::TYPE_AND,
+            [$this->expression, $expression]
+        );
 
         return $this;
     }
@@ -158,9 +159,10 @@ class Criteria
             return $this->where($expression);
         }
 
-        $this->expression = new CompositeExpression(CompositeExpression::TYPE_OR, array(
-            $this->expression, $expression
-        ));
+        $this->expression = new CompositeExpression(
+            CompositeExpression::TYPE_OR,
+            [$this->expression, $expression]
+        );
 
         return $this;
     }
@@ -200,7 +202,7 @@ class Criteria
     public function orderBy(array $orderings)
     {
         $this->orderings = array_map(
-            function ($ordering) {
+            function (string $ordering) : string {
                 return strtoupper($ordering) === Criteria::ASC ? Criteria::ASC : Criteria::DESC;
             },
             $orderings
index 1239aa393edb0ed6d22ea7374ec261ba85c6f03f..70b6b7ef75879c2773b8ed4ef87052eae49b5b4c 100644 (file)
@@ -35,7 +35,7 @@ class ClosureExpressionVisitor extends ExpressionVisitor
      * directly or indirectly (through an accessor get*, is*, or a magic
      * method, __get, __call).
      *
-     * @param object $object
+     * @param object|array $object
      * @param string $field
      *
      * @return mixed
@@ -46,7 +46,7 @@ class ClosureExpressionVisitor extends ExpressionVisitor
             return $object[$field];
         }
 
-        $accessors = array('get', 'is');
+        $accessors = ['get', 'is'];
 
         foreach ($accessors as $accessor) {
             $accessor .= $field;
@@ -102,12 +102,12 @@ class ClosureExpressionVisitor extends ExpressionVisitor
     public static function sortByField($name, $orientation = 1, \Closure $next = null)
     {
         if ( ! $next) {
-            $next = function() {
+            $next = function() : int {
                 return 0;
             };
         }
 
-        return function ($a, $b) use ($name, $next, $orientation) {
+        return function ($a, $b) use ($name, $next, $orientation) : int {
             $aValue = ClosureExpressionVisitor::getObjectFieldValue($a, $name);
             $bValue = ClosureExpressionVisitor::getObjectFieldValue($b, $name);
 
@@ -129,43 +129,43 @@ class ClosureExpressionVisitor extends ExpressionVisitor
 
         switch ($comparison->getOperator()) {
             case Comparison::EQ:
-                return function ($object) use ($field, $value) {
+                return function ($object) use ($field, $value) : bool {
                     return ClosureExpressionVisitor::getObjectFieldValue($object, $field) === $value;
                 };
 
             case Comparison::NEQ:
-                return function ($object) use ($field, $value) {
+                return function ($object) use ($field, $value) : bool {
                     return ClosureExpressionVisitor::getObjectFieldValue($object, $field) !== $value;
                 };
 
             case Comparison::LT:
-                return function ($object) use ($field, $value) {
+                return function ($object) use ($field, $value) : bool {
                     return ClosureExpressionVisitor::getObjectFieldValue($object, $field) < $value;
                 };
 
             case Comparison::LTE:
-                return function ($object) use ($field, $value) {
+                return function ($object) use ($field, $value) : bool {
                     return ClosureExpressionVisitor::getObjectFieldValue($object, $field) <= $value;
                 };
 
             case Comparison::GT:
-                return function ($object) use ($field, $value) {
+                return function ($object) use ($field, $value) : bool {
                     return ClosureExpressionVisitor::getObjectFieldValue($object, $field) > $value;
                 };
 
             case Comparison::GTE:
-                return function ($object) use ($field, $value) {
+                return function ($object) use ($field, $value) : bool {
                     return ClosureExpressionVisitor::getObjectFieldValue($object, $field) >= $value;
                 };
 
             case Comparison::IN:
-                return function ($object) use ($field, $value) {
-                    return in_array(ClosureExpressionVisitor::getObjectFieldValue($object, $field), $value);
+                return function ($object) use ($field, $value) : bool {
+                    return in_array(ClosureExpressionVisitor::getObjectFieldValue($object, $field), $value, true);
                 };
 
             case Comparison::NIN:
-                return function ($object) use ($field, $value) {
-                    return ! in_array(ClosureExpressionVisitor::getObjectFieldValue($object, $field), $value);
+                return function ($object) use ($field, $value) : bool {
+                    return ! in_array(ClosureExpressionVisitor::getObjectFieldValue($object, $field), $value, true);
                 };
 
             case Comparison::CONTAINS:
@@ -174,21 +174,21 @@ class ClosureExpressionVisitor extends ExpressionVisitor
                 };
 
             case Comparison::MEMBER_OF:
-                return function ($object) use ($field, $value) {
+                return function ($object) use ($field, $value) : bool {
                     $fieldValues = ClosureExpressionVisitor::getObjectFieldValue($object, $field);
                     if (!is_array($fieldValues)) {
                         $fieldValues = iterator_to_array($fieldValues);
                     }
-                    return in_array($value, $fieldValues);
+                    return in_array($value, $fieldValues, true);
                 };
 
             case Comparison::STARTS_WITH:
-                return function ($object) use ($field, $value) {
+                return function ($object) use ($field, $value) : bool {
                     return 0 === strpos(ClosureExpressionVisitor::getObjectFieldValue($object, $field), $value);
                 };
 
             case Comparison::ENDS_WITH:
-                return function ($object) use ($field, $value) {
+                return function ($object) use ($field, $value) : bool {
                     return $value === substr(ClosureExpressionVisitor::getObjectFieldValue($object, $field), -strlen($value));
                 };
 
@@ -211,7 +211,7 @@ class ClosureExpressionVisitor extends ExpressionVisitor
      */
     public function walkCompositeExpression(CompositeExpression $expr)
     {
-        $expressionList = array();
+        $expressionList = [];
 
         foreach ($expr->getExpressionList() as $child) {
             $expressionList[] = $this->dispatch($child);
@@ -234,14 +234,15 @@ class ClosureExpressionVisitor extends ExpressionVisitor
      *
      * @return callable
      */
-    private function andExpressions($expressions)
+    private function andExpressions(array $expressions) : callable
     {
-        return function ($object) use ($expressions) {
+        return function ($object) use ($expressions) : bool {
             foreach ($expressions as $expression) {
                 if ( ! $expression($object)) {
                     return false;
                 }
             }
+
             return true;
         };
     }
@@ -251,14 +252,15 @@ class ClosureExpressionVisitor extends ExpressionVisitor
      *
      * @return callable
      */
-    private function orExpressions($expressions)
+    private function orExpressions(array $expressions) : callable
     {
-        return function ($object) use ($expressions) {
+        return function ($object) use ($expressions) : bool {
             foreach ($expressions as $expression) {
                 if ($expression($object)) {
                     return true;
                 }
             }
+
             return false;
         };
     }
index ec9a9f48a0a83027f0b7414f74cd274870757e2d..72fa5eb75b1659ce7da0e1325ff04e18508f1cd4 100644 (file)
@@ -27,19 +27,20 @@ namespace Doctrine\Common\Collections\Expr;
  */
 class Comparison implements Expression
 {
-    const EQ         = '=';
-    const NEQ        = '<>';
-    const LT         = '<';
-    const LTE        = '<=';
-    const GT         = '>';
-    const GTE        = '>=';
-    const IS         = '='; // no difference with EQ
-    const IN         = 'IN';
-    const NIN        = 'NIN';
-    const CONTAINS   = 'CONTAINS';
-    const MEMBER_OF  = 'MEMBER_OF';
+    const EQ           = '=';
+    const NEQ          = '<>';
+    const LT           = '<';
+    const LTE          = '<=';
+    const GT           = '>';
+    const GTE          = '>=';
+    const IS           = '='; // no difference with EQ
+    const IN           = 'IN';
+    const NIN          = 'NIN';
+    const CONTAINS     = 'CONTAINS';
+    const MEMBER_OF    = 'MEMBER_OF';
     const STARTS_WITH  = 'STARTS_WITH';
-    const ENDS_WITH    = 'ENDS_WITH';    
+    const ENDS_WITH    = 'ENDS_WITH';
+
     /**
      * @var string
      */
index 3613c027457791a8cf3d5273ebbdf1aa3c459aec..2879754ec97491b48affd54b1091056016d24eb0 100644 (file)
@@ -38,7 +38,7 @@ class CompositeExpression implements Expression
     /**
      * @var Expression[]
      */
-    private $expressions = array();
+    private $expressions = [];
 
     /**
      * @param string $type
index 30a080f722d13406748d1f057c37c82c8d89b60f..0548048068cc61e03be209a581990022f06524c2 100644 (file)
@@ -8,5 +8,4 @@ The Doctrine Common project is a library that provides extensions to core PHP fu
 
 * [Website](http://www.doctrine-project.org)
 * [Documentation](http://docs.doctrine-project.org/projects/doctrine-common/en/latest/)
-* [Issue Tracker](http://www.doctrine-project.org/jira/browse/DCOM)
 * [Downloads](http://github.com/doctrine/common/downloads)
index 7729b1689c07eb15192548d86a6fd0fc58ff35d4..2b285d5c63407bc925a7b77d9bd6bf6236b9f322 100644 (file)
@@ -13,7 +13,7 @@
         {"name": "Johannes Schmitt", "email": "schmittjoh@gmail.com"}
     ],
     "require": {
-        "php": "~5.6|~7.0",
+        "php": "~7.1",
         "doctrine/inflector": "1.*",
         "doctrine/cache": "1.*",
         "doctrine/collections": "1.*",
         "doctrine/annotations": "1.*"
     },
     "require-dev": {
-        "phpunit/phpunit": "^5.4.6"
+        "phpunit/phpunit": "^5.7"
     },
     "autoload": {
         "psr-4": {
             "Doctrine\\Common\\": "lib/Doctrine/Common"
         }
     },
+    "autoload-dev": {
+        "psr-4": {
+            "Doctrine\\Tests\\": "tests/Doctrine/Tests"
+        }
+    },
     "extra": {
         "branch-alias": {
-            "dev-master": "2.7.x-dev"
+            "dev-master": "2.8.x-dev"
         }
     }
 }
index 78eeb35d3a40dc49e2cbdf5cb97b523374dbbe68..8a09ac39ba7050cf5663a962c727aa588522f21a 100644 (file)
@@ -246,7 +246,7 @@ class ClassLoader
      *
      * @param string $className The name of the class.
      *
-     * @return ClassLoader The <tt>ClassLoader</tt> for the class or NULL if no such <tt>ClassLoader</tt> exists.
+     * @return ClassLoader|null The <tt>ClassLoader</tt> for the class or NULL if no such <tt>ClassLoader</tt> exists.
      */
     public static function getClassLoader($className)
     {
index 0ee04a15a46e65cbf054c92f1b07232dc8a3c96d..f9dcb33c51374b6d08f2a6918fb8f9dc7c3aab1e 100644 (file)
@@ -48,7 +48,7 @@ class EventManager
      * @param EventArgs|null $eventArgs The event arguments to pass to the event handlers/listeners.
      *                                  If not supplied, the single empty EventArgs instance is used.
      *
-     * @return boolean
+     * @return void
      */
     public function dispatchEvent($eventName, EventArgs $eventArgs = null)
     {
@@ -82,7 +82,7 @@ class EventManager
      */
     public function hasListeners($event)
     {
-        return isset($this->_listeners[$event]) && $this->_listeners[$event];
+        return !empty($this->_listeners[$event]);
     }
 
     /**
@@ -119,10 +119,7 @@ class EventManager
         $hash = spl_object_hash($listener);
 
         foreach ((array) $events as $event) {
-            // Check if actually have this listener associated
-            if (isset($this->_listeners[$event][$hash])) {
-                unset($this->_listeners[$event][$hash]);
-            }
+            unset($this->_listeners[$event][$hash]);
         }
     }
 
index fce854b62c9a6f697fe4bf4449b70378ec3a3c3a..2abc207a790e3ade0e424ff8e7ded8a210bd0bdb 100644 (file)
@@ -91,7 +91,7 @@ interface ManagerRegistry extends ConnectionRegistry
     public function getManagerNames();
 
     /**
-     * Gets the ObjectRepository for an persistent object.
+     * Gets the ObjectRepository for a persistent object.
      *
      * @param string $persistentObject      The name of the persistent object.
      * @param string $persistentManagerName The object manager name (null for the default one).
index cba424b0663ea4f1a43f2f517f1240789f5cf99a..805c2a1f1cbcf7bc862d5622cd9570bff801f9f9 100644 (file)
@@ -208,7 +208,8 @@ abstract class AbstractClassMetadataFactory implements ClassMetadataFactory
 
         try {
             if ($this->cacheDriver) {
-                if (($cached = $this->cacheDriver->fetch($realClassName . $this->cacheSalt)) instanceof ClassMetadata) {
+                $cached = $this->cacheDriver->fetch($realClassName . $this->cacheSalt);
+                if ($cached instanceof ClassMetadata) {
                     $this->loadedMetadata[$realClassName] = $cached;
 
                     $this->wakeupReflection($cached, $this->getReflectionService());
@@ -290,7 +291,7 @@ abstract class AbstractClassMetadataFactory implements ClassMetadataFactory
      * Loads the metadata of the class in question and all it's ancestors whose metadata
      * is still not loaded.
      *
-     * Important: The class $name does not necesarily exist at this point here.
+     * Important: The class $name does not necessarily exist at this point here.
      * Scenarios in a code-generation setup might have access to XML/YAML
      * Mapping files without the actual PHP code existing here. That is why the
      * {@see Doctrine\Common\Persistence\Mapping\ReflectionService} interface
index efffa6aa4c77a6d38302132f00e2aff9685ee3eb..5bfba1509a97f0449157592846f0d88c43d089d9 100644 (file)
@@ -42,7 +42,7 @@ class PHPDriver extends FileDriver
     /**
      * {@inheritDoc}
      */
-    public function __construct($locator, $fileExtension = null)
+    public function __construct($locator)
     {
         parent::__construct($locator, '.php');
     }
index 8946475dbac7901de4d18d73dc227910df09fd71..e77a968d51590bf44c627af220d17557197e6841 100644 (file)
@@ -47,7 +47,7 @@ abstract class ObjectManagerDecorator implements ObjectManager
      */
     public function persist($object)
     {
-        return $this->wrapped->persist($object);
+        $this->wrapped->persist($object);
     }
 
     /**
@@ -55,7 +55,7 @@ abstract class ObjectManagerDecorator implements ObjectManager
      */
     public function remove($object)
     {
-        return $this->wrapped->remove($object);
+        $this->wrapped->remove($object);
     }
 
     /**
@@ -71,7 +71,7 @@ abstract class ObjectManagerDecorator implements ObjectManager
      */
     public function clear($objectName = null)
     {
-        return $this->wrapped->clear($objectName);
+        $this->wrapped->clear($objectName);
     }
 
     /**
@@ -79,7 +79,7 @@ abstract class ObjectManagerDecorator implements ObjectManager
      */
     public function detach($object)
     {
-        return $this->wrapped->detach($object);
+        $this->wrapped->detach($object);
     }
 
     /**
@@ -87,7 +87,7 @@ abstract class ObjectManagerDecorator implements ObjectManager
      */
     public function refresh($object)
     {
-        return $this->wrapped->refresh($object);
+        $this->wrapped->refresh($object);
     }
 
     /**
@@ -95,7 +95,7 @@ abstract class ObjectManagerDecorator implements ObjectManager
      */
     public function flush()
     {
-        return $this->wrapped->flush();
+        $this->wrapped->flush();
     }
 
     /**
@@ -127,7 +127,7 @@ abstract class ObjectManagerDecorator implements ObjectManager
      */
     public function initializeObject($obj)
     {
-        return $this->wrapped->initializeObject($obj);
+        $this->wrapped->initializeObject($obj);
     }
 
     /**
index 7eb216bfc57ef675ce4ed23f6d681ab2567d4b92..4f9738556008a7e679377ba299f3d2b4e0dcc39f 100644 (file)
@@ -69,6 +69,13 @@ abstract class AbstractProxyFactory
      */
     const AUTOGENERATE_EVAL = 3;
 
+    private const AUTOGENERATE_MODES = [
+        self::AUTOGENERATE_NEVER,
+        self::AUTOGENERATE_ALWAYS,
+        self::AUTOGENERATE_FILE_NOT_EXISTS,
+        self::AUTOGENERATE_EVAL,
+    ];
+
     /**
      * @var \Doctrine\Common\Persistence\Mapping\ClassMetadataFactory
      */
@@ -80,7 +87,7 @@ abstract class AbstractProxyFactory
     private $proxyGenerator;
 
     /**
-     * @var bool Whether to automatically (re)generate proxy classes.
+     * @var int Whether to automatically (re)generate proxy classes.
      */
     private $autoGenerate;
 
@@ -93,12 +100,19 @@ abstract class AbstractProxyFactory
      * @param \Doctrine\Common\Proxy\ProxyGenerator                     $proxyGenerator
      * @param \Doctrine\Common\Persistence\Mapping\ClassMetadataFactory $metadataFactory
      * @param bool|int                                                  $autoGenerate
+     *
+     * @throws \Doctrine\Common\Proxy\Exception\InvalidArgumentException When auto generate mode is not valid.
      */
     public function __construct(ProxyGenerator $proxyGenerator, ClassMetadataFactory $metadataFactory, $autoGenerate)
     {
         $this->proxyGenerator  = $proxyGenerator;
         $this->metadataFactory = $metadataFactory;
-        $this->autoGenerate    = (int)$autoGenerate;
+
+        $this->autoGenerate = (int)$autoGenerate;
+
+        if ( ! in_array($this->autoGenerate, self::AUTOGENERATE_MODES, true)) {
+            throw InvalidArgumentException::invalidAutoGenerateMode($autoGenerate);
+        }
     }
 
     /**
index dff54d9fd2fa41d3871a04ac9a079448fb363b18..d60fe50c414d7f0bf413a7772e28ff09357097f6 100644 (file)
@@ -89,4 +89,34 @@ class InvalidArgumentException extends BaseInvalidArgumentException implements P
 
         return new self(sprintf('Invalid \$notFoundCallback given: must be a callable, "%s" given', $type));
     }
+
+    /**
+     * @param string $className
+     *
+     * @return self
+     */
+    public static function classMustNotBeAbstract($className)
+    {
+        return new self(sprintf('Unable to create a proxy for an abstract class "%s".', $className));
+    }
+
+    /**
+     * @param string $className
+     *
+     * @return self
+     */
+    public static function classMustNotBeFinal($className)
+    {
+        return new self(sprintf('Unable to create a proxy for a final class "%s".', $className));
+    }
+
+    /**
+     * @param mixed $value
+     *
+     * @return self
+     */
+    public static function invalidAutoGenerateMode($value): self
+    {
+        return new self(sprintf('Invalid auto generate mode "%s" given.', $value));
+    }
 }
index 62f4167f37cbfa6db6a70ab76f2e92d8d174787c..df9b4be31feb22aaafb2ffa7603738516dd8b6e3 100644 (file)
@@ -256,10 +256,13 @@ class <proxyShortClassName> extends \<className> implements \<baseProxyInterface
      * @param \Doctrine\Common\Persistence\Mapping\ClassMetadata $class    Metadata for the original class.
      * @param string|bool                                        $fileName Filename (full path) for the generated class. If none is given, eval() is used.
      *
+     * @throws InvalidArgumentException
      * @throws UnexpectedValueException
      */
     public function generateProxyClass(ClassMetadata $class, $fileName = false)
     {
+        $this->verifyClassCanBeProxied($class);
+
         preg_match_all('(<([a-zA-Z]+)>)', $this->proxyClassTemplate, $placeholderMatches);
 
         $placeholderMatches = array_combine($placeholderMatches[0], $placeholderMatches[1]);
@@ -306,6 +309,22 @@ class <proxyShortClassName> extends \<className> implements \<baseProxyInterface
         rename($tmpFileName, $fileName);
     }
 
+    /**
+     * @param ClassMetadata $class
+     *
+     * @throws InvalidArgumentException
+     */
+    private function verifyClassCanBeProxied(ClassMetadata $class)
+    {
+        if ($class->getReflectionClass()->isFinal()) {
+            throw InvalidArgumentException::classMustNotBeFinal($class->getName());
+        }
+
+        if ($class->getReflectionClass()->isAbstract()) {
+            throw InvalidArgumentException::classMustNotBeAbstract($class->getName());
+        }
+    }
+
     /**
      * Generates the proxy short class name to be used in the template.
      *
@@ -777,7 +796,7 @@ EOT;
                 $methods .= '&';
             }
 
-            $methods .= $name . '(' . $this->buildParametersString($class, $method, $method->getParameters()) . ')';
+            $methods .= $name . '(' . $this->buildParametersString($method->getParameters()) . ')';
             $methods .= $this->getMethodReturnType($method);
             $methods .= "\n" . '    {' . "\n";
 
@@ -891,13 +910,11 @@ EOT;
     }
 
     /**
-     * @param ClassMetadata          $class
-     * @param \ReflectionMethod      $method
      * @param \ReflectionParameter[] $parameters
      *
      * @return string
      */
-    private function buildParametersString(ClassMetadata $class, \ReflectionMethod $method, array $parameters)
+    private function buildParametersString(array $parameters)
     {
         $parameterDefinitions = [];
 
@@ -905,7 +922,7 @@ EOT;
         foreach ($parameters as $param) {
             $parameterDefinition = '';
 
-            if ($parameterType = $this->getParameterType($class, $method, $param)) {
+            if ($parameterType = $this->getParameterType($param)) {
                 $parameterDefinition .= $parameterType . ' ';
             }
 
@@ -913,11 +930,10 @@ EOT;
                 $parameterDefinition .= '&';
             }
 
-            if (method_exists($param, 'isVariadic') && $param->isVariadic()) {
+            if ($param->isVariadic()) {
                 $parameterDefinition .= '...';
             }
 
-            $parameters[]     = '$' . $param->getName();
             $parameterDefinition .= '$' . $param->getName();
 
             if ($param->isDefaultValueAvailable()) {
@@ -937,41 +953,13 @@ EOT;
      *
      * @return string|null
      */
-    private function getParameterType(ClassMetadata $class, \ReflectionMethod $method, \ReflectionParameter $parameter)
+    private function getParameterType(\ReflectionParameter $parameter)
     {
-        if (method_exists($parameter, 'hasType')) {
-            if ( ! $parameter->hasType()) {
-                return '';
-            }
-
-            return $this->formatType($parameter->getType(), $parameter->getDeclaringFunction(), $parameter);
-        }
-
-        // For PHP 5.x, we need to pick the type hint in the old way (to be removed for PHP 7.0+)
-        if ($parameter->isArray()) {
-            return 'array';
-        }
-
-        if ($parameter->isCallable()) {
-            return 'callable';
+        if ( ! $parameter->hasType()) {
+            return null;
         }
 
-        try {
-            $parameterClass = $parameter->getClass();
-
-            if ($parameterClass) {
-                return '\\' . $parameterClass->getName();
-            }
-        } catch (\ReflectionException $previous) {
-            throw UnexpectedValueException::invalidParameterTypeHint(
-                $class->getName(),
-                $method->getName(),
-                $parameter->getName(),
-                $previous
-            );
-        }
-
-        return null;
+        return $this->formatType($parameter->getType(), $parameter->getDeclaringFunction(), $parameter);
     }
 
     /**
@@ -1000,7 +988,7 @@ EOT;
             function (\ReflectionParameter $parameter) {
                 $name = '';
 
-                if (method_exists($parameter, 'isVariadic') && $parameter->isVariadic()) {
+                if ($parameter->isVariadic()) {
                     $name .= '...';
                 }
 
@@ -1013,13 +1001,13 @@ EOT;
     }
 
     /**
-     * @Param \ReflectionMethod $method
+     * @param \ReflectionMethod $method
      *
      * @return string
      */
     private function getMethodReturnType(\ReflectionMethod $method)
     {
-        if ( ! method_exists($method, 'hasReturnType') || ! $method->hasReturnType()) {
+        if ( ! $method->hasReturnType()) {
             return '';
         }
 
@@ -1033,7 +1021,7 @@ EOT;
      */
     private function shouldProxiedMethodReturn(\ReflectionMethod $method)
     {
-        if ( ! method_exists($method, 'hasReturnType') || ! $method->hasReturnType()) {
+        if ( ! $method->hasReturnType()) {
             return true;
         }
 
@@ -1052,7 +1040,7 @@ EOT;
         \ReflectionMethod $method,
         \ReflectionParameter $parameter = null
     ) {
-        $name = method_exists($type, 'getName') ? $type->getName() : (string) $type;
+        $name = (string) $type;
         $nameLower = strtolower($name);
 
         if ('self' === $nameLower) {
index 17bcd7c9f0d12771d87ffffbe7995ada655288a2..c935a24154f6e2bdb81bc585c5a15fe2acf9e04c 100644 (file)
@@ -50,6 +50,13 @@ class StaticReflectionParser implements ReflectionProviderInterface
      */
     protected $classAnnotationOptimize;
 
+    /**
+     * A ClassFinder object which finds the class.
+     *
+     * @var ClassFinderInterface
+     */
+    protected $finder;
+
     /**
      * Whether the parser has run.
      *
@@ -74,7 +81,7 @@ class StaticReflectionParser implements ReflectionProviderInterface
     /**
      * The docComment of the class.
      *
-     * @var string
+     * @var mixed[]
      */
     protected $docComment = [
         'class' => '',
@@ -140,7 +147,7 @@ class StaticReflectionParser implements ReflectionProviderInterface
         $last_token = false;
 
         while ($token = $tokenParser->next(false)) {
-            if (is_array($token)) {switch ($token[0]) {
+            switch ($token[0]) {
                 case T_USE:
                     $this->useStatements = array_merge($this->useStatements, $tokenParser->parseUseStatement());
                     break;
@@ -148,8 +155,10 @@ class StaticReflectionParser implements ReflectionProviderInterface
                     $docComment = $token[1];
                     break;
                 case T_CLASS:
-                    if ($last_token !== T_PAAMAYIM_NEKUDOTAYIM) {$this->docComment['class'] = $docComment;
-                    $docComment = '';}
+                    if ($last_token !== T_PAAMAYIM_NEKUDOTAYIM) {
+                        $this->docComment['class'] = $docComment;
+                        $docComment = '';
+                    }
                     break;
                 case T_VAR:
                 case T_PRIVATE:
@@ -199,7 +208,7 @@ class StaticReflectionParser implements ReflectionProviderInterface
                     if (!$fullySpecified) {
                         $this->parentClassName = '\\' . $this->namespace . '\\' . $this->parentClassName;
                     }
-                    break;}
+                    break;
             }
 
             $last_token = $token[0];
index 49dc7bb172251c167c27d43d14907e16ab5c14a7..9ad1ff5c0187dafa4c140f5ccea1c9fb682a59f9 100644 (file)
@@ -87,7 +87,7 @@ class ClassUtils
      *
      * @param object $object
      *
-     * @return \ReflectionObject
+     * @return \ReflectionClass
      */
     public static function newReflectionObject($object)
     {
index ae115edd7a2f9901be6933b4b84594d5459026ad..065c1e6d03359b1faabd15bf6f45c99486871c71 100644 (file)
@@ -144,41 +144,26 @@ final class Debug
 
     /**
      * Fill the $return variable with class attributes
+     * Based on obj2array function from {@see http://php.net/manual/en/function.get-object-vars.php#47075}
      *
      * @param object   $var
-     * @param stdClass $return
+     * @param \stdClass $return
      * @param int      $maxDepth
      *
      * @return mixed
      */
     private static function fillReturnWithClassAttributes($var, \stdClass $return, $maxDepth)
     {
-        $reflClass = ClassUtils::newReflectionObject($var);
-        $parsedAttributes = array();
-        do {
-            $currentClassName = $reflClass->getName();
-
-            foreach ($reflClass->getProperties() as $reflProperty) {
-                $attributeKey = $reflProperty->isPrivate() ? $currentClassName . '#' : '';
-                $attributeKey .= $reflProperty->getName();
-
-                if (isset($parsedAttributes[$attributeKey])) {
-                    continue;
-                }
-
-                $parsedAttributes[$attributeKey] = true;
-
-                $name =
-                      $reflProperty->getName()
-                    . ($return->__CLASS__ !== $currentClassName || $reflProperty->isPrivate() ? ':' . $currentClassName : '')
-                    . ($reflProperty->isPrivate() ? ':private' : '')
-                    . ($reflProperty->isProtected() ? ':protected' : '')
-                ;
-
-                $reflProperty->setAccessible(true);
-                $return->$name = self::export($reflProperty->getValue($var), $maxDepth - 1);
+        $clone = (array) $var;
+
+        foreach (array_keys($clone) as $key) {
+            $aux = explode("\0", $key);
+            $name = end($aux);
+            if ($aux[0] === '') {
+                $name.= ':' . ($aux[1] === '*' ? 'protected' : $aux[1].':private');
             }
-        } while ($reflClass = $reflClass->getParentClass());
+            $return->$name = self::export($clone[$key], $maxDepth - 1);;
+        }
 
         return $return;
     }
index 09e500560c046081724a6913ce95d0a1cede1c21..384b1f6d031a86448181ce76ab237fc2b1a31609 100644 (file)
@@ -34,7 +34,7 @@ class Version
     /**
      * Current Doctrine Version.
      */
-    const VERSION = '2.7.3';
+    const VERSION = '2.8.1';
 
     /**
      * Compares a Doctrine version with the current one.
diff --git a/vendor/doctrine/common/phpstan.neon b/vendor/doctrine/common/phpstan.neon
new file mode 100644 (file)
index 0000000..d004c32
--- /dev/null
@@ -0,0 +1,20 @@
+parameters:
+    autoload_directories:
+        - %currentWorkingDirectory%/tests/Doctrine/Tests/Common/ClassLoaderTest
+        - %currentWorkingDirectory%/tests/Doctrine/Tests/Common/Proxy/generated
+    autoload_files:
+        - %currentWorkingDirectory%/tests/Doctrine/Tests/Common/Persistence/ObjectManagerDecoratorTest.php
+        - %currentWorkingDirectory%/tests/Doctrine/Tests/Common/Persistence/PersistentObjectTest.php
+        - %currentWorkingDirectory%/tests/Doctrine/Tests/Common/Persistence/Mapping/ClassMetadataFactoryTest.php
+        - %currentWorkingDirectory%/tests/Doctrine/Tests/Common/Persistence/Mapping/_files/annotation/TestClass.php
+    excludes_analyse:
+        - %currentWorkingDirectory%/lib/vendor/doctrine-build-common
+        - %currentWorkingDirectory%/tests/Doctrine/Tests/Common/Proxy/InvalidReturnTypeClass.php
+        - %currentWorkingDirectory%/tests/Doctrine/Tests/Common/Proxy/InvalidTypeHintClass.php
+        - %currentWorkingDirectory%/tests/Doctrine/Tests/Common/Persistence/Mapping/_files/TestEntity.php
+    ignoreErrors:
+        - '#Doctrine\\Common\\Reflection\\StaticReflection[a-zA-Z0-9_]+::__construct\(\) does not call parent constructor from Reflection[a-zA-Z0-9_]+#'
+        - '#Call to an undefined method Doctrine\\Tests\\Common\\Persistence\\TestObject#'
+        - '#Access to an undefined property Doctrine\\Common\\Proxy\\Proxy::\$publicField#'
+        - '#Access to an undefined property Doctrine\\Tests\\Common\\Proxy\\MagicGetByRefClass::\$nonExisting#'
+        - '#does not accept [\\a-zA-Z0-9_|]*PHPUnit_Framework_MockObject_MockObject#'
index e06b649465a9f935a0e235bf21b93d54f8145a38..2189ff17fdb9ea009298a73ed94d67a11f6da736 100644 (file)
@@ -13,7 +13,7 @@
         {"name": "Johannes Schmitt", "email": "schmittjoh@gmail.com"}
     ],
     "require": {
-        "php": "^7.0"
+        "php": "^7.1"
     },
     "require-dev": {
         "phpunit/phpunit": "^6.2"
         "psr-4": { "Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector" }
     },
     "autoload-dev": {
-        "psr-4": { "Doctrine\\Tests\\Common\\Inflector\\": "tests/Doctrine/Common/Inflector" }
+        "psr-4": { "Doctrine\\Tests\\Common\\Inflector\\": "tests/Doctrine/Tests/Common/Inflector" }
     },
     "extra": {
         "branch-alias": {
-            "dev-master": "1.2.x-dev"
+            "dev-master": "1.3.x-dev"
         }
     }
 }
index 3a951af8d4a43d88f1b8aeed56c8221ef4ebe7fa..f9067a0218dd8fddf341bafc121b84893b1c05c1 100644 (file)
@@ -38,7 +38,7 @@ class Inflector
     /**
      * Plural inflector rules.
      *
-     * @var array
+     * @var string[][]
      */
     private static $plural = array(
         'rules' => array(
@@ -53,6 +53,7 @@ class Inflector
             '/(?:([^f])fe|([lr])f)$/i' => '\1\2ves',
             '/sis$/i' => 'ses',
             '/([ti])um$/i' => '\1a',
+            '/(c)riterion$/i' => '\1riteria',
             '/(p)erson$/i' => '\1eople',
             '/(m)an$/i' => '\1en',
             '/(c)hild$/i' => '\1hildren',
@@ -100,6 +101,7 @@ class Inflector
             'ganglion' => 'ganglions',
             'genie' => 'genies',
             'genus' => 'genera',
+            'goose' => 'geese',
             'graffito' => 'graffiti',
             'hippopotamus' => 'hippopotami',
             'hoof' => 'hoofs',
@@ -138,6 +140,7 @@ class Inflector
             'tornado' => 'tornadoes',
             'trilby' => 'trilbys',
             'turf' => 'turfs',
+            'valve' => 'valves',
             'volcano' => 'volcanoes',
         )
     );
@@ -145,7 +148,7 @@ class Inflector
     /**
      * Singular inflector rules.
      *
-     * @var array
+     * @var string[][]
      */
     private static $singular = array(
         'rules' => array(
@@ -174,9 +177,11 @@ class Inflector
             '/(hive)s$/i' => '\1',
             '/(drive)s$/i' => '\1',
             '/(dive)s$/i' => '\1',
+            '/(olive)s$/i' => '\1',
             '/([^fo])ves$/i' => '\1fe',
             '/(^analy)ses$/i' => '\1sis',
             '/(analy|diagno|^ba|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i' => '\1\2sis',
+            '/(c)riteria$/i' => '\1riterion',
             '/([ti])a$/i' => '\1um',
             '/(p)eople$/i' => '\1\2erson',
             '/(m)en$/i' => '\1an',
@@ -196,21 +201,27 @@ class Inflector
             '.*pox',
             '.*sheep',
             '.*ss',
+            'data',
             'police',
             'pants',
             'clothes',
         ),
         'irregular' => array(
-            'caches'    => 'cache',
-            'criteria'  => 'criterion',
-            'curves'    => 'curve',
-            'emphases'  => 'emphasis',
-            'foes'      => 'foe',
-            'hoaxes'    => 'hoax',
-            'media'     => 'medium',
-            'neuroses'  => 'neurosis',
-            'waves'     => 'wave',
-            'oases'     => 'oasis',
+            'abuses'     => 'abuse',
+            'avalanches' => 'avalanche',
+            'caches'     => 'cache',
+            'criteria'   => 'criterion',
+            'curves'     => 'curve',
+            'emphases'   => 'emphasis',
+            'foes'       => 'foe',
+            'geese'      => 'goose',
+            'graves'     => 'grave',
+            'hoaxes'     => 'hoax',
+            'media'      => 'medium',
+            'neuroses'   => 'neurosis',
+            'waves'      => 'wave',
+            'oases'      => 'oasis',
+            'valves'     => 'valve',
         )
     );
 
@@ -220,18 +231,18 @@ class Inflector
      * @var array
      */
     private static $uninflected = array(
-        'Amoyese', 'bison', 'Borghese', 'bream', 'breeches', 'britches', 'buffalo', 'cantus',
-        'carp', 'chassis', 'clippers', 'cod', 'coitus', 'Congoese', 'contretemps', 'corps',
-        'debris', 'diabetes', 'djinn', 'eland', 'elk', 'equipment', 'Faroese', 'flounder',
-        'Foochowese', 'Furniture', 'gallows', 'Genevese', 'Genoese', 'Gilbertese', 'graffiti',
-        'headquarters', 'herpes', 'hijinks', 'Hottentotese', 'information', 'innings',
-        'jackanapes', 'Kiplingese', 'Kongoese', 'Lucchese', 'Luggage', 'mackerel', 'Maltese', '.*?media',
-        'mews', 'moose', 'mumps', 'Nankingese', 'news', 'nexus', 'Niasese',
-        'Pekingese', 'Piedmontese', 'pincers', 'Pistoiese', 'pliers', 'Portuguese',
-        'proceedings', 'rabies', 'rice', 'rhinoceros', 'salmon', 'Sarawakese', 'scissors',
-        'sea[- ]bass', 'series', 'Shavese', 'shears', 'siemens', 'species', 'staff', 'swine',
-        'testes', 'trousers', 'trout', 'tuna', 'Vermontese', 'Wenchowese', 'whiting',
-        'wildebeest', 'Yengeese'
+        '.*?media', 'Amoyese', 'audio', 'bison', 'Borghese', 'bream', 'breeches',
+        'britches', 'buffalo', 'cantus', 'carp', 'chassis', 'clippers', 'cod', 'coitus', 'compensation', 'Congoese',
+        'contretemps', 'coreopsis', 'corps', 'data', 'debris', 'deer', 'diabetes', 'djinn', 'education', 'eland',
+        'elk', 'emoji', 'equipment', 'evidence', 'Faroese', 'feedback', 'fish', 'flounder', 'Foochowese',
+        'Furniture', 'furniture', 'gallows', 'Genevese', 'Genoese', 'Gilbertese', 'gold', 
+        'headquarters', 'herpes', 'hijinks', 'Hottentotese', 'information', 'innings', 'jackanapes', 'jedi',
+        'Kiplingese', 'knowledge', 'Kongoese', 'love', 'Lucchese', 'Luggage', 'mackerel', 'Maltese', 'metadata',
+        'mews', 'moose', 'mumps', 'Nankingese', 'news', 'nexus', 'Niasese', 'nutrition', 'offspring',
+        'Pekingese', 'Piedmontese', 'pincers', 'Pistoiese', 'plankton', 'pliers', 'pokemon', 'police', 'Portuguese',
+        'proceedings', 'rabies', 'rain', 'rhinoceros', 'rice', 'salmon', 'Sarawakese', 'scissors', 'sea[- ]bass',
+        'series', 'Shavese', 'shears', 'sheep', 'siemens', 'species', 'staff', 'swine', 'traffic',
+        'trousers', 'trout', 'tuna', 'us', 'Vermontese', 'Wenchowese', 'wheat', 'whiting', 'wildebeest', 'Yengeese'
     );
 
     /**
@@ -250,36 +261,24 @@ class Inflector
 
     /**
      * Converts a word into the format for a Doctrine table name. Converts 'ModelName' to 'model_name'.
-     *
-     * @param string $word The word to tableize.
-     *
-     * @return string The tableized word.
      */
-    public static function tableize($word)
+    public static function tableize(string $word) : string
     {
         return strtolower(preg_replace('~(?<=\\w)([A-Z])~', '_$1', $word));
     }
 
     /**
      * Converts a word into the format for a Doctrine class name. Converts 'table_name' to 'TableName'.
-     *
-     * @param string $word The word to classify.
-     *
-     * @return string The classified word.
      */
-    public static function classify($word)
+    public static function classify(string $word) : string
     {
-        return str_replace(' ', '', ucwords(strtr($word, '_-', '  ')));
+        return str_replace([' ', '_', '-'], '', ucwords($word, ' _-'));
     }
 
     /**
      * Camelizes a word. This uses the classify() method and turns the first character to lowercase.
-     *
-     * @param string $word The word to camelize.
-     *
-     * @return string The camelized word.
      */
-    public static function camelize($word)
+    public static function camelize(string $word) : string
     {
         return lcfirst(self::classify($word));
     }
@@ -288,7 +287,7 @@ class Inflector
      * Uppercases words with configurable delimeters between words.
      *
      * Takes a string and capitalizes all of the words, like PHP's built-in
-     * ucwords function.  This extends that behavior, however, by allowing the
+     * ucwords function. This extends that behavior, however, by allowing the
      * word delimeters to be configured, rather than only separating on
      * whitespace.
      *
@@ -309,24 +308,16 @@ class Inflector
      *
      * @return string The string with all delimeter-separated words capitalized.
      */
-    public static function ucwords($string, $delimiters = " \n\t\r\0\x0B-")
+    public static function ucwords(string $string, string $delimiters = " \n\t\r\0\x0B-") : string
     {
-        return preg_replace_callback(
-            '/[^' . preg_quote($delimiters, '/') . ']+/',
-            function($matches) {
-                return ucfirst($matches[0]);
-            },
-            $string
-        );
+        return ucwords($string, $delimiters);
     }
 
     /**
      * Clears Inflectors inflected value caches, and resets the inflection
      * rules to the initial values.
-     *
-     * @return void
      */
-    public static function reset()
+    public static function reset() : void
     {
         if (empty(self::$initialState)) {
             self::$initialState = get_class_vars('Inflector');
@@ -335,7 +326,7 @@ class Inflector
         }
 
         foreach (self::$initialState as $key => $val) {
-            if ($key != 'initialState') {
+            if ($key !== 'initialState') {
                 self::${$key} = $val;
             }
         }
@@ -355,14 +346,14 @@ class Inflector
      * ));
      * }}}
      *
-     * @param string  $type  The type of inflection, either 'plural' or 'singular'
-     * @param array   $rules An array of rules to be added.
-     * @param boolean $reset If true, will unset default inflections for all
-     *                       new rules that are being defined in $rules.
+     * @param string  $type         The type of inflection, either 'plural' or 'singular'
+     * @param array|iterable $rules An array of rules to be added.
+     * @param boolean $reset        If true, will unset default inflections for all
+     *                              new rules that are being defined in $rules.
      *
      * @return void
      */
-    public static function rules($type, $rules, $reset = false)
+    public static function rules(string $type, iterable $rules, bool $reset = false) : void
     {
         foreach ($rules as $rule => $pattern) {
             if ( ! is_array($pattern)) {
@@ -400,7 +391,7 @@ class Inflector
      *
      * @return string The word in plural form.
      */
-    public static function pluralize($word)
+    public static function pluralize(string $word) : string
     {
         if (isset(self::$cache['pluralize'][$word])) {
             return self::$cache['pluralize'][$word];
@@ -420,7 +411,7 @@ class Inflector
         }
 
         if (preg_match('/(.*)\\b(' . self::$plural['cacheIrregular'] . ')$/i', $word, $regs)) {
-            self::$cache['pluralize'][$word] = $regs[1] . substr($word, 0, 1) . substr(self::$plural['merged']['irregular'][strtolower($regs[2])], 1);
+            self::$cache['pluralize'][$word] = $regs[1] . $word[0] . substr(self::$plural['merged']['irregular'][strtolower($regs[2])], 1);
 
             return self::$cache['pluralize'][$word];
         }
@@ -447,7 +438,7 @@ class Inflector
      *
      * @return string The word in singular form.
      */
-    public static function singularize($word)
+    public static function singularize(string $word) : string
     {
         if (isset(self::$cache['singularize'][$word])) {
             return self::$cache['singularize'][$word];
@@ -468,12 +459,12 @@ class Inflector
         }
 
         if (!isset(self::$singular['cacheUninflected']) || !isset(self::$singular['cacheIrregular'])) {
-            self::$singular['cacheUninflected'] = '(?:' . join('|', self::$singular['merged']['uninflected']) . ')';
-            self::$singular['cacheIrregular'] = '(?:' . join('|', array_keys(self::$singular['merged']['irregular'])) . ')';
+            self::$singular['cacheUninflected'] = '(?:' . implode('|', self::$singular['merged']['uninflected']) . ')';
+            self::$singular['cacheIrregular'] = '(?:' . implode('|', array_keys(self::$singular['merged']['irregular'])) . ')';
         }
 
         if (preg_match('/(.*)\\b(' . self::$singular['cacheIrregular'] . ')$/i', $word, $regs)) {
-            self::$cache['singularize'][$word] = $regs[1] . substr($word, 0, 1) . substr(self::$singular['merged']['irregular'][strtolower($regs[2])], 1);
+            self::$cache['singularize'][$word] = $regs[1] . $word[0] . substr(self::$singular['merged']['irregular'][strtolower($regs[2])], 1);
 
             return self::$cache['singularize'][$word];
         }
index b265cbcd1afdd1710371ebe9f756b929b2039fdd..25fcbb3e9ab01c7ea6063cf83fdab42bcbb30f1c 100644 (file)
@@ -1,4 +1,22 @@
-# CHANGELOG
+# Change Log
+
+## 6.3.2 - 2018-03-26
+
+* Fix: Release process
+
+
+## 6.3.1 - 2018-03-26
+
+* Bug fix: Parsing 0 epoch expiry times in cookies [#2014](https://github.com/guzzle/guzzle/pull/2014)
+* Improvement: Better ConnectException detection [#2012](https://github.com/guzzle/guzzle/pull/2012)
+* Bug fix: Malformed domain that contains a "/" [#1999](https://github.com/guzzle/guzzle/pull/1999)
+* Bug fix: Undefined offset when a cookie has no first key-value pair [#1998](https://github.com/guzzle/guzzle/pull/1998)
+* Improvement: Support PHPUnit 6 [#1953](https://github.com/guzzle/guzzle/pull/1953)
+* Bug fix: Support empty headers [#1915](https://github.com/guzzle/guzzle/pull/1915)
+* Bug fix: Ignore case during header modifications [#1916](https://github.com/guzzle/guzzle/pull/1916)
+
++ Minor code cleanups, documentation fixes and clarifications.
+
 
 ## 6.3.0 - 2017-06-22
 
index ea7f07c54cdd915063011b69358fac8fa7773c0e..50a177b0320c3f1f201fe6c57d4ecc0971017037 100644 (file)
@@ -1,4 +1,4 @@
-Copyright (c) 2011-2016 Michael Dowling, https://github.com/mtdowling <mtdowling@gmail.com>
+Copyright (c) 2011-2018 Michael Dowling, https://github.com/mtdowling <mtdowling@gmail.com>
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
index 2f614d6f3ae3806fb9de478638f94c3910ffbd7e..bcd18b8e718bcfb922288cf6350eced1dbae966d 100644 (file)
@@ -1,7 +1,9 @@
 Guzzle, PHP HTTP client
 =======================
 
-[![Build Status](https://travis-ci.org/guzzle/guzzle.svg?branch=master)](https://travis-ci.org/guzzle/guzzle)
+[![Latest Version](https://img.shields.io/github/release/guzzle/guzzle.svg?style=flat-square)](https://github.com/guzzle/guzzle/releases)
+[![Build Status](https://img.shields.io/travis/guzzle/guzzle.svg?style=flat-square)](https://travis-ci.org/guzzle/guzzle)
+[![Total Downloads](https://img.shields.io/packagist/dt/guzzlehttp/guzzle.svg?style=flat-square)](https://packagist.org/packages/guzzlehttp/guzzle)
 
 Guzzle is a PHP HTTP client that makes it easy to send HTTP requests and
 trivial to integrate with web services.
index 65687a58219e682d850d2c87b7127e17612ed942..0ebf81e0ba639c454419cb494ddcdf7bdbff0c6c 100644 (file)
@@ -19,7 +19,7 @@
     },
     "require-dev": {
         "ext-curl": "*",
-        "phpunit/phpunit": "^4.0 || ^5.0",
+        "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4",
         "psr/log": "^1.0"
     },
     "autoload": {
@@ -38,7 +38,7 @@
     },
     "extra": {
         "branch-alias": {
-            "dev-master": "6.2-dev"
+            "dev-master": "6.3-dev"
         }
     }
 }
index de4df8a5ca144db7192d89f72f7cbba742573906..6b35d892b9e8ccb5154bfa93f9885d5c85f30597 100644 (file)
@@ -290,7 +290,14 @@ class Client implements ClientInterface
      */
     private function applyOptions(RequestInterface $request, array &$options)
     {
-        $modify = [];
+        $modify = [
+            'set_headers' => [],
+        ];
+
+        if (isset($options['headers'])) {
+            $modify['set_headers'] = $options['headers'];
+            unset($options['headers']);
+        }
 
         if (isset($options['form_params'])) {
             if (isset($options['multipart'])) {
@@ -302,6 +309,8 @@ class Client implements ClientInterface
             }
             $options['body'] = http_build_query($options['form_params'], '', '&');
             unset($options['form_params']);
+            // Ensure that we don't have the header in different case and set the new value.
+            $options['_conditional'] = Psr7\_caseless_remove(['Content-Type'], $options['_conditional']);
             $options['_conditional']['Content-Type'] = 'application/x-www-form-urlencoded';
         }
 
@@ -313,24 +322,19 @@ class Client implements ClientInterface
         if (isset($options['json'])) {
             $options['body'] = \GuzzleHttp\json_encode($options['json']);
             unset($options['json']);
+            // Ensure that we don't have the header in different case and set the new value.
+            $options['_conditional'] = Psr7\_caseless_remove(['Content-Type'], $options['_conditional']);
             $options['_conditional']['Content-Type'] = 'application/json';
         }
 
         if (!empty($options['decode_content'])
             && $options['decode_content'] !== true
         ) {
+            // Ensure that we don't have the header in different case and set the new value.
+            $options['_conditional'] = Psr7\_caseless_remove(['Accept-Encoding'], $modify['set_headers']);
             $modify['set_headers']['Accept-Encoding'] = $options['decode_content'];
         }
 
-        if (isset($options['headers'])) {
-            if (isset($modify['set_headers'])) {
-                $modify['set_headers'] = $options['headers'] + $modify['set_headers'];
-            } else {
-                $modify['set_headers'] = $options['headers'];
-            }
-            unset($options['headers']);
-        }
-
         if (isset($options['body'])) {
             if (is_array($options['body'])) {
                 $this->invalidBody();
@@ -344,6 +348,8 @@ class Client implements ClientInterface
             $type = isset($value[2]) ? strtolower($value[2]) : 'basic';
             switch ($type) {
                 case 'basic':
+                    // Ensure that we don't have the header in different case and set the new value.
+                    $modify['set_headers'] = Psr7\_caseless_remove(['Authorization'], $modify['set_headers']);
                     $modify['set_headers']['Authorization'] = 'Basic '
                         . base64_encode("$value[0]:$value[1]");
                     break;
@@ -382,6 +388,8 @@ class Client implements ClientInterface
         $request = Psr7\modify_request($request, $modify);
         if ($request->getBody() instanceof Psr7\MultipartStream) {
             // Use a multipart/form-data POST if a Content-Type is not set.
+            // Ensure that we don't have the header in different case and set the new value.
+            $options['_conditional'] = Psr7\_caseless_remove(['Content-Type'], $options['_conditional']);
             $options['_conditional']['Content-Type'] = 'multipart/form-data; boundary='
                 . $request->getBody()->getBoundary();
         }
index 5a67b66bf866504129f91c95d12c64e09f8bfe36..8de3916678c99fa15e6ae9cd797eca258ac5ae94 100644 (file)
@@ -12,7 +12,7 @@ use Psr\Http\Message\UriInterface;
  */
 interface ClientInterface
 {
-    const VERSION = '6.2.1';
+    const VERSION = '6.3.2';
 
     /**
      * Send an HTTP request.
index 1c17b5a436ffa190c2af26d08b7250317eedfe46..78f2b79fecb55316ad3b974e3293206d66e81590 100644 (file)
@@ -95,11 +95,11 @@ class CookieJar implements CookieJarInterface
     public function getCookieByName($name)
     {
         // don't allow a null name
-        if($name === null) {
+        if ($name === null) {
             return null;
         }
-        foreach($this->cookies as $cookie) {
-            if($cookie->getName() !== null && strcasecmp($cookie->getName(), $name) === 0) {
+        foreach ($this->cookies as $cookie) {
+            if ($cookie->getName() !== null && strcasecmp($cookie->getName(), $name) === 0) {
                 return $cookie;
             }
         }
index e4bfafd4fb034451f4e71b44c45a55f1f5810a2b..4497bcf03e24ec69b443eff05ac56b2c94e62c9f 100644 (file)
@@ -15,7 +15,7 @@ class SessionCookieJar extends CookieJar
     /**
      * Create a new SessionCookieJar object
      *
-     * @param string $sessionKey        Session key name to store the cookie 
+     * @param string $sessionKey        Session key name to store the cookie
      *                                  data in session
      * @param bool $storeSessionCookies Set to true to store session cookies
      *                                  in the cookie jar.
index c911e2a3fca459736020d178964a5106de886c4c..4c40407731d0e0874188b4dae93de49f69d4ebee 100644 (file)
@@ -35,14 +35,13 @@ class SetCookie
         $data = self::$defaults;
         // Explode the cookie string using a series of semicolons
         $pieces = array_filter(array_map('trim', explode(';', $cookie)));
-        // The name of the cookie (first kvp) must include an equal sign.
-        if (empty($pieces) || !strpos($pieces[0], '=')) {
+        // The name of the cookie (first kvp) must exist and include an equal sign.
+        if (empty($pieces[0]) || !strpos($pieces[0], '=')) {
             return new self($data);
         }
 
         // Add the cookie pieces into the parsed data array
         foreach ($pieces as $part) {
-
             $cookieParts = explode('=', $part, 2);
             $key = trim($cookieParts[0]);
             $value = isset($cookieParts[1])
@@ -349,7 +348,7 @@ class SetCookie
             return false;
         }
 
-        return (bool) preg_match('/\.' . preg_quote($cookieDomain) . '$/', $domain);
+        return (bool) preg_match('/\.' . preg_quote($cookieDomain, '/') . '$/', $domain);
     }
 
     /**
@@ -359,7 +358,7 @@ class SetCookie
      */
     public function isExpired()
     {
-        return $this->getExpires() && time() > $this->getExpires();
+        return $this->getExpires() !== null && time() > $this->getExpires();
     }
 
     /**
index c82998e0d7ef06fad4bbf048e2a61fc921b768ed..510778f6eb2f6800eef95d903d0b5b3ff139b415 100644 (file)
@@ -1,4 +1,13 @@
 <?php
 namespace GuzzleHttp\Exception;
 
+/**
+ * @method string getMessage()
+ * @method \Throwable|null getPrevious()
+ * @method mixed getCode()
+ * @method string getFile()
+ * @method int getLine()
+ * @method array getTrace()
+ * @method string getTraceAsString()
+ */
 interface GuzzleException {}
index 49808e5c44679c724ecaacb3856973f3937a0607..e0923714306af0cc5c92bfbd838503e872e4fc68 100644 (file)
@@ -4,7 +4,6 @@ namespace GuzzleHttp\Handler;
 use GuzzleHttp\Exception\RequestException;
 use GuzzleHttp\Exception\ConnectException;
 use GuzzleHttp\Promise\FulfilledPromise;
-use GuzzleHttp\Promise\RejectedPromise;
 use GuzzleHttp\Psr7;
 use GuzzleHttp\Psr7\LazyOpenStream;
 use GuzzleHttp\TransferStats;
@@ -288,7 +287,14 @@ class CurlFactory implements CurlFactoryInterface
     {
         foreach ($conf['_headers'] as $name => $values) {
             foreach ($values as $value) {
-                $conf[CURLOPT_HTTPHEADER][] = "$name: $value";
+                $value = (string) $value;
+                if ($value === '') {
+                    // cURL requires a special format for empty headers.
+                    // See https://github.com/guzzle/guzzle/issues/1882 for more details.
+                    $conf[CURLOPT_HTTPHEADER][] = "$name;";
+                } else {
+                    $conf[CURLOPT_HTTPHEADER][] = "$name: $value";
+                }
             }
         }
 
@@ -388,7 +394,7 @@ class CurlFactory implements CurlFactoryInterface
         if (isset($options['force_ip_resolve'])) {
             if ('v4' === $options['force_ip_resolve']) {
                 $conf[CURLOPT_IPRESOLVE] = CURL_IPRESOLVE_V4;
-            } else if ('v6' === $options['force_ip_resolve']) {
+            } elseif ('v6' === $options['force_ip_resolve']) {
                 $conf[CURLOPT_IPRESOLVE] = CURL_IPRESOLVE_V6;
             }
         }
index 945d06ee4e2adae1fa28d5202b5b97efd62ad4ab..2754d8e4378d92530e1a3767c92cc3b673660161 100644 (file)
@@ -65,7 +65,9 @@ class CurlMultiHandler
 
         $promise = new Promise(
             [$this, 'execute'],
-            function () use ($id) { return $this->cancel($id); }
+            function () use ($id) {
+                return $this->cancel($id);
+            }
         );
 
         $this->addRequest(['easy' => $easy, 'deferred' => $promise]);
index b12bfd942398a63b3e6430e227dd05fa482e5a50..b686545ea7f1d44d0de79ee0343524fc2b68128f 100644 (file)
@@ -4,7 +4,6 @@ namespace GuzzleHttp\Handler;
 use GuzzleHttp\Exception\RequestException;
 use GuzzleHttp\Exception\ConnectException;
 use GuzzleHttp\Promise\FulfilledPromise;
-use GuzzleHttp\Promise\RejectedPromise;
 use GuzzleHttp\Promise\PromiseInterface;
 use GuzzleHttp\Psr7;
 use GuzzleHttp\TransferStats;
@@ -61,6 +60,7 @@ class StreamHandler
             if (strpos($message, 'getaddrinfo') // DNS lookup failed
                 || strpos($message, 'Connection refused')
                 || strpos($message, "couldn't connect to host") // error on HHVM
+                || strpos($message, "connection attempt failed")
             ) {
                 $e = new ConnectException($e->getMessage(), $request, $e);
             }
@@ -103,7 +103,7 @@ class StreamHandler
         $status = $parts[1];
         $reason = isset($parts[2]) ? $parts[2] : null;
         $headers = \GuzzleHttp\headers_from_lines($hdrs);
-        list ($stream, $headers) = $this->checkDecode($options, $headers, $stream);
+        list($stream, $headers) = $this->checkDecode($options, $headers, $stream);
         $stream = Psr7\stream_for($stream);
         $sink = $stream;
 
@@ -276,7 +276,7 @@ class StreamHandler
         }
 
         $params = [];
-        $context = $this->getDefaultContext($request, $options);
+        $context = $this->getDefaultContext($request);
 
         if (isset($options['on_headers']) && !is_callable($options['on_headers'])) {
             throw new \InvalidArgumentException('on_headers must be callable');
@@ -307,7 +307,6 @@ class StreamHandler
             && isset($options['auth'][2])
             && 'ntlm' == $options['auth'][2]
         ) {
-
             throw new \InvalidArgumentException('Microsoft NTLM authentication only supported with curl handler');
         }
 
index a72e38a532b2ee6a8f4da4a4f7ba49fdbf5be0a3..24c46fd9fea30c28a93137325f39bc18e9c8873c 100644 (file)
@@ -22,7 +22,7 @@ class HandlerStack
      * Creates a default handler stack that can be used by clients.
      *
      * The returned handler will wrap the provided handler or use the most
-     * appropriate default handler for you system. The returned HandlerStack has
+     * appropriate default handler for your system. The returned HandlerStack has
      * support for cookies, redirects, HTTP error exceptions, and preparing a body
      * before sending.
      *
index 6b090a977391a3903e580b05ff882965239a388d..663ac7391632645eb2f6b926123a1d669c1b9e69 100644 (file)
@@ -19,7 +19,6 @@ use Psr\Http\Message\ResponseInterface;
  * - {host}:           Host of the request
  * - {method}:         Method of the request
  * - {uri}:            URI of the request
- * - {host}:           Host of the request
  * - {version}:        Protocol version
  * - {target}:         Request target of the request (path + query + fragment)
  * - {hostname}:       Hostname of the machine that sent the request
@@ -74,7 +73,6 @@ class MessageFormatter
         return preg_replace_callback(
             '/{\s*([A-Za-z_\-\.0-9]+)\s*}/',
             function (array $matches) use ($request, $response, $error, &$cache) {
-
                 if (isset($cache[$matches[1]])) {
                     return $cache[$matches[1]];
                 }
index 9d79bd26e8ae31006a0ce68204b5393208398967..6c33eec4ecaa4e17faf39765bcc3823ec1280567 100644 (file)
@@ -34,10 +34,11 @@ final class Middleware
                 $cookieJar = $options['cookies'];
                 $request = $cookieJar->withCookieHeader($request);
                 return $handler($request, $options)
-                    ->then(function ($response) use ($cookieJar, $request) {
-                        $cookieJar->extractCookies($request, $response);
-                        return $response;
-                    }
+                    ->then(
+                        function ($response) use ($cookieJar, $request) {
+                            $cookieJar->extractCookies($request, $response);
+                            return $response;
+                        }
                 );
             };
         };
index 0b1623ecaca007facc98ad039cf08037a213e98c..96dcfd09cd71fb4a2c40b38445faee78568ba0cc 100644 (file)
@@ -107,7 +107,6 @@ class UriTemplate
         $useQuery = self::$operatorHash[$parsed['operator']]['query'];
 
         foreach ($parsed['values'] as $value) {
-
             if (!isset($this->variables[$value['value']])) {
                 continue;
             }
@@ -117,11 +116,9 @@ class UriTemplate
             $expanded = '';
 
             if (is_array($variable)) {
-
                 $isAssoc = $this->isAssoc($variable);
                 $kvp = [];
                 foreach ($variable as $key => $var) {
-
                     if ($isAssoc) {
                         $key = rawurlencode($key);
                         $isNestedArray = is_array($var);
@@ -179,7 +176,6 @@ class UriTemplate
                     }
                     $expanded = implode(',', $kvp);
                 }
-
             } else {
                 if ($value['modifier'] === ':') {
                     $variable = substr($variable, 0, $value['position']);
index 59e212edfad829c2b0a016cac8a2fdc9352b5da7..a3ac450db94cfe1409f5ec052d2710e6426e469e 100644 (file)
@@ -302,7 +302,8 @@ function json_decode($json, $assoc = false, $depth = 512, $options = 0)
     $data = \json_decode($json, $assoc, $depth, $options);
     if (JSON_ERROR_NONE !== json_last_error()) {
         throw new \InvalidArgumentException(
-            'json_decode error: ' . json_last_error_msg());
+            'json_decode error: ' . json_last_error_msg()
+        );
     }
 
     return $data;
@@ -324,7 +325,8 @@ function json_encode($value, $options = 0, $depth = 512)
     $json = \json_encode($value, $options, $depth);
     if (JSON_ERROR_NONE !== json_last_error()) {
         throw new \InvalidArgumentException(
-            'json_encode error: ' . json_last_error_msg());
+            'json_encode error: ' . json_last_error_msg()
+        );
     }
 
     return $json;
index 56c6d0955bd6b25ea8f231878cc7a9c9384a5622..d70399ca1cdf458c49025d3245859eff1eaf444c 100644 (file)
@@ -18,7 +18,6 @@ php:
 
 env:
     - TWIG_EXT=no
-    - TWIG_EXT=yes
 
 before_install:
     # turn off XDebug
@@ -47,12 +46,9 @@ matrix:
         - php: 5.3
           dist: precise
           env: TWIG_EXT=no
-    exclude:
-        - php: 7.0
+        - php: 5.4
           env: TWIG_EXT=yes
-        - php: 7.1
+        - php: 5.5
           env: TWIG_EXT=yes
-        - php: 7.2
-          env: TWIG_EXT=yes
-        - php: nightly
+        - php: 5.6
           env: TWIG_EXT=yes
index ddb771cb2bda8d97e8d8d9833f7ae4ad61fdbb49..e270288952ab820c37f630261aadb632e2448d92 100644 (file)
@@ -1,3 +1,14 @@
+* 1.35.3 (2018-03-20)
+
+ * fixed block names unicity
+ * fixed counting children of SimpleXMLElement objects
+ * added missing else clause to avoid infinite loops
+ * fixed .. (range operator) in sandbox policy
+
+* 1.35.2 (2018-03-03)
+
+ * fixed a regression in the way the profiler is registered in templates
+
 * 1.35.1 (2018-03-02)
 
  * added an exception when using "===" instead of "same as"
index 09c1ea5e9f7422d6359da72b24abb5697f9bd237..7dab3034e9f0db3c894334e000db715ec98f13d5 100644 (file)
@@ -30,8 +30,8 @@
         "php": ">=5.3.3"
     },
     "require-dev": {
-        "symfony/phpunit-bridge": "~3.3@dev",
-        "symfony/debug": "~2.7",
+        "symfony/phpunit-bridge": "^3.3",
+        "symfony/debug": "^2.7",
         "psr/container": "^1.0"
     },
     "autoload": {
index e9ec73e417b30e5c87b0b8352d72b9f969d159d6..6a32b017b19f0936371ea2a438d123df231a3072 100644 (file)
@@ -15,7 +15,7 @@
 #ifndef PHP_TWIG_H
 #define PHP_TWIG_H
 
-#define PHP_TWIG_VERSION "1.35.1"
+#define PHP_TWIG_VERSION "1.35.3"
 
 #include "php.h"
 
index c8402f15deb5e89ff86f48cebd6436e65cf8d71a..e4e8abdb0fce3aca6b9365f9c7322f44a3f9ec8e 100644 (file)
  */
 class Twig_Environment
 {
-    const VERSION = '1.35.1';
-    const VERSION_ID = 13501;
+    const VERSION = '1.35.3';
+    const VERSION_ID = 13503;
     const MAJOR_VERSION = 1;
     const MINOR_VERSION = 35;
-    const RELEASE_VERSION = 1;
+    const RELEASE_VERSION = 3;
     const EXTRA_VERSION = '';
 
     protected $charset;
@@ -132,14 +132,14 @@ class Twig_Environment
         // For BC
         if (is_string($this->originalCache)) {
             $r = new ReflectionMethod($this, 'writeCacheFile');
-            if ($r->getDeclaringClass()->getName() !== __CLASS__) {
+            if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
                 @trigger_error('The Twig_Environment::writeCacheFile method is deprecated since version 1.22 and will be removed in Twig 2.0.', E_USER_DEPRECATED);
 
                 $this->bcWriteCacheFile = true;
             }
 
             $r = new ReflectionMethod($this, 'getCacheFilename');
-            if ($r->getDeclaringClass()->getName() !== __CLASS__) {
+            if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
                 @trigger_error('The Twig_Environment::getCacheFilename method is deprecated since version 1.22 and will be removed in Twig 2.0.', E_USER_DEPRECATED);
 
                 $this->bcGetCacheFilename = true;
index 3085acc10b4d455553bfb8e3e4bc73044dd79975..2b84f3f2f836d47c87c8ba380301d87d51db4fd0 100644 (file)
@@ -199,12 +199,13 @@ class Twig_ExpressionParser
                     break;
                 }
 
+                // no break
             default:
                 if ($token->test(Twig_Token::PUNCTUATION_TYPE, '[')) {
                     $node = $this->parseArrayExpression();
                 } elseif ($token->test(Twig_Token::PUNCTUATION_TYPE, '{')) {
                     $node = $this->parseHashExpression();
-                } elseif ($token->test(Twig_Token::OPERATOR_TYPE, '=') && ($this->parser->getStream()->look(-1)->getValue() === '==' || $this->parser->getStream()->look(-1)->getValue() === '!=')) {
+                } elseif ($token->test(Twig_Token::OPERATOR_TYPE, '=') && ('==' === $this->parser->getStream()->look(-1)->getValue() || '!=' === $this->parser->getStream()->look(-1)->getValue())) {
                     throw new Twig_Error_Syntax(sprintf('Unexpected operator of value "%s". Did you try to use "===" or "!==" for strict comparison? Use "is same as(value)" instead.', $token->getValue()), $token->getLine(), $this->parser->getStream()->getSourceContext());
                 } else {
                     throw new Twig_Error_Syntax(sprintf('Unexpected token "%s" of value "%s".', Twig_Token::typeToEnglish($token->getType()), $token->getValue()), $token->getLine(), $this->parser->getStream()->getSourceContext());
@@ -315,7 +316,7 @@ class Twig_ExpressionParser
     {
         while (true) {
             $token = $this->parser->getCurrentToken();
-            if ($token->getType() == Twig_Token::PUNCTUATION_TYPE) {
+            if (Twig_Token::PUNCTUATION_TYPE == $token->getType()) {
                 if ('.' == $token->getValue() || '[' == $token->getValue()) {
                     $node = $this->parseSubscriptExpression($node);
                 } elseif ('|' == $token->getValue()) {
@@ -386,14 +387,14 @@ class Twig_ExpressionParser
         $lineno = $token->getLine();
         $arguments = new Twig_Node_Expression_Array(array(), $lineno);
         $type = Twig_Template::ANY_CALL;
-        if ($token->getValue() == '.') {
+        if ('.' == $token->getValue()) {
             $token = $stream->next();
             if (
-                $token->getType() == Twig_Token::NAME_TYPE
+                Twig_Token::NAME_TYPE == $token->getType()
                 ||
-                $token->getType() == Twig_Token::NUMBER_TYPE
+                Twig_Token::NUMBER_TYPE == $token->getType()
                 ||
-                ($token->getType() == Twig_Token::OPERATOR_TYPE && preg_match(Twig_Lexer::REGEX_NAME, $token->getValue()))
+                (Twig_Token::OPERATOR_TYPE == $token->getType() && preg_match(Twig_Lexer::REGEX_NAME, $token->getValue()))
             ) {
                 $arg = new Twig_Node_Expression_Constant($token->getValue(), $lineno);
 
index 383a727133d5d77feeb855b4c668a283292d3bf0..6e5569a28f646b4c3a896f27f0d17c1d9b18bd31 100644 (file)
@@ -661,7 +661,7 @@ function twig_slice(Twig_Environment $env, $item, $start, $length = null, $prese
 
         if ($start >= 0 && $length >= 0 && $item instanceof Iterator) {
             try {
-                return iterator_to_array(new LimitIterator($item, $start, $length === null ? -1 : $length), $preserveKeys);
+                return iterator_to_array(new LimitIterator($item, $start, null === $length ? -1 : $length), $preserveKeys);
             } catch (OutOfBoundsException $exception) {
                 return array();
             }
@@ -1216,7 +1216,7 @@ function _twig_escape_html_attr_callback($matches)
      * The following replaces characters undefined in HTML with the
      * hex entity for the Unicode replacement character.
      */
-    if (($ord <= 0x1f && $chr != "\t" && $chr != "\n" && $chr != "\r") || ($ord >= 0x7f && $ord <= 0x9f)) {
+    if (($ord <= 0x1f && "\t" != $chr && "\n" != $chr && "\r" != $chr) || ($ord >= 0x7f && $ord <= 0x9f)) {
         return '&#xFFFD;';
     }
 
@@ -1224,7 +1224,7 @@ function _twig_escape_html_attr_callback($matches)
      * Check if the current character to escape has a name entity we should
      * replace it with while grabbing the hex value of the character.
      */
-    if (strlen($chr) == 1) {
+    if (1 == strlen($chr)) {
         $hex = strtoupper(substr('00'.bin2hex($chr), -2));
     } else {
         $chr = twig_convert_encoding($chr, 'UTF-16BE', 'UTF-8');
@@ -1263,6 +1263,10 @@ if (function_exists('mb_get_info')) {
             return mb_strlen($thing, $env->getCharset());
         }
 
+        if ($thing instanceof \SimpleXMLElement) {
+            return count($thing);
+        }
+
         if (is_object($thing) && method_exists($thing, '__toString') && !$thing instanceof \Countable) {
             return mb_strlen((string) $thing, $env->getCharset());
         }
@@ -1270,7 +1274,7 @@ if (function_exists('mb_get_info')) {
         if ($thing instanceof \Countable || is_array($thing)) {
             return count($thing);
         }
-        
+
         if ($thing instanceof \IteratorAggregate) {
             return iterator_count($thing);
         }
@@ -1366,6 +1370,10 @@ else {
             return strlen($thing);
         }
 
+        if ($thing instanceof \SimpleXMLElement) {
+            return count($thing);
+        }
+
         if (is_object($thing) && method_exists($thing, '__toString') && !$thing instanceof \Countable) {
             return strlen((string) $thing);
         }
@@ -1373,7 +1381,7 @@ else {
         if ($thing instanceof \Countable || is_array($thing)) {
             return count($thing);
         }
-        
+
         if ($thing instanceof \IteratorAggregate) {
             return iterator_count($thing);
         }
index 85390b28c75c0963c31528c8da269ef086b30927..41211eb28b6c8ac006d4119efef78703e913d8f2 100644 (file)
@@ -235,7 +235,7 @@ class Twig_Lexer implements Twig_LexerInterface
             $this->moveCursor($match[0]);
 
             if ($this->cursor >= $this->end) {
-                throw new Twig_Error_Syntax(sprintf('Unclosed "%s".', $this->state === self::STATE_BLOCK ? 'block' : 'variable'), $this->currentVarBlockLine, $this->source);
+                throw new Twig_Error_Syntax(sprintf('Unclosed "%s".', self::STATE_BLOCK === $this->state ? 'block' : 'variable'), $this->currentVarBlockLine, $this->source);
             }
         }
 
@@ -337,12 +337,15 @@ class Twig_Lexer implements Twig_LexerInterface
             $this->moveCursor($match[0]);
         } elseif (preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match, null, $this->cursor)) {
             list($expect, $lineno) = array_pop($this->brackets);
-            if ($this->code[$this->cursor] != '"') {
+            if ('"' != $this->code[$this->cursor]) {
                 throw new Twig_Error_Syntax(sprintf('Unclosed "%s".', $expect), $lineno, $this->source);
             }
 
             $this->popState();
             ++$this->cursor;
+        } else {
+            // unlexable
+            throw new Twig_Error_Syntax(sprintf('Unexpected character "%s".', $this->code[$this->cursor]), $this->lineno, $this->source);
         }
     }
 
index 1275044f8bc1d24c11094e752c165e778a76060d..9149bc3ea46ff2651527f890537e972b70444c18 100644 (file)
@@ -279,7 +279,7 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderI
     {
         return strspn($file, '/\\', 0, 1)
             || (strlen($file) > 3 && ctype_alpha($file[0])
-                && substr($file, 1, 1) === ':'
+                && ':' === substr($file, 1, 1)
                 && strspn($file, '/\\', 2, 1)
             )
             || null !== parse_url($file, PHP_URL_SCHEME)
index 2fa19f3d756271d0c45421dd0a86db979f67a46d..c55e40ff7345ae6f0c22076a32a104639cbde66c 100644 (file)
@@ -56,7 +56,7 @@ class Twig_NodeVisitor_Optimizer extends Twig_BaseNodeVisitor
         if (PHP_VERSION_ID < 50400 && self::OPTIMIZE_VAR_ACCESS === (self::OPTIMIZE_VAR_ACCESS & $this->optimizers) && !$env->isStrictVariables() && !$env->hasExtension('Twig_Extension_Sandbox')) {
             if ($this->inABody) {
                 if (!$node instanceof Twig_Node_Expression) {
-                    if (get_class($node) !== 'Twig_Node') {
+                    if ('Twig_Node' !== get_class($node)) {
                         array_unshift($this->prependedNodes, array());
                     }
                 } else {
@@ -88,7 +88,7 @@ class Twig_NodeVisitor_Optimizer extends Twig_BaseNodeVisitor
             if ($node instanceof Twig_Node_Body) {
                 $this->inABody = false;
             } elseif ($this->inABody) {
-                if (!$expression && get_class($node) !== 'Twig_Node' && $prependedNodes = array_shift($this->prependedNodes)) {
+                if (!$expression && 'Twig_Node' !== get_class($node) && $prependedNodes = array_shift($this->prependedNodes)) {
                     $nodes = array();
                     foreach (array_unique($prependedNodes) as $name) {
                         $nodes[] = new Twig_Node_SetTemp($name, $node->getTemplateLine());
index b631b29d4d15ec8efee53999acf14c7fd007d5c5..71aa4f029b4b99dd753e80a96a709a3d5eb27053 100644 (file)
@@ -48,6 +48,11 @@ class Twig_NodeVisitor_Sandbox extends Twig_BaseNodeVisitor
                 $this->functions[$node->getAttribute('name')] = $node;
             }
 
+            // the .. operator is equivalent to the range() function
+            if ($node instanceof Twig_Node_Expression_Binary_Range && !isset($this->functions['range'])) {
+                $this->functions['range'] = $node;
+            }
+
             // wrap print to check __toString() calls
             if ($node instanceof Twig_Node_Print) {
                 return new Twig_Node_SandboxedPrint($node->getNode('expr'), $node->getTemplateLine(), $node->getNodeTag());
index 21afe4e8552130251cc45a0eb722204fb150f05b..6de879a584496d6e3dd10fdfb04d31a6144c07e7 100644 (file)
@@ -50,7 +50,7 @@ class Twig_Parser implements Twig_ParserInterface
 
     public function getVarName()
     {
-        return sprintf('__internal_%s', hash('sha256', __METHOD__.$this->varNameSalt++));
+        return sprintf('__internal_%s', hash('sha256', __METHOD__.$this->stream->getSourceContext()->getCode().$this->varNameSalt++));
     }
 
     /**
@@ -155,7 +155,7 @@ class Twig_Parser implements Twig_ParserInterface
                     $this->stream->next();
                     $token = $this->getCurrentToken();
 
-                    if ($token->getType() !== Twig_Token::NAME_TYPE) {
+                    if (Twig_Token::NAME_TYPE !== $token->getType()) {
                         throw new Twig_Error_Syntax('A block must start with a tag name.', $token->getLine(), $this->stream->getSourceContext());
                     }
 
index 45253c7e643b8d9be6f9aa6cd47bc76bcf7f78f2..5db41fea756d16ff2fc31221e3113d03e91832fd 100644 (file)
@@ -55,7 +55,7 @@ class Twig_Profiler_NodeVisitor_Profiler extends Twig_BaseNodeVisitor
 
     private function getVarName()
     {
-        return sprintf('__internal_%s', hash('sha256', __METHOD__));
+        return sprintf('__internal_%s', hash('sha256', $this->extensionName));
     }
 
     public function getPriority()
index 2042c6bcfcaf3be7814fb25b73916b69a8dd53ea..3709232afb70b1d5c4f16be67f1557c3dadc76c9 100644 (file)
@@ -698,7 +698,7 @@ abstract class Twig_Template implements Twig_TemplateInterface
             }
             @trigger_error($message, E_USER_DEPRECATED);
 
-            return $ret === '' ? '' : new Twig_Markup($ret, $this->env->getCharset());
+            return '' === $ret ? '' : new Twig_Markup($ret, $this->env->getCharset());
         }
 
         return $ret;
index 63bf41d665425e1f61b8671018d00b988b8cd086..8e737c5fafb68cdf67e1107c3a8b5f0b15a55cb7 100644 (file)
@@ -40,7 +40,7 @@ class Twig_TokenParser_For extends Twig_TokenParser
 
         $stream->expect(Twig_Token::BLOCK_END_TYPE);
         $body = $this->parser->subparse(array($this, 'decideForFork'));
-        if ($stream->next()->getValue() == 'else') {
+        if ('else' == $stream->next()->getValue()) {
             $stream->expect(Twig_Token::BLOCK_END_TYPE);
             $else = $this->parser->subparse(array($this, 'decideForEnd'), true);
         } else {
index a64013508ecf7d801ec479629c9d5d203b766b8b..0d7d6e52a84400918b4c33942ff1aa6016d158ce 100644 (file)
@@ -61,12 +61,12 @@ class Twig_TokenParserBroker implements Twig_TokenParserBrokerInterface
         }
     }
 
-    public function addTokenParserBroker(Twig_TokenParserBroker $broker)
+    public function addTokenParserBroker(self $broker)
     {
         $this->brokers[] = $broker;
     }
 
-    public function removeTokenParserBroker(Twig_TokenParserBroker $broker)
+    public function removeTokenParserBroker(self $broker)
     {
         if (false !== $pos = array_search($broker, $this->brokers)) {
             unset($this->brokers[$pos]);
index e1bd7ca1e331ea387ab350dcfbc0b7e07e6af3fd..81c043ca9f11f243708024277b7c8599a5915443 100644 (file)
@@ -139,7 +139,7 @@ class Twig_TokenStream
      */
     public function isEOF()
     {
-        return $this->tokens[$this->current]->getType() === Twig_Token::EOF_TYPE;
+        return Twig_Token::EOF_TYPE === $this->tokens[$this->current]->getType();
     }
 
     /**
index 9d90e0ea7467bb735647c615210714345f070337..e268115c24a64584ff586ab4639524d03e35339e 100644 (file)
@@ -36,6 +36,7 @@ class Twig_Tests_Extension_SandboxTest extends \PHPUnit\Framework\TestCase
             '1_layout' => '{% block content %}{% endblock %}',
             '1_child' => "{% extends \"1_layout\" %}\n{% block content %}\n{{ \"a\"|json_encode }}\n{% endblock %}",
             '1_include' => '{{ include("1_basic1", sandboxed=true) }}',
+            '1_range_operator' => '{{ (1..2)[0] }}',
         );
     }
 
@@ -143,6 +144,18 @@ class Twig_Tests_Extension_SandboxTest extends \PHPUnit\Framework\TestCase
         }
     }
 
+    public function testSandboxUnallowedRangeOperator()
+    {
+        $twig = $this->getEnvironment(true, array(), self::$templates);
+        try {
+            $twig->loadTemplate('1_range_operator')->render(self::$params);
+            $this->fail('Sandbox throws a SecurityError exception if the unallowed range operator is called');
+        } catch (Twig_Sandbox_SecurityError $e) {
+            $this->assertInstanceOf('Twig_Sandbox_SecurityNotAllowedFunctionError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedFunctionError');
+            $this->assertEquals('range', $e->getFunctionName(), 'Exception should be raised on the "range" function');
+        }
+    }
+
     public function testSandboxAllowMethodFoo()
     {
         $twig = $this->getEnvironment(true, array(), self::$templates, array(), array(), array('FooObject' => 'foo'));
@@ -191,6 +204,12 @@ class Twig_Tests_Extension_SandboxTest extends \PHPUnit\Framework\TestCase
         $this->assertEquals('bar', $twig->loadTemplate('1_basic7')->render(self::$params), 'Sandbox allow some functions');
     }
 
+    public function testSandboxAllowRangeOperator()
+    {
+        $twig = $this->getEnvironment(true, array(), self::$templates, array(), array(), array(), array(), array('range'));
+        $this->assertEquals('1', $twig->loadTemplate('1_range_operator')->render(self::$params), 'Sandbox allow the range operator');
+    }
+
     public function testSandboxAllowFunctionsCaseInsensitive()
     {
         foreach (array('getfoobar', 'getFoobar', 'getFooBar') as $name) {
@@ -252,7 +271,7 @@ EOF
         } catch (Throwable $e) {
         } catch (Exception $e) {
         }
-        if ($e === null) {
+        if (null === $e) {
             $this->fail('An exception should be thrown for this test to be valid.');
         }
 
index 0b1e09ea0e80c6b9c5a08500654399b5a81f1f78..bad5cf56fe374b5e9f1d8896b9f9ca2bace51a6e 100644 (file)
@@ -10,6 +10,7 @@
 {{ null|length }}
 {{ magic|length }}
 {{ non_countable|length }}
+{{ simple_xml_element|length }}
 --DATA--
 return array(
     'array' => array(1, 4),
@@ -21,6 +22,7 @@ return array(
     'null'          => null,
     'magic'         => new MagicCallStub(),     /* used to assert we do *not* call __call */
     'non_countable' => new \StdClass(),
+    'simple_xml_element' => new \SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><doc><elem/><elem/></doc>'),
 );
 --EXPECT--
 2
@@ -32,3 +34,4 @@ return array(
 0
 1
 1
+2
diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/block_names_unicity.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/block_names_unicity.test
new file mode 100644 (file)
index 0000000..40c0673
--- /dev/null
@@ -0,0 +1,19 @@
+--TEST--
+Block names are unique per template
+--TEMPLATE--
+{% extends 'layout' %}
+{% block content -%}
+    {% filter title -%}
+        second
+    {% endfilter %}
+{% endblock %}
+--TEMPLATE(layout)--
+{% filter title -%}
+    first
+{% endfilter %}
+{% block content %}{% endblock %}
+--DATA--
+return array();
+--EXPECT--
+First
+Second
index 63e630ec1ff08e8469bd674e2d0a4085cbfbe443..9cbb15904b119d26a975038b30b603b433a2ed2c 100644 (file)
@@ -309,7 +309,7 @@ class CountableStub implements \Countable
 }
 
 /**
- * This class is used in tests for the length filter
+ * This class is used in tests for the length filter.
  */
 class IteratorAggregateStub implements \IteratorAggregate
 {
index 74ca6bdb5b3b2c4ec3c5ad0395067d36d0d30467..3a1ecece44cea371d334316c6d10c2eb2aac2ea4 100644 (file)
@@ -81,7 +81,7 @@ class Drupal {
   /**
    * The current system version.
    */
-  const VERSION = '8.4.5';
+  const VERSION = '8.4.6';
 
   /**
    * Core API compatibility.
index 37ed0e97a68d9fd88e848c292fbbf6f63503f3cb..fec1be9ad3a6163744a6cfde69965417b3121608 100644 (file)
@@ -20,6 +20,7 @@ use Drupal\Core\File\MimeType\MimeTypeGuesser;
 use Drupal\Core\Http\TrustedHostsRequestFactory;
 use Drupal\Core\Installer\InstallerRedirectTrait;
 use Drupal\Core\Language\Language;
+use Drupal\Core\Security\RequestSanitizer;
 use Drupal\Core\Site\Settings;
 use Drupal\Core\Test\TestDatabase;
 use Symfony\Cmf\Component\Routing\RouteObjectInterface;
@@ -542,6 +543,12 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface {
    * {@inheritdoc}
    */
   public function preHandle(Request $request) {
+    // Sanitize the request.
+    $request = RequestSanitizer::sanitize(
+      $request,
+      (array) Settings::get(RequestSanitizer::SANITIZE_WHITELIST, []),
+      (bool) Settings::get(RequestSanitizer::SANITIZE_LOG, FALSE)
+    );
 
     $this->loadLegacyIncludes();
 
diff --git a/web/core/lib/Drupal/Core/Security/RequestSanitizer.php b/web/core/lib/Drupal/Core/Security/RequestSanitizer.php
new file mode 100644 (file)
index 0000000..8ba17b9
--- /dev/null
@@ -0,0 +1,99 @@
+<?php
+
+namespace Drupal\Core\Security;
+
+use Symfony\Component\HttpFoundation\Request;
+
+/**
+ * Sanitizes user input.
+ */
+class RequestSanitizer {
+
+  /**
+   * Request attribute to mark the request as sanitized.
+   */
+  const SANITIZED = '_drupal_request_sanitized';
+
+  /**
+   * The name of the setting that configures the whitelist.
+   */
+  const SANITIZE_WHITELIST = 'sanitize_input_whitelist';
+
+  /**
+   * The name of the setting that determines if sanitized keys are logged.
+   */
+  const SANITIZE_LOG = 'sanitize_input_logging';
+
+  /**
+   * Strips dangerous keys from user input.
+   *
+   * @param \Symfony\Component\HttpFoundation\Request $request
+   *   The incoming request to sanitize.
+   * @param string[] $whitelist
+   *   An array of keys to whitelist as safe. See default.settings.php.
+   * @param bool $log_sanitized_keys
+   *   (optional) Set to TRUE to log an keys that are sanitized.
+   *
+   * @return \Symfony\Component\HttpFoundation\Request
+   *   The sanitized request.
+   */
+  public static function sanitize(Request $request, $whitelist, $log_sanitized_keys = FALSE) {
+    if (!$request->attributes->get(self::SANITIZED, FALSE)) {
+      // Process query string parameters.
+      $get_sanitized_keys = [];
+      $request->query->replace(static::stripDangerousValues($request->query->all(), $whitelist, $get_sanitized_keys));
+      if ($log_sanitized_keys && !empty($get_sanitized_keys)) {
+        trigger_error(sprintf('Potentially unsafe keys removed from query string parameters (GET): %s', implode(', ', $get_sanitized_keys)));
+      }
+
+      // Request body parameters.
+      $post_sanitized_keys = [];
+      $request->request->replace(static::stripDangerousValues($request->request->all(), $whitelist, $post_sanitized_keys));
+      if ($log_sanitized_keys && !empty($post_sanitized_keys)) {
+        trigger_error(sprintf('Potentially unsafe keys removed from request body parameters (POST): %s', implode(', ', $post_sanitized_keys)));
+      }
+
+      // Cookie parameters.
+      $cookie_sanitized_keys = [];
+      $request->cookies->replace(static::stripDangerousValues($request->cookies->all(), $whitelist, $cookie_sanitized_keys));
+      if ($log_sanitized_keys && !empty($cookie_sanitized_keys)) {
+        trigger_error(sprintf('Potentially unsafe keys removed from cookie parameters: %s', implode(', ', $cookie_sanitized_keys)));
+      }
+
+      if (!empty($get_sanitized_keys) || !empty($post_sanitized_keys) || !empty($cookie_sanitized_keys)) {
+        $request->overrideGlobals();
+      }
+      $request->attributes->set(self::SANITIZED, TRUE);
+    }
+    return $request;
+  }
+
+  /**
+   * Strips dangerous keys from $input.
+   *
+   * @param mixed $input
+   *   The input to sanitize.
+   * @param string[] $whitelist
+   *   An array of keys to whitelist as safe.
+   * @param string[] $sanitized_keys
+   *   An array of keys that have been removed.
+   *
+   * @return mixed
+   *   The sanitized input.
+   */
+  protected static function stripDangerousValues($input, array $whitelist, array &$sanitized_keys) {
+    if (is_array($input)) {
+      foreach ($input as $key => $value) {
+        if ($key !== '' && $key[0] === '#' && !in_array($key, $whitelist, TRUE)) {
+          unset($input[$key]);
+          $sanitized_keys[] = $key;
+        }
+        else {
+          $input[$key] = static::stripDangerousValues($input[$key], $whitelist, $sanitized_keys);
+        }
+      }
+    }
+    return $input;
+  }
+
+}
index 0545aef8b9aea17776dfe468b5296b631fceabdb..2b9d651a7490ca67f9a8ccf30ae08c33d3f92e44 100644 (file)
@@ -404,9 +404,56 @@ function update_get_available($refresh = FALSE) {
     $available = \Drupal::keyValueExpirable('update_available_releases')->getAll();
   }
 
+  // Check for security releases that are covered under the same security
+  // advisories as the site's current release, and override the update status
+  // data so that those releases are not flagged as needed security updates.
+  // Any security releases beyond those specific releases will still be shown
+  // as required security updates.
+
+  // @todo This is a temporary fix to allow minor-version backports of security
+  //   fixes to be shown as secure. It should not be included in the codebase of
+  //   any release or branch other than such backports. Replace this with
+  //   https://www.drupal.org/project/drupal/issues/2766491.
+  foreach (_update_equivalent_security_releases() as $equivalent_release) {
+    if (!empty($available['drupal']['releases'][$equivalent_release]['terms']['Release type'])) {
+      $security_release_key = array_search('Security update', $available['drupal']['releases'][$equivalent_release]['terms']['Release type']);
+      if ($security_release_key !== FALSE) {
+        unset($available['drupal']['releases'][$equivalent_release]['terms']['Release type'][$security_release_key]);
+      }
+    }
+  }
   return $available;
 }
 
+/**
+ * Identifies equivalent security releases with a hardcoded list.
+ *
+ * Generally, only the latest minor version of Drupal 8 is supported. However,
+ * when security fixes are backported to an old branch, and the site owner
+ * updates to the release containing the backported fix, they should not
+ * see "Security update required!" again if the only other security releases
+ * are releases for the same advisories.
+ *
+ * @return string[]
+ *   A list of security release numbers that are equivalent to this release
+ *   (i.e. covered by the same advisory), for backported security fixes only.
+ *
+ * @todo This is a temporary fix to allow minor-version backports of security
+ *   fixes to be shown as secure. It should not be included in the codebase of
+ *   any release or branch other than such backports. Replace this with
+ *   https://www.drupal.org/project/drupal/issues/2766491.
+ */
+function _update_equivalent_security_releases() {
+  switch (\Drupal::VERSION) {
+    case '8.4.5':
+      return ['8.5.0-rc1'];
+    case '8.4.6':
+      return ['8.5.1'];
+  }
+
+  return [];
+}
+
 /**
  * Adds a task to the queue for fetching release history data for a project.
  *