From c40b201dea00d7851726f6815b8418f4d6638434 Mon Sep 17 00:00:00 2001 From: David Maus <maus@hab.de> Date: Wed, 28 Feb 2018 09:55:18 +0100 Subject: [PATCH] Update dependencies --- composer.lock | 319 +++++++---- vendor/autoload.php | 2 +- vendor/composer/autoload_classmap.php | 7 + vendor/composer/autoload_files.php | 2 + vendor/composer/autoload_psr4.php | 1 + vendor/composer/autoload_real.php | 14 +- vendor/composer/autoload_static.php | 28 +- vendor/composer/installed.json | 537 +++++++++++------- vendor/paragonie/random_compat/LICENSE | 22 + vendor/paragonie/random_compat/build-phar.sh | 5 + vendor/paragonie/random_compat/composer.json | 37 ++ .../dist/random_compat.phar.pubkey | 5 + .../dist/random_compat.phar.pubkey.asc | 11 + .../random_compat/lib/byte_safe_strings.php | 181 ++++++ .../random_compat/lib/cast_to_int.php | 75 +++ .../random_compat/lib/error_polyfill.php | 49 ++ vendor/paragonie/random_compat/lib/random.php | 223 ++++++++ .../lib/random_bytes_com_dotnet.php | 88 +++ .../lib/random_bytes_dev_urandom.php | 167 ++++++ .../lib/random_bytes_libsodium.php | 88 +++ .../lib/random_bytes_libsodium_legacy.php | 92 +++ .../random_compat/lib/random_bytes_mcrypt.php | 77 +++ .../random_compat/lib/random_int.php | 190 +++++++ .../random_compat/other/build_phar.php | 57 ++ .../random_compat/psalm-autoload.php | 9 + vendor/paragonie/random_compat/psalm.xml | 16 + vendor/pimple/pimple/CHANGELOG | 4 + vendor/pimple/pimple/README.rst | 2 +- vendor/pimple/pimple/ext/pimple/php_pimple.h | 2 +- vendor/pimple/pimple/src/Pimple/Container.php | 18 +- .../Exception/FrozenServiceException.php | 2 +- .../InvalidServiceIdentifierException.php | 2 +- .../Exception/UnknownIdentifierException.php | 2 +- .../src/Pimple/Psr11/ServiceLocator.php | 2 +- .../pimple/src/Pimple/ServiceIterator.php | 10 +- vendor/silex/silex/.php_cs.dist | 19 + vendor/silex/silex/.travis.yml | 38 +- vendor/silex/silex/README.rst | 5 + vendor/silex/silex/composer.json | 3 +- vendor/silex/silex/doc/changelog.rst | 17 + .../doc/cookbook/guard_authentication.rst | 1 + .../silex/doc/cookbook/session_storage.rst | 8 +- .../silex/doc/organizing_controllers.rst | 2 +- vendor/silex/silex/doc/providers/asset.rst | 8 +- vendor/silex/silex/doc/providers/index.rst | 1 + vendor/silex/silex/doc/providers/routing.rst | 79 +++ vendor/silex/silex/doc/providers/security.rst | 42 +- vendor/silex/silex/doc/providers/twig.rst | 3 + vendor/silex/silex/doc/services.rst | 25 + vendor/silex/silex/doc/web_servers.rst | 5 +- .../src/Silex/AppArgumentValueResolver.php | 2 +- vendor/silex/silex/src/Silex/Application.php | 18 +- .../silex/src/Silex/Application/FormTrait.php | 7 +- .../src/Silex/Application/MonologTrait.php | 2 +- .../src/Silex/Application/SecurityTrait.php | 2 +- .../Silex/Application/TranslationTrait.php | 4 +- .../silex/src/Silex/Application/TwigTrait.php | 4 +- .../Silex/Application/UrlGeneratorTrait.php | 4 +- .../silex/src/Silex/CallbackResolver.php | 6 +- vendor/silex/silex/src/Silex/Controller.php | 4 +- .../silex/src/Silex/ControllerCollection.php | 11 +- .../Silex/EventListener/ConverterListener.php | 4 +- .../src/Silex/EventListener/LogListener.php | 12 +- .../EventListener/MiddlewareListener.php | 8 +- .../StringToResponseListener.php | 6 +- .../silex/src/Silex/ExceptionHandler.php | 2 +- .../Silex/Provider/AssetServiceProvider.php | 8 +- .../Provider/DoctrineServiceProvider.php | 6 +- .../Silex/Provider/FormServiceProvider.php | 10 +- .../Provider/HttpCacheServiceProvider.php | 6 +- .../Provider/HttpFragmentServiceProvider.php | 2 +- .../Provider/HttpKernelServiceProvider.php | 6 +- .../Silex/Provider/Locale/LocaleListener.php | 8 +- .../Silex/Provider/MonologServiceProvider.php | 4 +- .../Provider/RememberMeServiceProvider.php | 10 +- .../Routing/RedirectableUrlMatcher.php | 6 +- .../Silex/Provider/RoutingServiceProvider.php | 2 +- .../Provider/SecurityServiceProvider.php | 80 +-- .../Provider/SerializerServiceProvider.php | 4 +- .../Silex/Provider/SessionServiceProvider.php | 2 +- .../Provider/SwiftmailerServiceProvider.php | 20 +- .../Provider/TranslationServiceProvider.php | 14 +- .../Silex/Provider/TwigServiceProvider.php | 48 +- .../Validator/ConstraintValidatorFactory.php | 2 +- .../Provider/ValidatorServiceProvider.php | 4 +- vendor/silex/silex/src/Silex/Route.php | 2 +- .../src/Silex/ServiceControllerResolver.php | 2 +- vendor/silex/silex/src/Silex/WebTestCase.php | 2 +- .../Tests/Application/MonologTraitTest.php | 6 +- .../Tests/Application/SecurityTraitTest.php | 28 +- .../Silex/Tests/Application/TwigTraitTest.php | 4 +- .../Application/UrlGeneratorTraitTest.php | 4 +- .../tests/Silex/Tests/ApplicationTest.php | 56 +- .../Silex/Tests/CallbackResolverTest.php | 22 +- .../Silex/Tests/CallbackServicesTest.php | 6 +- .../Silex/Tests/ControllerCollectionTest.php | 49 +- .../Silex/Tests/ControllerResolverTest.php | 5 + .../tests/Silex/Tests/ControllerTest.php | 20 +- .../Silex/Tests/ExceptionHandlerTest.php | 2 +- .../silex/tests/Silex/Tests/JsonTest.php | 8 +- .../tests/Silex/Tests/MiddlewareTest.php | 4 +- .../Provider/AssetServiceProviderTest.php | 16 +- .../Provider/DoctrineServiceProviderTest.php | 40 +- .../Provider/FormServiceProviderTest.php | 59 +- .../DisableCsrfExtension.php | 4 +- .../Provider/HttpCacheServiceProviderTest.php | 8 +- .../HttpFragmentServiceProviderTest.php | 10 +- .../Provider/MonologServiceProviderTest.php | 26 +- .../RememberMeServiceProviderTest.php | 24 +- .../Provider/RoutingServiceProviderTest.php | 4 +- .../Provider/SecurityServiceProviderTest.php | 260 ++++----- .../TokenAuthenticator.php | 20 +- .../Provider/SessionServiceProviderTest.php | 17 +- .../tests/Silex/Tests/Provider/SpoolStub.php | 4 +- .../SwiftmailerServiceProviderTest.php | 2 +- .../TranslationServiceProviderTest.php | 72 +-- .../Provider/TwigServiceProviderTest.php | 71 +-- .../Provider/ValidatorServiceProviderTest.php | 67 ++- .../Silex/Tests/Route/SecurityTraitTest.php | 18 +- .../silex/tests/Silex/Tests/RouterTest.php | 2 +- .../Tests/ServiceControllerResolverTest.php | 12 +- .../silex/tests/Silex/Tests/StreamTest.php | 2 +- .../tests/Silex/Tests/WebTestCaseTest.php | 4 +- vendor/symfony/debug/CHANGELOG.md | 5 + vendor/symfony/debug/DebugClassLoader.php | 202 ++++--- vendor/symfony/debug/ErrorHandler.php | 90 ++- .../debug/Exception/ContextErrorException.php | 2 +- vendor/symfony/debug/ExceptionHandler.php | 4 - vendor/symfony/debug/LICENSE | 2 +- .../debug/Resources/ext/tests/001.phpt | 4 +- .../debug/Resources/ext/tests/002.phpt | 4 +- .../debug/Resources/ext/tests/002_1.phpt | 4 +- .../debug/Resources/ext/tests/003.phpt | 4 +- .../debug/Tests/DebugClassLoaderTest.php | 60 +- .../symfony/debug/Tests/ErrorHandlerTest.php | 17 +- .../Tests/Exception/FlattenExceptionTest.php | 1 + .../debug/Tests/Fixtures/AnnotatedClass.php | 13 + .../debug/Tests/Fixtures/InternalClass.php | 15 + .../Tests/Fixtures/InternalInterface.php | 10 + .../debug/Tests/Fixtures/InternalTrait.php | 10 + .../debug/Tests/Fixtures/InternalTrait2.php | 23 + .../debug/Tests/phpt/debug_class_loader.phpt | 26 + .../Tests/phpt/decorate_exception_hander.phpt | 47 ++ .../debug/Tests/phpt/exception_rethrown.phpt | 35 ++ .../phpt/fatal_with_nested_handlers.phpt | 42 ++ vendor/symfony/debug/composer.json | 4 +- vendor/symfony/event-dispatcher/CHANGELOG.md | 5 + .../ContainerAwareEventDispatcher.php | 22 +- .../Debug/TraceableEventDispatcher.php | 10 +- .../TraceableEventDispatcherInterface.php | 2 + .../RegisterListenersPass.php | 30 +- .../event-dispatcher/EventDispatcher.php | 4 +- .../EventDispatcherInterface.php | 9 +- .../symfony/event-dispatcher/GenericEvent.php | 13 +- .../ImmutableEventDispatcher.php | 10 - vendor/symfony/event-dispatcher/LICENSE | 2 +- .../ContainerAwareEventDispatcherTest.php | 2 +- .../Debug/TraceableEventDispatcherTest.php | 15 + .../RegisterListenersPassTest.php | 12 + .../Tests/GenericEventTest.php | 4 +- vendor/symfony/event-dispatcher/composer.json | 10 +- .../symfony/http-foundation/AcceptHeader.php | 4 +- .../http-foundation/AcceptHeaderItem.php | 15 - .../http-foundation/BinaryFileResponse.php | 2 +- vendor/symfony/http-foundation/CHANGELOG.md | 10 + .../File/MimeType/ExtensionGuesser.php | 2 - .../MimeType/MimeTypeExtensionGuesser.php | 2 - .../File/MimeType/MimeTypeGuesser.php | 2 - .../http-foundation/File/UploadedFile.php | 36 +- vendor/symfony/http-foundation/FileBag.php | 7 +- vendor/symfony/http-foundation/HeaderBag.php | 34 +- vendor/symfony/http-foundation/IpUtils.php | 8 + vendor/symfony/http-foundation/LICENSE | 2 +- .../symfony/http-foundation/ParameterBag.php | 2 - .../http-foundation/RedirectResponse.php | 8 +- vendor/symfony/http-foundation/Request.php | 88 ++- .../RequestMatcherInterface.php | 2 - vendor/symfony/http-foundation/Response.php | 66 ++- .../http-foundation/ResponseHeaderBag.php | 41 +- .../Session/Attribute/AttributeBag.php | 7 - .../Attribute/NamespacedAttributeBag.php | 5 - .../Session/Flash/AutoExpireFlashBag.php | 16 +- .../Session/Flash/FlashBag.php | 14 +- .../Session/Flash/FlashBagInterface.php | 2 - .../http-foundation/Session/Session.php | 48 +- .../Session/SessionBagInterface.php | 2 - .../Session/SessionBagProxy.php | 82 +++ .../Session/SessionInterface.php | 2 - .../Handler/AbstractSessionHandler.php | 168 ++++++ .../Handler/MemcacheSessionHandler.php | 9 +- .../Handler/MemcachedSessionHandler.php | 23 +- .../Storage/Handler/MongoDbSessionHandler.php | 63 +- .../Handler/NativeFileSessionHandler.php | 1 + .../Storage/Handler/NativeSessionHandler.php | 7 +- .../Storage/Handler/NullSessionHandler.php | 22 +- .../Storage/Handler/PdoSessionHandler.php | 188 ++++-- .../Storage/Handler/StrictSessionHandler.php | 103 ++++ .../Handler/WriteCheckSessionHandler.php | 7 +- .../Storage/MockArraySessionStorage.php | 10 - .../Storage/MockFileSessionStorage.php | 24 +- .../Session/Storage/NativeSessionStorage.php | 88 +-- .../Storage/PhpBridgeSessionStorage.php | 7 +- .../Session/Storage/Proxy/AbstractProxy.php | 2 - .../Session/Storage/Proxy/NativeProxy.php | 6 +- .../Storage/Proxy/SessionHandlerProxy.php | 6 - .../Storage/SessionStorageInterface.php | 2 - .../http-foundation/StreamedResponse.php | 20 +- .../http-foundation/Tests/FileBagTest.php | 17 +- .../http-foundation/Tests/HeaderBagTest.php | 2 +- .../http-foundation/Tests/IpUtilsTest.php | 19 + .../Tests/ParameterBagTest.php | 2 +- .../http-foundation/Tests/RequestTest.php | 136 ++++- .../Tests/ResponseHeaderBagTest.php | 120 ++-- .../http-foundation/Tests/ResponseTest.php | 24 +- .../http-foundation/Tests/ServerBagTest.php | 8 +- .../Session/Attribute/AttributeBagTest.php | 7 +- .../Attribute/NamespacedAttributeBagTest.php | 5 +- .../Session/Flash/AutoExpireFlashBagTest.php | 13 +- .../Tests/Session/Flash/FlashBagTest.php | 5 +- .../Tests/Session/SessionTest.php | 18 + .../Handler/AbstractSessionHandlerTest.php | 61 ++ .../Storage/Handler/Fixtures/common.inc | 151 +++++ .../Handler/Fixtures/empty_destroys.expected | 17 + .../Handler/Fixtures/empty_destroys.php | 8 + .../Handler/Fixtures/read_only.expected | 14 + .../Storage/Handler/Fixtures/read_only.php | 8 + .../Handler/Fixtures/regenerate.expected | 24 + .../Storage/Handler/Fixtures/regenerate.php | 10 + .../Storage/Handler/Fixtures/storage.expected | 20 + .../Storage/Handler/Fixtures/storage.php | 24 + .../Handler/Fixtures/with_cookie.expected | 15 + .../Storage/Handler/Fixtures/with_cookie.php | 8 + .../Fixtures/with_cookie_and_session.expected | 24 + .../Fixtures/with_cookie_and_session.php | 13 + .../Handler/MemcacheSessionHandlerTest.php | 2 + .../Handler/MongoDbSessionHandlerTest.php | 1 + .../Handler/NativeSessionHandlerTest.php | 4 + .../Storage/Handler/PdoSessionHandlerTest.php | 6 + .../Handler/StrictSessionHandlerTest.php | 189 ++++++ .../Handler/WriteCheckSessionHandlerTest.php | 2 + .../Tests/Session/Storage/MetadataBagTest.php | 3 - .../Storage/NativeSessionStorageTest.php | 42 +- .../Storage/PhpBridgeSessionStorageTest.php | 4 +- .../Storage/Proxy/AbstractProxyTest.php | 38 +- .../Session/Storage/Proxy/NativeProxyTest.php | 2 + .../Tests/StreamedResponseTest.php | 11 + vendor/symfony/http-foundation/composer.json | 7 +- vendor/symfony/http-kernel/Bundle/Bundle.php | 6 +- .../http-kernel/Bundle/BundleInterface.php | 4 +- vendor/symfony/http-kernel/CHANGELOG.md | 17 + .../CacheClearer/ChainCacheClearer.php | 11 +- .../CacheClearer/Psr6CacheClearer.php | 2 +- .../CacheWarmer/CacheWarmerAggregate.php | 18 +- vendor/symfony/http-kernel/Client.php | 25 +- .../Config/EnvParametersResource.php | 2 + .../ArgumentResolver/ServiceValueResolver.php | 14 +- .../ContainerControllerResolver.php | 44 +- .../Controller/ControllerResolver.php | 5 +- .../ControllerResolverInterface.php | 2 - .../TraceableControllerResolver.php | 5 - .../DataCollector/AjaxDataCollector.php | 5 + .../DataCollector/ConfigDataCollector.php | 10 +- .../DataCollector/DataCollector.php | 4 +- .../DataCollector/DataCollectorInterface.php | 6 +- .../DataCollector/DumpDataCollector.php | 12 + .../DataCollector/EventDataCollector.php | 16 + .../DataCollector/ExceptionDataCollector.php | 8 + .../DataCollector/LoggerDataCollector.php | 16 + .../DataCollector/MemoryDataCollector.php | 16 +- .../DataCollector/RequestDataCollector.php | 33 +- .../DataCollector/RouterDataCollector.php | 24 +- .../DataCollector/TimeDataCollector.php | 15 +- .../DataCollector/Util/ValueExporter.php | 6 +- .../AddClassesToCachePass.php | 2 +- .../ConfigurableExtension.php | 3 - .../DependencyInjection/Extension.php | 4 +- .../LazyLoadingFragmentHandler.php | 2 +- .../DependencyInjection/LoggerPass.php | 41 ++ ...RegisterControllerArgumentLocatorsPass.php | 19 +- ...oveEmptyControllerArgumentLocatorsPass.php | 2 +- .../ResettableServicePass.php | 66 +++ .../DependencyInjection/ServicesResetter.php | 39 ++ .../Event/FilterControllerArgumentsEvent.php | 3 - .../Event/FilterControllerEvent.php | 8 - .../http-kernel/Event/FilterResponseEvent.php | 7 - .../http-kernel/Event/GetResponseEvent.php | 7 - .../symfony/http-kernel/Event/KernelEvent.php | 22 +- .../EventListener/AbstractSessionListener.php | 22 + .../AbstractTestSessionListener.php | 13 +- .../AddRequestFormatsListener.php | 11 +- .../EventListener/DebugHandlersListener.php | 42 +- .../EventListener/DumpListener.php | 4 - .../EventListener/ExceptionListener.php | 15 +- .../EventListener/FragmentListener.php | 2 - .../EventListener/ProfilerListener.php | 8 +- .../EventListener/ResponseListener.php | 2 - .../EventListener/RouterListener.php | 37 +- .../StreamedResponseListener.php | 2 - .../EventListener/SurrogateListener.php | 5 - .../EventListener/ValidateRequestListener.php | 2 - .../AbstractSurrogateFragmentRenderer.php | 6 +- .../http-kernel/Fragment/FragmentHandler.php | 4 - .../Fragment/InlineFragmentRenderer.php | 4 - .../HttpCache/AbstractSurrogate.php | 2 - .../http-kernel/HttpCache/HttpCache.php | 31 +- .../ResponseCacheStrategyInterface.php | 4 - .../symfony/http-kernel/HttpCache/Store.php | 23 +- .../http-kernel/HttpCache/StoreInterface.php | 13 - .../HttpCache/SurrogateInterface.php | 11 - vendor/symfony/http-kernel/HttpKernel.php | 12 +- vendor/symfony/http-kernel/Kernel.php | 257 ++++++--- vendor/symfony/http-kernel/KernelEvents.php | 16 - .../symfony/http-kernel/KernelInterface.php | 5 +- vendor/symfony/http-kernel/LICENSE | 2 +- .../http-kernel/Log/DebugLoggerInterface.php | 2 + vendor/symfony/http-kernel/Log/Logger.php | 111 ++++ .../symfony/http-kernel/Profiler/Profile.php | 8 +- .../symfony/http-kernel/Profiler/Profiler.php | 43 +- .../Profiler/ProfilerStorageInterface.php | 2 - .../http-kernel/RebootableInterface.php | 30 + .../http-kernel/Resources/welcome.html.php | 84 +++ .../http-kernel/TerminableInterface.php | 3 - .../http-kernel/Tests/Bundle/BundleTest.php | 4 + .../CacheClearer/ChainCacheClearerTest.php | 3 + .../CacheClearer/Psr6CacheClearerTest.php | 2 +- .../CacheWarmer/CacheWarmerAggregateTest.php | 6 + .../Config/EnvParametersResourceTest.php | 3 + .../ServiceValueResolverTest.php | 93 +++ .../ContainerControllerResolverTest.php | 114 +++- .../DataCollector/DumpDataCollectorTest.php | 2 +- .../ExceptionDataCollectorTest.php | 19 + .../DataCollector/LoggerDataCollectorTest.php | 22 +- .../RequestDataCollectorTest.php | 75 ++- .../LazyLoadingFragmentHandlerTest.php | 2 +- .../DependencyInjection/LoggerPassTest.php | 56 ++ ...sterControllerArgumentLocatorsPassTest.php | 45 ++ .../ResettableServicePassTest.php | 78 +++ .../ServicesResetterTest.php | 42 ++ .../FilterControllerArgumentsEventTest.php | 17 + .../DebugHandlersListenerTest.php | 24 +- .../EventListener/ExceptionListenerTest.php | 35 +- .../EventListener/LocaleListenerTest.php | 3 +- .../EventListener/RouterListenerTest.php | 38 ++ .../EventListener/SaveSessionListenerTest.php | 49 ++ .../EventListener/SessionListenerTest.php | 79 +++ .../EventListener/TestSessionListenerTest.php | 23 +- .../Tests/Fixtures/ClearableService.php | 13 + .../DataCollector/CloneVarDataCollector.php | 5 + .../Tests/Fixtures/ResettableService.php | 13 + .../Tests/Fixtures/TestEventDispatcher.php | 4 + .../Fragment/EsiFragmentRendererTest.php | 10 +- .../Tests/HttpCache/HttpCacheTest.php | 18 +- .../symfony/http-kernel/Tests/KernelTest.php | 159 +++++- .../http-kernel/Tests/Log/LoggerTest.php | 212 +++++++ .../Tests/Profiler/ProfilerTest.php | 14 + .../http-kernel/Tests/UriSignerTest.php | 2 +- vendor/symfony/http-kernel/UriSigner.php | 4 - vendor/symfony/http-kernel/composer.json | 42 +- vendor/symfony/polyfill-mbstring/LICENSE | 2 +- vendor/symfony/polyfill-mbstring/Mbstring.php | 143 ++++- .../symfony/polyfill-mbstring/bootstrap.php | 2 + .../symfony/polyfill-mbstring/composer.json | 2 +- vendor/symfony/polyfill-php70/LICENSE | 19 + vendor/symfony/polyfill-php70/Php70.php | 74 +++ vendor/symfony/polyfill-php70/README.md | 28 + .../Resources/stubs/ArithmeticError.php | 5 + .../Resources/stubs/AssertionError.php | 5 + .../Resources/stubs/DivisionByZeroError.php | 5 + .../polyfill-php70/Resources/stubs/Error.php | 5 + .../Resources/stubs/ParseError.php | 5 + ...SessionUpdateTimestampHandlerInterface.php | 23 + .../Resources/stubs/TypeError.php | 5 + vendor/symfony/polyfill-php70/bootstrap.php | 27 + vendor/symfony/polyfill-php70/composer.json | 33 ++ vendor/symfony/routing/CHANGELOG.md | 11 +- .../RoutingResolverPass.php | 5 +- .../Exception/MethodNotAllowedException.php | 3 - .../Exception/NoConfigurationException.php | 21 + .../Generator/Dumper/GeneratorDumper.php | 6 - .../routing/Generator/UrlGenerator.php | 88 ++- vendor/symfony/routing/LICENSE | 2 +- .../routing/Loader/AnnotationClassLoader.php | 13 +- .../Loader/AnnotationDirectoryLoader.php | 14 +- .../routing/Loader/AnnotationFileLoader.php | 13 +- .../Configurator/CollectionConfigurator.php | 79 +++ .../Configurator/ImportConfigurator.php | 49 ++ .../Loader/Configurator/RouteConfigurator.php | 31 + .../Configurator/RoutingConfigurator.php | 54 ++ .../Loader/Configurator/Traits/AddTrait.php | 54 ++ .../Loader/Configurator/Traits/RouteTrait.php | 131 +++++ .../symfony/routing/Loader/PhpFileLoader.php | 35 +- .../symfony/routing/Loader/XmlFileLoader.php | 10 + .../symfony/routing/Loader/YamlFileLoader.php | 16 +- .../Loader/schema/routing/routing-1.0.xsd | 2 + .../Matcher/Dumper/DumperCollection.php | 2 - .../routing/Matcher/Dumper/DumperRoute.php | 7 - .../routing/Matcher/Dumper/MatcherDumper.php | 6 - .../Matcher/Dumper/PhpMatcherDumper.php | 61 +- .../Matcher/RedirectableUrlMatcher.php | 4 +- .../Matcher/RequestMatcherInterface.php | 4 +- vendor/symfony/routing/Matcher/UrlMatcher.php | 28 +- .../routing/Matcher/UrlMatcherInterface.php | 2 + vendor/symfony/routing/RequestContext.php | 6 - .../routing/RequestContextAwareInterface.php | 2 - vendor/symfony/routing/Route.php | 35 +- vendor/symfony/routing/RouteCollection.php | 19 +- .../routing/RouteCollectionBuilder.php | 15 +- vendor/symfony/routing/RouteCompiler.php | 3 - .../routing/RouteCompilerInterface.php | 2 - vendor/symfony/routing/Router.php | 2 - .../routing/Tests/CompiledRouteTest.php | 2 +- .../AnonymousClassInTrait.php | 24 + .../controller/import__controller.xml | 10 + .../controller/import__controller.yml | 4 + .../Fixtures/controller/import_controller.xml | 8 + .../Fixtures/controller/import_controller.yml | 3 + .../controller/import_override_defaults.xml | 10 + .../controller/import_override_defaults.yml | 5 + .../Fixtures/controller/override_defaults.xml | 10 + .../Fixtures/controller/override_defaults.yml | 5 + .../Tests/Fixtures/controller/routing.xml | 14 + .../Tests/Fixtures/controller/routing.yml | 11 + .../Tests/Fixtures/dumper/url_matcher0.php | 39 ++ .../Tests/Fixtures/dumper/url_matcher1.php | 4 +- .../Tests/Fixtures/dumper/url_matcher2.php | 29 +- .../Tests/Fixtures/dumper/url_matcher3.php | 4 +- .../Tests/Fixtures/dumper/url_matcher4.php | 4 +- .../Tests/Fixtures/dumper/url_matcher5.php | 49 +- .../Tests/Fixtures/dumper/url_matcher6.php | 4 +- .../Tests/Fixtures/dumper/url_matcher7.php | 34 +- .../routing/Tests/Fixtures/php_dsl.php | 21 + .../routing/Tests/Fixtures/php_dsl_sub.php | 14 + .../Tests/Generator/UrlGeneratorTest.php | 32 ++ .../Loader/AnnotationClassLoaderTest.php | 5 +- .../Loader/AnnotationDirectoryLoaderTest.php | 18 + .../Tests/Loader/AnnotationFileLoaderTest.php | 11 + .../Tests/Loader/PhpFileLoaderTest.php | 37 ++ .../Tests/Loader/XmlFileLoaderTest.php | 74 +++ .../Tests/Loader/YamlFileLoaderTest.php | 74 +++ .../Matcher/Dumper/PhpMatcherDumperTest.php | 73 +++ .../Matcher/RedirectableUrlMatcherTest.php | 43 +- .../routing/Tests/Matcher/UrlMatcherTest.php | 11 + .../Tests/RouteCollectionBuilderTest.php | 39 ++ vendor/symfony/routing/composer.json | 14 +- vendor/symfony/twig-bridge/AppVariable.php | 3 +- vendor/symfony/twig-bridge/CHANGELOG.md | 10 + .../twig-bridge/Command/DebugCommand.php | 88 ++- .../twig-bridge/Command/LintCommand.php | 57 +- .../DataCollector/TwigDataCollector.php | 44 +- .../twig-bridge/Extension/CodeExtension.php | 6 +- .../twig-bridge/Extension/DumpExtension.php | 3 +- .../twig-bridge/Extension/FormExtension.php | 28 +- .../Extension/RoutingExtension.php | 2 +- .../Extension/StopwatchExtension.php | 4 - .../Extension/TranslationExtension.php | 18 +- .../Extension/WorkflowExtension.php | 2 +- .../twig-bridge/Extension/YamlExtension.php | 2 +- .../symfony/twig-bridge/Form/TwigRenderer.php | 4 + .../twig-bridge/Form/TwigRendererEngine.php | 12 +- vendor/symfony/twig-bridge/LICENSE | 2 +- .../twig-bridge/Node/FormThemeNode.php | 20 +- .../twig-bridge/Node/RenderBlockNode.php | 2 +- .../Node/SearchAndRenderBlockNode.php | 2 +- .../symfony/twig-bridge/NodeVisitor/Scope.php | 14 - .../TranslationDefaultDomainNodeVisitor.php | 3 - .../NodeVisitor/TranslationNodeVisitor.php | 2 - .../bootstrap_3_horizontal_layout.html.twig | 64 +-- .../views/Form/bootstrap_3_layout.html.twig | 186 +----- .../bootstrap_4_horizontal_layout.html.twig | 79 +++ .../views/Form/bootstrap_4_layout.html.twig | 188 ++++++ .../Form/bootstrap_base_layout.html.twig | 188 ++++++ .../views/Form/form_div_layout.html.twig | 22 +- .../views/Form/form_table_layout.html.twig | 2 +- .../views/Form/foundation_5_layout.html.twig | 8 +- .../twig-bridge/Tests/AppVariableTest.php | 26 +- .../Tests/Command/LintCommandTest.php | 23 +- ...xtensionBootstrap3HorizontalLayoutTest.php | 11 +- .../FormExtensionBootstrap3LayoutTest.php | 11 +- ...xtensionBootstrap4HorizontalLayoutTest.php | 107 ++++ .../FormExtensionBootstrap4LayoutTest.php | 129 +++++ .../Extension/FormExtensionDivLayoutTest.php | 27 +- .../FormExtensionTableLayoutTest.php | 11 +- .../Tests/Extension/FormExtensionTest.php | 76 +++ .../Tests/Extension/RuntimeLoaderProvider.php | 6 +- .../Extension/TranslationExtensionTest.php | 50 +- .../Tests/Extension/WorkflowExtensionTest.php | 4 - .../twig-bridge/Tests/Node/FormThemeTest.php | 39 +- .../Node/SearchAndRenderBlockNodeTest.php | 24 +- .../twig-bridge/Tests/Node/TransNodeTest.php | 10 +- .../TokenParser/FormThemeTokenParserTest.php | 15 + .../TokenParser/FormThemeTokenParser.php | 9 +- .../TokenParser/TransChoiceTokenParser.php | 2 - .../TransDefaultDomainTokenParser.php | 2 - .../TokenParser/TransTokenParser.php | 2 - .../twig-bridge/Translation/TwigExtractor.php | 5 - .../twig-bridge/UndefinedCallableHandler.php | 76 +++ vendor/symfony/twig-bridge/composer.json | 39 +- 497 files changed, 10590 insertions(+), 2880 deletions(-) create mode 100644 vendor/paragonie/random_compat/LICENSE create mode 100644 vendor/paragonie/random_compat/build-phar.sh create mode 100644 vendor/paragonie/random_compat/composer.json create mode 100644 vendor/paragonie/random_compat/dist/random_compat.phar.pubkey create mode 100644 vendor/paragonie/random_compat/dist/random_compat.phar.pubkey.asc create mode 100644 vendor/paragonie/random_compat/lib/byte_safe_strings.php create mode 100644 vendor/paragonie/random_compat/lib/cast_to_int.php create mode 100644 vendor/paragonie/random_compat/lib/error_polyfill.php create mode 100644 vendor/paragonie/random_compat/lib/random.php create mode 100644 vendor/paragonie/random_compat/lib/random_bytes_com_dotnet.php create mode 100644 vendor/paragonie/random_compat/lib/random_bytes_dev_urandom.php create mode 100644 vendor/paragonie/random_compat/lib/random_bytes_libsodium.php create mode 100644 vendor/paragonie/random_compat/lib/random_bytes_libsodium_legacy.php create mode 100644 vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php create mode 100644 vendor/paragonie/random_compat/lib/random_int.php create mode 100644 vendor/paragonie/random_compat/other/build_phar.php create mode 100644 vendor/paragonie/random_compat/psalm-autoload.php create mode 100644 vendor/paragonie/random_compat/psalm.xml create mode 100644 vendor/silex/silex/.php_cs.dist create mode 100644 vendor/silex/silex/doc/providers/routing.rst create mode 100644 vendor/symfony/debug/Tests/Fixtures/AnnotatedClass.php create mode 100644 vendor/symfony/debug/Tests/Fixtures/InternalClass.php create mode 100644 vendor/symfony/debug/Tests/Fixtures/InternalInterface.php create mode 100644 vendor/symfony/debug/Tests/Fixtures/InternalTrait.php create mode 100644 vendor/symfony/debug/Tests/Fixtures/InternalTrait2.php create mode 100644 vendor/symfony/debug/Tests/phpt/debug_class_loader.phpt create mode 100644 vendor/symfony/debug/Tests/phpt/decorate_exception_hander.phpt create mode 100644 vendor/symfony/debug/Tests/phpt/exception_rethrown.phpt create mode 100644 vendor/symfony/debug/Tests/phpt/fatal_with_nested_handlers.phpt create mode 100644 vendor/symfony/http-foundation/Session/SessionBagProxy.php create mode 100644 vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php create mode 100644 vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/AbstractSessionHandlerTest.php create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/common.inc create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/empty_destroys.expected create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/empty_destroys.php create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/read_only.expected create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/read_only.php create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/regenerate.expected create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/regenerate.php create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/storage.expected create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/storage.php create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_cookie.expected create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_cookie.php create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_cookie_and_session.expected create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_cookie_and_session.php create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/StrictSessionHandlerTest.php create mode 100644 vendor/symfony/http-kernel/DependencyInjection/LoggerPass.php create mode 100644 vendor/symfony/http-kernel/DependencyInjection/ResettableServicePass.php create mode 100644 vendor/symfony/http-kernel/DependencyInjection/ServicesResetter.php create mode 100644 vendor/symfony/http-kernel/Log/Logger.php create mode 100644 vendor/symfony/http-kernel/RebootableInterface.php create mode 100644 vendor/symfony/http-kernel/Resources/welcome.html.php create mode 100644 vendor/symfony/http-kernel/Tests/Controller/ArgumentResolver/ServiceValueResolverTest.php create mode 100644 vendor/symfony/http-kernel/Tests/DependencyInjection/LoggerPassTest.php create mode 100644 vendor/symfony/http-kernel/Tests/DependencyInjection/ResettableServicePassTest.php create mode 100644 vendor/symfony/http-kernel/Tests/DependencyInjection/ServicesResetterTest.php create mode 100644 vendor/symfony/http-kernel/Tests/Event/FilterControllerArgumentsEventTest.php create mode 100644 vendor/symfony/http-kernel/Tests/EventListener/SaveSessionListenerTest.php create mode 100644 vendor/symfony/http-kernel/Tests/EventListener/SessionListenerTest.php create mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/ClearableService.php create mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/ResettableService.php create mode 100644 vendor/symfony/http-kernel/Tests/Log/LoggerTest.php create mode 100644 vendor/symfony/polyfill-php70/LICENSE create mode 100644 vendor/symfony/polyfill-php70/Php70.php create mode 100644 vendor/symfony/polyfill-php70/README.md create mode 100644 vendor/symfony/polyfill-php70/Resources/stubs/ArithmeticError.php create mode 100644 vendor/symfony/polyfill-php70/Resources/stubs/AssertionError.php create mode 100644 vendor/symfony/polyfill-php70/Resources/stubs/DivisionByZeroError.php create mode 100644 vendor/symfony/polyfill-php70/Resources/stubs/Error.php create mode 100644 vendor/symfony/polyfill-php70/Resources/stubs/ParseError.php create mode 100644 vendor/symfony/polyfill-php70/Resources/stubs/SessionUpdateTimestampHandlerInterface.php create mode 100644 vendor/symfony/polyfill-php70/Resources/stubs/TypeError.php create mode 100644 vendor/symfony/polyfill-php70/bootstrap.php create mode 100644 vendor/symfony/polyfill-php70/composer.json create mode 100644 vendor/symfony/routing/Exception/NoConfigurationException.php create mode 100644 vendor/symfony/routing/Loader/Configurator/CollectionConfigurator.php create mode 100644 vendor/symfony/routing/Loader/Configurator/ImportConfigurator.php create mode 100644 vendor/symfony/routing/Loader/Configurator/RouteConfigurator.php create mode 100644 vendor/symfony/routing/Loader/Configurator/RoutingConfigurator.php create mode 100644 vendor/symfony/routing/Loader/Configurator/Traits/AddTrait.php create mode 100644 vendor/symfony/routing/Loader/Configurator/Traits/RouteTrait.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/OtherAnnotatedClasses/AnonymousClassInTrait.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/controller/import__controller.xml create mode 100644 vendor/symfony/routing/Tests/Fixtures/controller/import__controller.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/controller/import_controller.xml create mode 100644 vendor/symfony/routing/Tests/Fixtures/controller/import_controller.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/controller/import_override_defaults.xml create mode 100644 vendor/symfony/routing/Tests/Fixtures/controller/import_override_defaults.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/controller/override_defaults.xml create mode 100644 vendor/symfony/routing/Tests/Fixtures/controller/override_defaults.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/controller/routing.xml create mode 100644 vendor/symfony/routing/Tests/Fixtures/controller/routing.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher0.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/php_dsl.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/php_dsl_sub.php create mode 100644 vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_4_horizontal_layout.html.twig create mode 100644 vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_4_layout.html.twig create mode 100644 vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_base_layout.html.twig create mode 100644 vendor/symfony/twig-bridge/Tests/Extension/FormExtensionBootstrap4HorizontalLayoutTest.php create mode 100644 vendor/symfony/twig-bridge/Tests/Extension/FormExtensionBootstrap4LayoutTest.php create mode 100644 vendor/symfony/twig-bridge/Tests/Extension/FormExtensionTest.php create mode 100644 vendor/symfony/twig-bridge/UndefinedCallableHandler.php diff --git a/composer.lock b/composer.lock index 4dbcf9d2..e4cb72e4 100644 --- a/composer.lock +++ b/composer.lock @@ -201,7 +201,7 @@ "HAB\\Paginator\\": "lib/" } }, - "time": "2017-03-22 08:37:43" + "time": "2017-03-22T08:37:43+00:00" }, { "name": "hab/solr", @@ -220,20 +220,68 @@ "HAB": "src/" } }, - "time": "2017-07-20 13:50:14" + "time": "2017-07-20T13:50:14+00:00" + }, + { + "name": "paragonie/random_compat", + "version": "v2.0.11", + "source": { + "type": "git", + "url": "https://github.com/paragonie/random_compat.git", + "reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/5da4d3c796c275c55f057af5a643ae297d96b4d8", + "reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8", + "shasum": "" + }, + "require": { + "php": ">=5.2.0" + }, + "require-dev": { + "phpunit/phpunit": "4.*|5.*" + }, + "suggest": { + "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + }, + "type": "library", + "autoload": { + "files": [ + "lib/random.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com", + "homepage": "https://paragonie.com" + } + ], + "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", + "keywords": [ + "csprng", + "pseudorandom", + "random" + ], + "time": "2017-09-27T21:40:39+00:00" }, { "name": "pimple/pimple", - "version": "v3.2.2", + "version": "v3.2.3", "source": { "type": "git", "url": "https://github.com/silexphp/Pimple.git", - "reference": "4d45fb62d96418396ec58ba76e6f065bca16e10a" + "reference": "9e403941ef9d65d20cba7d54e29fe906db42cf32" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/silexphp/Pimple/zipball/4d45fb62d96418396ec58ba76e6f065bca16e10a", - "reference": "4d45fb62d96418396ec58ba76e6f065bca16e10a", + "url": "https://api.github.com/repos/silexphp/Pimple/zipball/9e403941ef9d65d20cba7d54e29fe906db42cf32", + "reference": "9e403941ef9d65d20cba7d54e29fe906db42cf32", "shasum": "" }, "require": { @@ -270,7 +318,7 @@ "container", "dependency injection" ], - "time": "2017-07-23T07:32:15+00:00" + "time": "2018-01-21T07:42:36+00:00" }, { "name": "psr/container", @@ -420,16 +468,16 @@ }, { "name": "silex/silex", - "version": "v2.2.0", + "version": "v2.2.3", "source": { "type": "git", "url": "https://github.com/silexphp/Silex.git", - "reference": "ec7d5b5334465414952d4b2e935e73bd085dbbbb" + "reference": "90c80c3e5ef86c54b8769feca0320154c6e63f7c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/silexphp/Silex/zipball/ec7d5b5334465414952d4b2e935e73bd085dbbbb", - "reference": "ec7d5b5334465414952d4b2e935e73bd085dbbbb", + "url": "https://api.github.com/repos/silexphp/Silex/zipball/90c80c3e5ef86c54b8769feca0320154c6e63f7c", + "reference": "90c80c3e5ef86c54b8769feca0320154c6e63f7c", "shasum": "" }, "require": { @@ -505,20 +553,20 @@ "keywords": [ "microframework" ], - "time": "2017-07-23T07:40:14+00:00" + "time": "2018-02-25T11:21:42+00:00" }, { "name": "symfony/debug", - "version": "v3.3.10", + "version": "v3.4.4", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "eb95d9ce8f18dcc1b3dfff00cb624c402be78ffd" + "reference": "53f6af2805daf52a43b393b93d2f24925d35c937" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/eb95d9ce8f18dcc1b3dfff00cb624c402be78ffd", - "reference": "eb95d9ce8f18dcc1b3dfff00cb624c402be78ffd", + "url": "https://api.github.com/repos/symfony/debug/zipball/53f6af2805daf52a43b393b93d2f24925d35c937", + "reference": "53f6af2805daf52a43b393b93d2f24925d35c937", "shasum": "" }, "require": { @@ -529,12 +577,12 @@ "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" }, "require-dev": { - "symfony/http-kernel": "~2.8|~3.0" + "symfony/http-kernel": "~2.8|~3.0|~4.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -561,20 +609,20 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2017-10-02T06:42:24+00:00" + "time": "2018-01-18T22:16:57+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v3.3.10", + "version": "v3.4.4", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "d7ba037e4b8221956ab1e221c73c9e27e05dd423" + "reference": "26b87b6bca8f8f797331a30b76fdae5342dc26ca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/d7ba037e4b8221956ab1e221c73c9e27e05dd423", - "reference": "d7ba037e4b8221956ab1e221c73c9e27e05dd423", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/26b87b6bca8f8f797331a30b76fdae5342dc26ca", + "reference": "26b87b6bca8f8f797331a30b76fdae5342dc26ca", "shasum": "" }, "require": { @@ -585,10 +633,10 @@ }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0", - "symfony/dependency-injection": "~3.3", - "symfony/expression-language": "~2.8|~3.0", - "symfony/stopwatch": "~2.8|~3.0" + "symfony/config": "~2.8|~3.0|~4.0", + "symfony/dependency-injection": "~3.3|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/stopwatch": "~2.8|~3.0|~4.0" }, "suggest": { "symfony/dependency-injection": "", @@ -597,7 +645,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -624,33 +672,34 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2017-10-02T06:42:24+00:00" + "time": "2018-01-03T07:37:34+00:00" }, { "name": "symfony/http-foundation", - "version": "v3.3.10", + "version": "v3.4.4", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "22cf9c2b1d9f67cc8e75ae7f4eaa60e4c1eff1f8" + "reference": "8c39071ac9cc7e6d8dab1d556c990dc0d2cc3d30" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/22cf9c2b1d9f67cc8e75ae7f4eaa60e4c1eff1f8", - "reference": "22cf9c2b1d9f67cc8e75ae7f4eaa60e4c1eff1f8", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/8c39071ac9cc7e6d8dab1d556c990dc0d2cc3d30", + "reference": "8c39071ac9cc7e6d8dab1d556c990dc0d2cc3d30", "shasum": "" }, "require": { "php": "^5.5.9|>=7.0.8", - "symfony/polyfill-mbstring": "~1.1" + "symfony/polyfill-mbstring": "~1.1", + "symfony/polyfill-php70": "~1.6" }, "require-dev": { - "symfony/expression-language": "~2.8|~3.0" + "symfony/expression-language": "~2.8|~3.0|~4.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -677,56 +726,58 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2017-10-05T23:10:23+00:00" + "time": "2018-01-29T09:03:43+00:00" }, { "name": "symfony/http-kernel", - "version": "v3.3.10", + "version": "v3.4.4", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "654f047a78756964bf91b619554f956517394018" + "reference": "911d2e5dd4beb63caad9a72e43857de984301907" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/654f047a78756964bf91b619554f956517394018", - "reference": "654f047a78756964bf91b619554f956517394018", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/911d2e5dd4beb63caad9a72e43857de984301907", + "reference": "911d2e5dd4beb63caad9a72e43857de984301907", "shasum": "" }, "require": { "php": "^5.5.9|>=7.0.8", "psr/log": "~1.0", - "symfony/debug": "~2.8|~3.0", - "symfony/event-dispatcher": "~2.8|~3.0", - "symfony/http-foundation": "~3.3" + "symfony/debug": "~2.8|~3.0|~4.0", + "symfony/event-dispatcher": "~2.8|~3.0|~4.0", + "symfony/http-foundation": "^3.4.4|^4.0.4" }, "conflict": { "symfony/config": "<2.8", - "symfony/dependency-injection": "<3.3", + "symfony/dependency-injection": "<3.4", "symfony/var-dumper": "<3.3", "twig/twig": "<1.34|<2.4,>=2" }, + "provide": { + "psr/log-implementation": "1.0" + }, "require-dev": { "psr/cache": "~1.0", - "symfony/browser-kit": "~2.8|~3.0", + "symfony/browser-kit": "~2.8|~3.0|~4.0", "symfony/class-loader": "~2.8|~3.0", - "symfony/config": "~2.8|~3.0", - "symfony/console": "~2.8|~3.0", - "symfony/css-selector": "~2.8|~3.0", - "symfony/dependency-injection": "~3.3", - "symfony/dom-crawler": "~2.8|~3.0", - "symfony/expression-language": "~2.8|~3.0", - "symfony/finder": "~2.8|~3.0", - "symfony/process": "~2.8|~3.0", - "symfony/routing": "~2.8|~3.0", - "symfony/stopwatch": "~2.8|~3.0", - "symfony/templating": "~2.8|~3.0", - "symfony/translation": "~2.8|~3.0", - "symfony/var-dumper": "~3.3" + "symfony/config": "~2.8|~3.0|~4.0", + "symfony/console": "~2.8|~3.0|~4.0", + "symfony/css-selector": "~2.8|~3.0|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/dom-crawler": "~2.8|~3.0|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/finder": "~2.8|~3.0|~4.0", + "symfony/process": "~2.8|~3.0|~4.0", + "symfony/routing": "~3.4|~4.0", + "symfony/stopwatch": "~2.8|~3.0|~4.0", + "symfony/templating": "~2.8|~3.0|~4.0", + "symfony/translation": "~2.8|~3.0|~4.0", + "symfony/var-dumper": "~3.3|~4.0" }, "suggest": { "symfony/browser-kit": "", - "symfony/class-loader": "", "symfony/config": "", "symfony/console": "", "symfony/dependency-injection": "", @@ -736,7 +787,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -763,20 +814,20 @@ ], "description": "Symfony HttpKernel Component", "homepage": "https://symfony.com", - "time": "2017-10-05T23:40:19+00:00" + "time": "2018-01-29T12:29:46+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.5.0", + "version": "v1.7.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "7c8fae0ac1d216eb54349e6a8baa57d515fe8803" + "reference": "78be803ce01e55d3491c1397cf1c64beb9c1b63b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7c8fae0ac1d216eb54349e6a8baa57d515fe8803", - "reference": "7c8fae0ac1d216eb54349e6a8baa57d515fe8803", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/78be803ce01e55d3491c1397cf1c64beb9c1b63b", + "reference": "78be803ce01e55d3491c1397cf1c64beb9c1b63b", "shasum": "" }, "require": { @@ -788,7 +839,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.5-dev" + "dev-master": "1.7-dev" } }, "autoload": { @@ -822,20 +873,79 @@ "portable", "shim" ], - "time": "2017-06-14T15:44:48+00:00" + "time": "2018-01-30T19:27:44+00:00" + }, + { + "name": "symfony/polyfill-php70", + "version": "v1.7.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php70.git", + "reference": "3532bfcd8f933a7816f3a0a59682fc404776600f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/3532bfcd8f933a7816f3a0a59682fc404776600f", + "reference": "3532bfcd8f933a7816f3a0a59682fc404776600f", + "shasum": "" + }, + "require": { + "paragonie/random_compat": "~1.0|~2.0", + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.7-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php70\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2018-01-30T19:27:44+00:00" }, { "name": "symfony/routing", - "version": "v3.3.10", + "version": "v3.4.4", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "2e26fa63da029dab49bf9377b3b4f60a8fecb009" + "reference": "235d01730d553a97732990588407eaf6779bb4b2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/2e26fa63da029dab49bf9377b3b4f60a8fecb009", - "reference": "2e26fa63da029dab49bf9377b3b4f60a8fecb009", + "url": "https://api.github.com/repos/symfony/routing/zipball/235d01730d553a97732990588407eaf6779bb4b2", + "reference": "235d01730d553a97732990588407eaf6779bb4b2", "shasum": "" }, "require": { @@ -844,17 +954,17 @@ "conflict": { "symfony/config": "<2.8", "symfony/dependency-injection": "<3.3", - "symfony/yaml": "<3.3" + "symfony/yaml": "<3.4" }, "require-dev": { "doctrine/annotations": "~1.0", "doctrine/common": "~2.2", "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0", - "symfony/dependency-injection": "~3.3", - "symfony/expression-language": "~2.8|~3.0", - "symfony/http-foundation": "~2.8|~3.0", - "symfony/yaml": "~3.3" + "symfony/config": "~2.8|~3.0|~4.0", + "symfony/dependency-injection": "~3.3|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/http-foundation": "~2.8|~3.0|~4.0", + "symfony/yaml": "~3.4|~4.0" }, "suggest": { "doctrine/annotations": "For using the annotation loader", @@ -867,7 +977,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -900,47 +1010,50 @@ "uri", "url" ], - "time": "2017-10-02T07:25:00+00:00" + "time": "2018-01-16T18:03:57+00:00" }, { "name": "symfony/twig-bridge", - "version": "v3.3.10", + "version": "v3.4.4", "source": { "type": "git", "url": "https://github.com/symfony/twig-bridge.git", - "reference": "cc40b1ea0efd030d422c762328345883a0404de4" + "reference": "a69e3f21f2f652ae3da0937914e3f3830cc6eae9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/cc40b1ea0efd030d422c762328345883a0404de4", - "reference": "cc40b1ea0efd030d422c762328345883a0404de4", + "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/a69e3f21f2f652ae3da0937914e3f3830cc6eae9", + "reference": "a69e3f21f2f652ae3da0937914e3f3830cc6eae9", "shasum": "" }, "require": { "php": "^5.5.9|>=7.0.8", - "twig/twig": "~1.34|~2.4" + "twig/twig": "^1.35|^2.4.4" }, "conflict": { - "symfony/form": "<3.2.10|~3.3,<3.3.3" + "symfony/console": "<3.4", + "symfony/form": "<3.4" }, "require-dev": { - "fig/link-util": "^1.0", - "symfony/asset": "~2.8|~3.0", - "symfony/console": "~2.8|~3.0", - "symfony/expression-language": "~2.8|~3.0", - "symfony/finder": "~2.8|~3.0", - "symfony/form": "^3.2.10|^3.3.3", - "symfony/http-kernel": "~3.2", + "symfony/asset": "~2.8|~3.0|~4.0", + "symfony/console": "~3.4|~4.0", + "symfony/dependency-injection": "~2.8|~3.0|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/finder": "~2.8|~3.0|~4.0", + "symfony/form": "~3.4|~4.0", + "symfony/http-foundation": "^3.3.11|~4.0", + "symfony/http-kernel": "~3.2|~4.0", "symfony/polyfill-intl-icu": "~1.0", - "symfony/routing": "~2.8|~3.0", - "symfony/security": "~2.8|~3.0", + "symfony/routing": "~2.8|~3.0|~4.0", + "symfony/security": "~2.8|~3.0|~4.0", "symfony/security-acl": "~2.8|~3.0", - "symfony/stopwatch": "~2.8|~3.0", - "symfony/templating": "~2.8|~3.0", - "symfony/translation": "~2.8|~3.0", - "symfony/var-dumper": "~2.8.10|~3.1.4|~3.2", - "symfony/web-link": "~3.3", - "symfony/yaml": "~2.8|~3.0" + "symfony/stopwatch": "~2.8|~3.0|~4.0", + "symfony/templating": "~2.8|~3.0|~4.0", + "symfony/translation": "~2.8|~3.0|~4.0", + "symfony/var-dumper": "~2.8.10|~3.1.4|~3.2|~4.0", + "symfony/web-link": "~3.3|~4.0", + "symfony/workflow": "~3.3|~4.0", + "symfony/yaml": "~2.8|~3.0|~4.0" }, "suggest": { "symfony/asset": "For using the AssetExtension", @@ -960,7 +1073,7 @@ "type": "symfony-bridge", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -987,7 +1100,7 @@ ], "description": "Symfony Twig Bridge", "homepage": "https://symfony.com", - "time": "2017-10-02T06:42:24+00:00" + "time": "2018-01-17T07:49:55+00:00" }, { "name": "twig/twig", diff --git a/vendor/autoload.php b/vendor/autoload.php index a5490dcb..8a573206 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInitc8703132b487e10223bc213e8736dd8b::getLoader(); +return ComposerAutoloaderInit8a9318ad96e1e6602a968c996fe31931::getLoader(); diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 7a91153b..3a141658 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -6,4 +6,11 @@ $vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( + 'ArithmeticError' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/ArithmeticError.php', + 'AssertionError' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/AssertionError.php', + 'DivisionByZeroError' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/DivisionByZeroError.php', + 'Error' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/Error.php', + 'ParseError' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/ParseError.php', + 'SessionUpdateTimestampHandlerInterface' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/SessionUpdateTimestampHandlerInterface.php', + 'TypeError' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/TypeError.php', ); diff --git a/vendor/composer/autoload_files.php b/vendor/composer/autoload_files.php index 3b4050bd..90cd12da 100644 --- a/vendor/composer/autoload_files.php +++ b/vendor/composer/autoload_files.php @@ -6,6 +6,8 @@ $vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( + '5255c38a0faeba867671b61dfda6d864' => $vendorDir . '/paragonie/random_compat/lib/random.php', + '023d27dca8066ef29e6739335ea73bad' => $vendorDir . '/symfony/polyfill-php70/bootstrap.php', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', 'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php', 'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php', diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php index 5628b712..7c118c86 100644 --- a/vendor/composer/autoload_psr4.php +++ b/vendor/composer/autoload_psr4.php @@ -7,6 +7,7 @@ $baseDir = dirname($vendorDir); return array( 'Twig\\' => array($vendorDir . '/twig/twig/src'), + 'Symfony\\Polyfill\\Php70\\' => array($vendorDir . '/symfony/polyfill-php70'), 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'), 'Symfony\\Component\\Routing\\' => array($vendorDir . '/symfony/routing'), 'Symfony\\Component\\HttpKernel\\' => array($vendorDir . '/symfony/http-kernel'), diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index dab5a41f..9e4d4100 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInitc8703132b487e10223bc213e8736dd8b +class ComposerAutoloaderInit8a9318ad96e1e6602a968c996fe31931 { private static $loader; @@ -19,15 +19,15 @@ class ComposerAutoloaderInitc8703132b487e10223bc213e8736dd8b return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInitc8703132b487e10223bc213e8736dd8b', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit8a9318ad96e1e6602a968c996fe31931', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInitc8703132b487e10223bc213e8736dd8b', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit8a9318ad96e1e6602a968c996fe31931', 'loadClassLoader')); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); if ($useStaticLoader) { require_once __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInitc8703132b487e10223bc213e8736dd8b::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit8a9318ad96e1e6602a968c996fe31931::getInitializer($loader)); } else { $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { @@ -48,19 +48,19 @@ class ComposerAutoloaderInitc8703132b487e10223bc213e8736dd8b $loader->register(true); if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInitc8703132b487e10223bc213e8736dd8b::$files; + $includeFiles = Composer\Autoload\ComposerStaticInit8a9318ad96e1e6602a968c996fe31931::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { - composerRequirec8703132b487e10223bc213e8736dd8b($fileIdentifier, $file); + composerRequire8a9318ad96e1e6602a968c996fe31931($fileIdentifier, $file); } return $loader; } } -function composerRequirec8703132b487e10223bc213e8736dd8b($fileIdentifier, $file) +function composerRequire8a9318ad96e1e6602a968c996fe31931($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { require $file; diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 199b65b2..6bb107e7 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,9 +4,11 @@ namespace Composer\Autoload; -class ComposerStaticInitc8703132b487e10223bc213e8736dd8b +class ComposerStaticInit8a9318ad96e1e6602a968c996fe31931 { public static $files = array ( + '5255c38a0faeba867671b61dfda6d864' => __DIR__ . '/..' . '/paragonie/random_compat/lib/random.php', + '023d27dca8066ef29e6739335ea73bad' => __DIR__ . '/..' . '/symfony/polyfill-php70/bootstrap.php', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', 'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php', 'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php', @@ -20,6 +22,7 @@ class ComposerStaticInitc8703132b487e10223bc213e8736dd8b ), 'S' => array ( + 'Symfony\\Polyfill\\Php70\\' => 23, 'Symfony\\Polyfill\\Mbstring\\' => 26, 'Symfony\\Component\\Routing\\' => 26, 'Symfony\\Component\\HttpKernel\\' => 29, @@ -52,6 +55,10 @@ class ComposerStaticInitc8703132b487e10223bc213e8736dd8b array ( 0 => __DIR__ . '/..' . '/twig/twig/src', ), + 'Symfony\\Polyfill\\Php70\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-php70', + ), 'Symfony\\Polyfill\\Mbstring\\' => array ( 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring', @@ -133,7 +140,7 @@ class ComposerStaticInitc8703132b487e10223bc213e8736dd8b array ( 'HAB\\' => array ( - 0 => 'Z:\\/src', + 0 => __DIR__ . '/../..' . '/src', ), 'HAB' => array ( @@ -142,12 +149,23 @@ class ComposerStaticInitc8703132b487e10223bc213e8736dd8b ), ); + public static $classMap = array ( + 'ArithmeticError' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/ArithmeticError.php', + 'AssertionError' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/AssertionError.php', + 'DivisionByZeroError' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/DivisionByZeroError.php', + 'Error' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/Error.php', + 'ParseError' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/ParseError.php', + 'SessionUpdateTimestampHandlerInterface' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/SessionUpdateTimestampHandlerInterface.php', + 'TypeError' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/TypeError.php', + ); + public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInitc8703132b487e10223bc213e8736dd8b::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInitc8703132b487e10223bc213e8736dd8b::$prefixDirsPsr4; - $loader->prefixesPsr0 = ComposerStaticInitc8703132b487e10223bc213e8736dd8b::$prefixesPsr0; + $loader->prefixLengthsPsr4 = ComposerStaticInit8a9318ad96e1e6602a968c996fe31931::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit8a9318ad96e1e6602a968c996fe31931::$prefixDirsPsr4; + $loader->prefixesPsr0 = ComposerStaticInit8a9318ad96e1e6602a968c996fe31931::$prefixesPsr0; + $loader->classMap = ComposerStaticInit8a9318ad96e1e6602a968c996fe31931::$classMap; }, null, ClassLoader::class); } diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 7c34ba6c..621516fb 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -1,53 +1,4 @@ [ - { - "name": "psr/log", - "version": "1.0.2", - "version_normalized": "1.0.2.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "time": "2016-10-10T12:19:37+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ] - }, { "name": "guzzlehttp/promises", "version": "v1.3.1", @@ -238,57 +189,6 @@ } } }, - { - "name": "psr/container", - "version": "1.0.0", - "version_normalized": "1.0.0.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "time": "2017-02-14T16:28:37+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Psr\\Container\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", - "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" - ] - }, { "name": "guzzlehttp/guzzle", "version": "6.3.0", @@ -377,19 +277,70 @@ } } }, + { + "name": "psr/container", + "version": "1.0.0", + "version_normalized": "1.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "time": "2017-02-14T16:28:37+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ] + }, { "name": "symfony/routing", - "version": "v3.3.10", - "version_normalized": "3.3.10.0", + "version": "v3.4.4", + "version_normalized": "3.4.4.0", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "2e26fa63da029dab49bf9377b3b4f60a8fecb009" + "reference": "235d01730d553a97732990588407eaf6779bb4b2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/2e26fa63da029dab49bf9377b3b4f60a8fecb009", - "reference": "2e26fa63da029dab49bf9377b3b4f60a8fecb009", + "url": "https://api.github.com/repos/symfony/routing/zipball/235d01730d553a97732990588407eaf6779bb4b2", + "reference": "235d01730d553a97732990588407eaf6779bb4b2", "shasum": "" }, "require": { @@ -398,17 +349,17 @@ "conflict": { "symfony/config": "<2.8", "symfony/dependency-injection": "<3.3", - "symfony/yaml": "<3.3" + "symfony/yaml": "<3.4" }, "require-dev": { "doctrine/annotations": "~1.0", "doctrine/common": "~2.2", "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0", - "symfony/dependency-injection": "~3.3", - "symfony/expression-language": "~2.8|~3.0", - "symfony/http-foundation": "~2.8|~3.0", - "symfony/yaml": "~3.3" + "symfony/config": "~2.8|~3.0|~4.0", + "symfony/dependency-injection": "~3.3|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/http-foundation": "~2.8|~3.0|~4.0", + "symfony/yaml": "~3.4|~4.0" }, "suggest": { "doctrine/annotations": "For using the annotation loader", @@ -418,11 +369,11 @@ "symfony/http-foundation": "For using a Symfony Request object", "symfony/yaml": "For using the YAML loader" }, - "time": "2017-10-02T07:25:00+00:00", + "time": "2018-01-16T18:03:57+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "installation-source": "dist", @@ -457,19 +408,130 @@ "url" ] }, + { + "name": "paragonie/random_compat", + "version": "v2.0.11", + "version_normalized": "2.0.11.0", + "source": { + "type": "git", + "url": "https://github.com/paragonie/random_compat.git", + "reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/5da4d3c796c275c55f057af5a643ae297d96b4d8", + "reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8", + "shasum": "" + }, + "require": { + "php": ">=5.2.0" + }, + "require-dev": { + "phpunit/phpunit": "4.*|5.*" + }, + "suggest": { + "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + }, + "time": "2017-09-27T21:40:39+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "files": [ + "lib/random.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com", + "homepage": "https://paragonie.com" + } + ], + "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", + "keywords": [ + "csprng", + "pseudorandom", + "random" + ] + }, + { + "name": "symfony/polyfill-php70", + "version": "v1.7.0", + "version_normalized": "1.7.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php70.git", + "reference": "3532bfcd8f933a7816f3a0a59682fc404776600f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/3532bfcd8f933a7816f3a0a59682fc404776600f", + "reference": "3532bfcd8f933a7816f3a0a59682fc404776600f", + "shasum": "" + }, + "require": { + "paragonie/random_compat": "~1.0|~2.0", + "php": ">=5.3.3" + }, + "time": "2018-01-30T19:27:44+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.7-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php70\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ] + }, { "name": "symfony/polyfill-mbstring", - "version": "v1.5.0", - "version_normalized": "1.5.0.0", + "version": "v1.7.0", + "version_normalized": "1.7.0.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "7c8fae0ac1d216eb54349e6a8baa57d515fe8803" + "reference": "78be803ce01e55d3491c1397cf1c64beb9c1b63b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7c8fae0ac1d216eb54349e6a8baa57d515fe8803", - "reference": "7c8fae0ac1d216eb54349e6a8baa57d515fe8803", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/78be803ce01e55d3491c1397cf1c64beb9c1b63b", + "reference": "78be803ce01e55d3491c1397cf1c64beb9c1b63b", "shasum": "" }, "require": { @@ -478,11 +540,11 @@ "suggest": { "ext-mbstring": "For best performance" }, - "time": "2017-06-14T15:44:48+00:00", + "time": "2018-01-30T19:27:44+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "1.5-dev" + "dev-master": "1.7-dev" } }, "installation-source": "dist", @@ -520,31 +582,32 @@ }, { "name": "symfony/http-foundation", - "version": "v3.3.10", - "version_normalized": "3.3.10.0", + "version": "v3.4.4", + "version_normalized": "3.4.4.0", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "22cf9c2b1d9f67cc8e75ae7f4eaa60e4c1eff1f8" + "reference": "8c39071ac9cc7e6d8dab1d556c990dc0d2cc3d30" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/22cf9c2b1d9f67cc8e75ae7f4eaa60e4c1eff1f8", - "reference": "22cf9c2b1d9f67cc8e75ae7f4eaa60e4c1eff1f8", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/8c39071ac9cc7e6d8dab1d556c990dc0d2cc3d30", + "reference": "8c39071ac9cc7e6d8dab1d556c990dc0d2cc3d30", "shasum": "" }, "require": { "php": "^5.5.9|>=7.0.8", - "symfony/polyfill-mbstring": "~1.1" + "symfony/polyfill-mbstring": "~1.1", + "symfony/polyfill-php70": "~1.6" }, "require-dev": { - "symfony/expression-language": "~2.8|~3.0" + "symfony/expression-language": "~2.8|~3.0|~4.0" }, - "time": "2017-10-05T23:10:23+00:00", + "time": "2018-01-29T09:03:43+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "installation-source": "dist", @@ -575,17 +638,17 @@ }, { "name": "symfony/event-dispatcher", - "version": "v3.3.10", - "version_normalized": "3.3.10.0", + "version": "v3.4.4", + "version_normalized": "3.4.4.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "d7ba037e4b8221956ab1e221c73c9e27e05dd423" + "reference": "26b87b6bca8f8f797331a30b76fdae5342dc26ca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/d7ba037e4b8221956ab1e221c73c9e27e05dd423", - "reference": "d7ba037e4b8221956ab1e221c73c9e27e05dd423", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/26b87b6bca8f8f797331a30b76fdae5342dc26ca", + "reference": "26b87b6bca8f8f797331a30b76fdae5342dc26ca", "shasum": "" }, "require": { @@ -596,20 +659,20 @@ }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0", - "symfony/dependency-injection": "~3.3", - "symfony/expression-language": "~2.8|~3.0", - "symfony/stopwatch": "~2.8|~3.0" + "symfony/config": "~2.8|~3.0|~4.0", + "symfony/dependency-injection": "~3.3|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/stopwatch": "~2.8|~3.0|~4.0" }, "suggest": { "symfony/dependency-injection": "", "symfony/http-kernel": "" }, - "time": "2017-10-02T06:42:24+00:00", + "time": "2018-01-03T07:37:34+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "installation-source": "dist", @@ -638,19 +701,68 @@ "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com" }, + { + "name": "psr/log", + "version": "1.0.2", + "version_normalized": "1.0.2.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "time": "2016-10-10T12:19:37+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ] + }, { "name": "symfony/debug", - "version": "v3.3.10", - "version_normalized": "3.3.10.0", + "version": "v3.4.4", + "version_normalized": "3.4.4.0", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "eb95d9ce8f18dcc1b3dfff00cb624c402be78ffd" + "reference": "53f6af2805daf52a43b393b93d2f24925d35c937" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/eb95d9ce8f18dcc1b3dfff00cb624c402be78ffd", - "reference": "eb95d9ce8f18dcc1b3dfff00cb624c402be78ffd", + "url": "https://api.github.com/repos/symfony/debug/zipball/53f6af2805daf52a43b393b93d2f24925d35c937", + "reference": "53f6af2805daf52a43b393b93d2f24925d35c937", "shasum": "" }, "require": { @@ -661,13 +773,13 @@ "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" }, "require-dev": { - "symfony/http-kernel": "~2.8|~3.0" + "symfony/http-kernel": "~2.8|~3.0|~4.0" }, - "time": "2017-10-02T06:42:24+00:00", + "time": "2018-01-18T22:16:57+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "installation-source": "dist", @@ -698,64 +810,66 @@ }, { "name": "symfony/http-kernel", - "version": "v3.3.10", - "version_normalized": "3.3.10.0", + "version": "v3.4.4", + "version_normalized": "3.4.4.0", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "654f047a78756964bf91b619554f956517394018" + "reference": "911d2e5dd4beb63caad9a72e43857de984301907" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/654f047a78756964bf91b619554f956517394018", - "reference": "654f047a78756964bf91b619554f956517394018", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/911d2e5dd4beb63caad9a72e43857de984301907", + "reference": "911d2e5dd4beb63caad9a72e43857de984301907", "shasum": "" }, "require": { "php": "^5.5.9|>=7.0.8", "psr/log": "~1.0", - "symfony/debug": "~2.8|~3.0", - "symfony/event-dispatcher": "~2.8|~3.0", - "symfony/http-foundation": "~3.3" + "symfony/debug": "~2.8|~3.0|~4.0", + "symfony/event-dispatcher": "~2.8|~3.0|~4.0", + "symfony/http-foundation": "^3.4.4|^4.0.4" }, "conflict": { "symfony/config": "<2.8", - "symfony/dependency-injection": "<3.3", + "symfony/dependency-injection": "<3.4", "symfony/var-dumper": "<3.3", "twig/twig": "<1.34|<2.4,>=2" }, + "provide": { + "psr/log-implementation": "1.0" + }, "require-dev": { "psr/cache": "~1.0", - "symfony/browser-kit": "~2.8|~3.0", + "symfony/browser-kit": "~2.8|~3.0|~4.0", "symfony/class-loader": "~2.8|~3.0", - "symfony/config": "~2.8|~3.0", - "symfony/console": "~2.8|~3.0", - "symfony/css-selector": "~2.8|~3.0", - "symfony/dependency-injection": "~3.3", - "symfony/dom-crawler": "~2.8|~3.0", - "symfony/expression-language": "~2.8|~3.0", - "symfony/finder": "~2.8|~3.0", - "symfony/process": "~2.8|~3.0", - "symfony/routing": "~2.8|~3.0", - "symfony/stopwatch": "~2.8|~3.0", - "symfony/templating": "~2.8|~3.0", - "symfony/translation": "~2.8|~3.0", - "symfony/var-dumper": "~3.3" + "symfony/config": "~2.8|~3.0|~4.0", + "symfony/console": "~2.8|~3.0|~4.0", + "symfony/css-selector": "~2.8|~3.0|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/dom-crawler": "~2.8|~3.0|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/finder": "~2.8|~3.0|~4.0", + "symfony/process": "~2.8|~3.0|~4.0", + "symfony/routing": "~3.4|~4.0", + "symfony/stopwatch": "~2.8|~3.0|~4.0", + "symfony/templating": "~2.8|~3.0|~4.0", + "symfony/translation": "~2.8|~3.0|~4.0", + "symfony/var-dumper": "~3.3|~4.0" }, "suggest": { "symfony/browser-kit": "", - "symfony/class-loader": "", "symfony/config": "", "symfony/console": "", "symfony/dependency-injection": "", "symfony/finder": "", "symfony/var-dumper": "" }, - "time": "2017-10-05T23:40:19+00:00", + "time": "2018-01-29T12:29:46+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "installation-source": "dist", @@ -786,17 +900,17 @@ }, { "name": "pimple/pimple", - "version": "v3.2.2", - "version_normalized": "3.2.2.0", + "version": "v3.2.3", + "version_normalized": "3.2.3.0", "source": { "type": "git", "url": "https://github.com/silexphp/Pimple.git", - "reference": "4d45fb62d96418396ec58ba76e6f065bca16e10a" + "reference": "9e403941ef9d65d20cba7d54e29fe906db42cf32" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/silexphp/Pimple/zipball/4d45fb62d96418396ec58ba76e6f065bca16e10a", - "reference": "4d45fb62d96418396ec58ba76e6f065bca16e10a", + "url": "https://api.github.com/repos/silexphp/Pimple/zipball/9e403941ef9d65d20cba7d54e29fe906db42cf32", + "reference": "9e403941ef9d65d20cba7d54e29fe906db42cf32", "shasum": "" }, "require": { @@ -806,7 +920,7 @@ "require-dev": { "symfony/phpunit-bridge": "^3.2" }, - "time": "2017-07-23T07:32:15+00:00", + "time": "2018-01-21T07:42:36+00:00", "type": "library", "extra": { "branch-alias": { @@ -838,17 +952,17 @@ }, { "name": "silex/silex", - "version": "v2.2.0", - "version_normalized": "2.2.0.0", + "version": "v2.2.3", + "version_normalized": "2.2.3.0", "source": { "type": "git", "url": "https://github.com/silexphp/Silex.git", - "reference": "ec7d5b5334465414952d4b2e935e73bd085dbbbb" + "reference": "90c80c3e5ef86c54b8769feca0320154c6e63f7c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/silexphp/Silex/zipball/ec7d5b5334465414952d4b2e935e73bd085dbbbb", - "reference": "ec7d5b5334465414952d4b2e935e73bd085dbbbb", + "url": "https://api.github.com/repos/silexphp/Silex/zipball/90c80c3e5ef86c54b8769feca0320154c6e63f7c", + "reference": "90c80c3e5ef86c54b8769feca0320154c6e63f7c", "shasum": "" }, "require": { @@ -894,7 +1008,7 @@ "symfony/web-link": "^3.3", "twig/twig": "~1.28|~2.0" }, - "time": "2017-07-23T07:40:14+00:00", + "time": "2018-02-25T11:21:42+00:00", "type": "library", "extra": { "branch-alias": { @@ -996,44 +1110,47 @@ }, { "name": "symfony/twig-bridge", - "version": "v3.3.10", - "version_normalized": "3.3.10.0", + "version": "v3.4.4", + "version_normalized": "3.4.4.0", "source": { "type": "git", "url": "https://github.com/symfony/twig-bridge.git", - "reference": "cc40b1ea0efd030d422c762328345883a0404de4" + "reference": "a69e3f21f2f652ae3da0937914e3f3830cc6eae9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/cc40b1ea0efd030d422c762328345883a0404de4", - "reference": "cc40b1ea0efd030d422c762328345883a0404de4", + "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/a69e3f21f2f652ae3da0937914e3f3830cc6eae9", + "reference": "a69e3f21f2f652ae3da0937914e3f3830cc6eae9", "shasum": "" }, "require": { "php": "^5.5.9|>=7.0.8", - "twig/twig": "~1.34|~2.4" + "twig/twig": "^1.35|^2.4.4" }, "conflict": { - "symfony/form": "<3.2.10|~3.3,<3.3.3" + "symfony/console": "<3.4", + "symfony/form": "<3.4" }, "require-dev": { - "fig/link-util": "^1.0", - "symfony/asset": "~2.8|~3.0", - "symfony/console": "~2.8|~3.0", - "symfony/expression-language": "~2.8|~3.0", - "symfony/finder": "~2.8|~3.0", - "symfony/form": "^3.2.10|^3.3.3", - "symfony/http-kernel": "~3.2", + "symfony/asset": "~2.8|~3.0|~4.0", + "symfony/console": "~3.4|~4.0", + "symfony/dependency-injection": "~2.8|~3.0|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/finder": "~2.8|~3.0|~4.0", + "symfony/form": "~3.4|~4.0", + "symfony/http-foundation": "^3.3.11|~4.0", + "symfony/http-kernel": "~3.2|~4.0", "symfony/polyfill-intl-icu": "~1.0", - "symfony/routing": "~2.8|~3.0", - "symfony/security": "~2.8|~3.0", + "symfony/routing": "~2.8|~3.0|~4.0", + "symfony/security": "~2.8|~3.0|~4.0", "symfony/security-acl": "~2.8|~3.0", - "symfony/stopwatch": "~2.8|~3.0", - "symfony/templating": "~2.8|~3.0", - "symfony/translation": "~2.8|~3.0", - "symfony/var-dumper": "~2.8.10|~3.1.4|~3.2", - "symfony/web-link": "~3.3", - "symfony/yaml": "~2.8|~3.0" + "symfony/stopwatch": "~2.8|~3.0|~4.0", + "symfony/templating": "~2.8|~3.0|~4.0", + "symfony/translation": "~2.8|~3.0|~4.0", + "symfony/var-dumper": "~2.8.10|~3.1.4|~3.2|~4.0", + "symfony/web-link": "~3.3|~4.0", + "symfony/workflow": "~3.3|~4.0", + "symfony/yaml": "~2.8|~3.0|~4.0" }, "suggest": { "symfony/asset": "For using the AssetExtension", @@ -1050,11 +1167,11 @@ "symfony/web-link": "For using the WebLinkExtension", "symfony/yaml": "For using the YamlExtension" }, - "time": "2017-10-02T06:42:24+00:00", + "time": "2018-01-17T07:49:55+00:00", "type": "symfony-bridge", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "installation-source": "dist", diff --git a/vendor/paragonie/random_compat/LICENSE b/vendor/paragonie/random_compat/LICENSE new file mode 100644 index 00000000..45c7017d --- /dev/null +++ b/vendor/paragonie/random_compat/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Paragon Initiative Enterprises + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/vendor/paragonie/random_compat/build-phar.sh b/vendor/paragonie/random_compat/build-phar.sh new file mode 100644 index 00000000..b4a5ba31 --- /dev/null +++ b/vendor/paragonie/random_compat/build-phar.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +basedir=$( dirname $( readlink -f ${BASH_SOURCE[0]} ) ) + +php -dphar.readonly=0 "$basedir/other/build_phar.php" $* \ No newline at end of file diff --git a/vendor/paragonie/random_compat/composer.json b/vendor/paragonie/random_compat/composer.json new file mode 100644 index 00000000..1c5978c6 --- /dev/null +++ b/vendor/paragonie/random_compat/composer.json @@ -0,0 +1,37 @@ +{ + "name": "paragonie/random_compat", + "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", + "keywords": [ + "csprng", + "random", + "pseudorandom" + ], + "license": "MIT", + "type": "library", + "authors": [ + { + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com", + "homepage": "https://paragonie.com" + } + ], + "support": { + "issues": "https://github.com/paragonie/random_compat/issues", + "email": "info@paragonie.com", + "source": "https://github.com/paragonie/random_compat" + }, + "require": { + "php": ">=5.2.0" + }, + "require-dev": { + "phpunit/phpunit": "4.*|5.*" + }, + "suggest": { + "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + }, + "autoload": { + "files": [ + "lib/random.php" + ] + } +} diff --git a/vendor/paragonie/random_compat/dist/random_compat.phar.pubkey b/vendor/paragonie/random_compat/dist/random_compat.phar.pubkey new file mode 100644 index 00000000..eb50ebfc --- /dev/null +++ b/vendor/paragonie/random_compat/dist/random_compat.phar.pubkey @@ -0,0 +1,5 @@ +-----BEGIN PUBLIC KEY----- +MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEEd+wCqJDrx5B4OldM0dQE0ZMX+lx1ZWm +pui0SUqD4G29L3NGsz9UhJ/0HjBdbnkhIK5xviT0X5vtjacF6ajgcCArbTB+ds+p ++h7Q084NuSuIpNb6YPfoUFgC/CL9kAoc +-----END PUBLIC KEY----- diff --git a/vendor/paragonie/random_compat/dist/random_compat.phar.pubkey.asc b/vendor/paragonie/random_compat/dist/random_compat.phar.pubkey.asc new file mode 100644 index 00000000..6a1d7f30 --- /dev/null +++ b/vendor/paragonie/random_compat/dist/random_compat.phar.pubkey.asc @@ -0,0 +1,11 @@ +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v2.0.22 (MingW32) + +iQEcBAABAgAGBQJWtW1hAAoJEGuXocKCZATaJf0H+wbZGgskK1dcRTsuVJl9IWip +QwGw/qIKI280SD6/ckoUMxKDCJiFuPR14zmqnS36k7N5UNPnpdTJTS8T11jttSpg +1LCmgpbEIpgaTah+cELDqFCav99fS+bEiAL5lWDAHBTE/XPjGVCqeehyPYref4IW +NDBIEsvnHPHPLsn6X5jq4+Yj5oUixgxaMPiR+bcO4Sh+RzOVB6i2D0upWfRXBFXA +NNnsg9/zjvoC7ZW73y9uSH+dPJTt/Vgfeiv52/v41XliyzbUyLalf02GNPY+9goV +JHG1ulEEBJOCiUD9cE1PUIJwHA/HqyhHIvV350YoEFiHl8iSwm7SiZu5kPjaq74= +=B6+8 +-----END PGP SIGNATURE----- diff --git a/vendor/paragonie/random_compat/lib/byte_safe_strings.php b/vendor/paragonie/random_compat/lib/byte_safe_strings.php new file mode 100644 index 00000000..3de86b22 --- /dev/null +++ b/vendor/paragonie/random_compat/lib/byte_safe_strings.php @@ -0,0 +1,181 @@ +<?php +/** + * Random_* Compatibility Library + * for using the new PHP 7 random_* API in PHP 5 projects + * + * The MIT License (MIT) + * + * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +if (!is_callable('RandomCompat_strlen')) { + if ( + defined('MB_OVERLOAD_STRING') && + ini_get('mbstring.func_overload') & MB_OVERLOAD_STRING + ) { + /** + * strlen() implementation that isn't brittle to mbstring.func_overload + * + * This version uses mb_strlen() in '8bit' mode to treat strings as raw + * binary rather than UTF-8, ISO-8859-1, etc + * + * @param string $binary_string + * + * @throws TypeError + * + * @return int + */ + function RandomCompat_strlen($binary_string) + { + if (!is_string($binary_string)) { + throw new TypeError( + 'RandomCompat_strlen() expects a string' + ); + } + + return (int) mb_strlen($binary_string, '8bit'); + } + + } else { + /** + * strlen() implementation that isn't brittle to mbstring.func_overload + * + * This version just used the default strlen() + * + * @param string $binary_string + * + * @throws TypeError + * + * @return int + */ + function RandomCompat_strlen($binary_string) + { + if (!is_string($binary_string)) { + throw new TypeError( + 'RandomCompat_strlen() expects a string' + ); + } + return (int) strlen($binary_string); + } + } +} + +if (!is_callable('RandomCompat_substr')) { + + if ( + defined('MB_OVERLOAD_STRING') + && + ini_get('mbstring.func_overload') & MB_OVERLOAD_STRING + ) { + /** + * substr() implementation that isn't brittle to mbstring.func_overload + * + * This version uses mb_substr() in '8bit' mode to treat strings as raw + * binary rather than UTF-8, ISO-8859-1, etc + * + * @param string $binary_string + * @param int $start + * @param int $length (optional) + * + * @throws TypeError + * + * @return string + */ + function RandomCompat_substr($binary_string, $start, $length = null) + { + if (!is_string($binary_string)) { + throw new TypeError( + 'RandomCompat_substr(): First argument should be a string' + ); + } + + if (!is_int($start)) { + throw new TypeError( + 'RandomCompat_substr(): Second argument should be an integer' + ); + } + + if ($length === null) { + /** + * mb_substr($str, 0, NULL, '8bit') returns an empty string on + * PHP 5.3, so we have to find the length ourselves. + */ + $length = RandomCompat_strlen($binary_string) - $start; + } elseif (!is_int($length)) { + throw new TypeError( + 'RandomCompat_substr(): Third argument should be an integer, or omitted' + ); + } + + // Consistency with PHP's behavior + if ($start === RandomCompat_strlen($binary_string) && $length === 0) { + return ''; + } + if ($start > RandomCompat_strlen($binary_string)) { + return ''; + } + + return (string) mb_substr($binary_string, $start, $length, '8bit'); + } + + } else { + + /** + * substr() implementation that isn't brittle to mbstring.func_overload + * + * This version just uses the default substr() + * + * @param string $binary_string + * @param int $start + * @param int $length (optional) + * + * @throws TypeError + * + * @return string + */ + function RandomCompat_substr($binary_string, $start, $length = null) + { + if (!is_string($binary_string)) { + throw new TypeError( + 'RandomCompat_substr(): First argument should be a string' + ); + } + + if (!is_int($start)) { + throw new TypeError( + 'RandomCompat_substr(): Second argument should be an integer' + ); + } + + if ($length !== null) { + if (!is_int($length)) { + throw new TypeError( + 'RandomCompat_substr(): Third argument should be an integer, or omitted' + ); + } + + return (string) substr($binary_string, $start, $length); + } + + return (string) substr($binary_string, $start); + } + } +} diff --git a/vendor/paragonie/random_compat/lib/cast_to_int.php b/vendor/paragonie/random_compat/lib/cast_to_int.php new file mode 100644 index 00000000..9a4fab99 --- /dev/null +++ b/vendor/paragonie/random_compat/lib/cast_to_int.php @@ -0,0 +1,75 @@ +<?php +/** + * Random_* Compatibility Library + * for using the new PHP 7 random_* API in PHP 5 projects + * + * The MIT License (MIT) + * + * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +if (!is_callable('RandomCompat_intval')) { + + /** + * Cast to an integer if we can, safely. + * + * If you pass it a float in the range (~PHP_INT_MAX, PHP_INT_MAX) + * (non-inclusive), it will sanely cast it to an int. If you it's equal to + * ~PHP_INT_MAX or PHP_INT_MAX, we let it fail as not an integer. Floats + * lose precision, so the <= and => operators might accidentally let a float + * through. + * + * @param int|float $number The number we want to convert to an int + * @param bool $fail_open Set to true to not throw an exception + * + * @return float|int + * @psalm-suppress InvalidReturnType + * + * @throws TypeError + */ + function RandomCompat_intval($number, $fail_open = false) + { + if (is_int($number) || is_float($number)) { + $number += 0; + } elseif (is_numeric($number)) { + $number += 0; + } + + if ( + is_float($number) + && + $number > ~PHP_INT_MAX + && + $number < PHP_INT_MAX + ) { + $number = (int) $number; + } + + if (is_int($number)) { + return (int) $number; + } elseif (!$fail_open) { + throw new TypeError( + 'Expected an integer.' + ); + } + return $number; + } +} diff --git a/vendor/paragonie/random_compat/lib/error_polyfill.php b/vendor/paragonie/random_compat/lib/error_polyfill.php new file mode 100644 index 00000000..6a91990c --- /dev/null +++ b/vendor/paragonie/random_compat/lib/error_polyfill.php @@ -0,0 +1,49 @@ +<?php +/** + * Random_* Compatibility Library + * for using the new PHP 7 random_* API in PHP 5 projects + * + * The MIT License (MIT) + * + * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +if (!class_exists('Error', false)) { + // We can't really avoid making this extend Exception in PHP 5. + class Error extends Exception + { + + } +} + +if (!class_exists('TypeError', false)) { + if (is_subclass_of('Error', 'Exception')) { + class TypeError extends Error + { + + } + } else { + class TypeError extends Exception + { + + } + } +} diff --git a/vendor/paragonie/random_compat/lib/random.php b/vendor/paragonie/random_compat/lib/random.php new file mode 100644 index 00000000..df74c8a4 --- /dev/null +++ b/vendor/paragonie/random_compat/lib/random.php @@ -0,0 +1,223 @@ +<?php +/** + * Random_* Compatibility Library + * for using the new PHP 7 random_* API in PHP 5 projects + * + * @version 2.0.10 + * @released 2017-03-13 + * + * The MIT License (MIT) + * + * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +if (!defined('PHP_VERSION_ID')) { + // This constant was introduced in PHP 5.2.7 + $RandomCompatversion = array_map('intval', explode('.', PHP_VERSION)); + define( + 'PHP_VERSION_ID', + $RandomCompatversion[0] * 10000 + + $RandomCompatversion[1] * 100 + + $RandomCompatversion[2] + ); + $RandomCompatversion = null; +} + +/** + * PHP 7.0.0 and newer have these functions natively. + */ +if (PHP_VERSION_ID >= 70000) { + return; +} + +if (!defined('RANDOM_COMPAT_READ_BUFFER')) { + define('RANDOM_COMPAT_READ_BUFFER', 8); +} + +$RandomCompatDIR = dirname(__FILE__); + +require_once $RandomCompatDIR . '/byte_safe_strings.php'; +require_once $RandomCompatDIR . '/cast_to_int.php'; +require_once $RandomCompatDIR . '/error_polyfill.php'; + +if (!is_callable('random_bytes')) { + /** + * PHP 5.2.0 - 5.6.x way to implement random_bytes() + * + * We use conditional statements here to define the function in accordance + * to the operating environment. It's a micro-optimization. + * + * In order of preference: + * 1. Use libsodium if available. + * 2. fread() /dev/urandom if available (never on Windows) + * 3. mcrypt_create_iv($bytes, MCRYPT_DEV_URANDOM) + * 4. COM('CAPICOM.Utilities.1')->GetRandom() + * + * See RATIONALE.md for our reasoning behind this particular order + */ + if (extension_loaded('libsodium')) { + // See random_bytes_libsodium.php + if (PHP_VERSION_ID >= 50300 && is_callable('\\Sodium\\randombytes_buf')) { + require_once $RandomCompatDIR . '/random_bytes_libsodium.php'; + } elseif (method_exists('Sodium', 'randombytes_buf')) { + require_once $RandomCompatDIR . '/random_bytes_libsodium_legacy.php'; + } + } + + /** + * Reading directly from /dev/urandom: + */ + if (DIRECTORY_SEPARATOR === '/') { + // DIRECTORY_SEPARATOR === '/' on Unix-like OSes -- this is a fast + // way to exclude Windows. + $RandomCompatUrandom = true; + $RandomCompat_basedir = ini_get('open_basedir'); + + if (!empty($RandomCompat_basedir)) { + $RandomCompat_open_basedir = explode( + PATH_SEPARATOR, + strtolower($RandomCompat_basedir) + ); + $RandomCompatUrandom = (array() !== array_intersect( + array('/dev', '/dev/', '/dev/urandom'), + $RandomCompat_open_basedir + )); + $RandomCompat_open_basedir = null; + } + + if ( + !is_callable('random_bytes') + && + $RandomCompatUrandom + && + @is_readable('/dev/urandom') + ) { + // Error suppression on is_readable() in case of an open_basedir + // or safe_mode failure. All we care about is whether or not we + // can read it at this point. If the PHP environment is going to + // panic over trying to see if the file can be read in the first + // place, that is not helpful to us here. + + // See random_bytes_dev_urandom.php + require_once $RandomCompatDIR . '/random_bytes_dev_urandom.php'; + } + // Unset variables after use + $RandomCompat_basedir = null; + } else { + $RandomCompatUrandom = false; + } + + /** + * mcrypt_create_iv() + * + * We only want to use mcypt_create_iv() if: + * + * - random_bytes() hasn't already been defined + * - the mcrypt extensions is loaded + * - One of these two conditions is true: + * - We're on Windows (DIRECTORY_SEPARATOR !== '/') + * - We're not on Windows and /dev/urandom is readabale + * (i.e. we're not in a chroot jail) + * - Special case: + * - If we're not on Windows, but the PHP version is between + * 5.6.10 and 5.6.12, we don't want to use mcrypt. It will + * hang indefinitely. This is bad. + * - If we're on Windows, we want to use PHP >= 5.3.7 or else + * we get insufficient entropy errors. + */ + if ( + !is_callable('random_bytes') + && + // Windows on PHP < 5.3.7 is broken, but non-Windows is not known to be. + (DIRECTORY_SEPARATOR === '/' || PHP_VERSION_ID >= 50307) + && + // Prevent this code from hanging indefinitely on non-Windows; + // see https://bugs.php.net/bug.php?id=69833 + ( + DIRECTORY_SEPARATOR !== '/' || + (PHP_VERSION_ID <= 50609 || PHP_VERSION_ID >= 50613) + ) + && + extension_loaded('mcrypt') + ) { + // See random_bytes_mcrypt.php + require_once $RandomCompatDIR . '/random_bytes_mcrypt.php'; + } + $RandomCompatUrandom = null; + + /** + * This is a Windows-specific fallback, for when the mcrypt extension + * isn't loaded. + */ + if ( + !is_callable('random_bytes') + && + extension_loaded('com_dotnet') + && + class_exists('COM') + ) { + $RandomCompat_disabled_classes = preg_split( + '#\s*,\s*#', + strtolower(ini_get('disable_classes')) + ); + + if (!in_array('com', $RandomCompat_disabled_classes)) { + try { + $RandomCompatCOMtest = new COM('CAPICOM.Utilities.1'); + if (method_exists($RandomCompatCOMtest, 'GetRandom')) { + // See random_bytes_com_dotnet.php + require_once $RandomCompatDIR . '/random_bytes_com_dotnet.php'; + } + } catch (com_exception $e) { + // Don't try to use it. + } + } + $RandomCompat_disabled_classes = null; + $RandomCompatCOMtest = null; + } + + /** + * throw new Exception + */ + if (!is_callable('random_bytes')) { + /** + * We don't have any more options, so let's throw an exception right now + * and hope the developer won't let it fail silently. + * + * @param mixed $length + * @return void + * @throws Exception + */ + function random_bytes($length) + { + unset($length); // Suppress "variable not used" warnings. + throw new Exception( + 'There is no suitable CSPRNG installed on your system' + ); + } + } +} + +if (!is_callable('random_int')) { + require_once $RandomCompatDIR . '/random_int.php'; +} + +$RandomCompatDIR = null; diff --git a/vendor/paragonie/random_compat/lib/random_bytes_com_dotnet.php b/vendor/paragonie/random_compat/lib/random_bytes_com_dotnet.php new file mode 100644 index 00000000..fc1926e5 --- /dev/null +++ b/vendor/paragonie/random_compat/lib/random_bytes_com_dotnet.php @@ -0,0 +1,88 @@ +<?php +/** + * Random_* Compatibility Library + * for using the new PHP 7 random_* API in PHP 5 projects + * + * The MIT License (MIT) + * + * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +if (!is_callable('random_bytes')) { + /** + * Windows with PHP < 5.3.0 will not have the function + * openssl_random_pseudo_bytes() available, so let's use + * CAPICOM to work around this deficiency. + * + * @param int $bytes + * + * @throws Exception + * + * @return string + */ + function random_bytes($bytes) + { + try { + $bytes = RandomCompat_intval($bytes); + } catch (TypeError $ex) { + throw new TypeError( + 'random_bytes(): $bytes must be an integer' + ); + } + + if ($bytes < 1) { + throw new Error( + 'Length must be greater than 0' + ); + } + + $buf = ''; + if (!class_exists('COM')) { + throw new Error( + 'COM does not exist' + ); + } + $util = new COM('CAPICOM.Utilities.1'); + $execCount = 0; + + /** + * Let's not let it loop forever. If we run N times and fail to + * get N bytes of random data, then CAPICOM has failed us. + */ + do { + $buf .= base64_decode($util->GetRandom($bytes, 0)); + if (RandomCompat_strlen($buf) >= $bytes) { + /** + * Return our random entropy buffer here: + */ + return RandomCompat_substr($buf, 0, $bytes); + } + ++$execCount; + } while ($execCount < $bytes); + + /** + * If we reach here, PHP has failed us. + */ + throw new Exception( + 'Could not gather sufficient random data' + ); + } +} \ No newline at end of file diff --git a/vendor/paragonie/random_compat/lib/random_bytes_dev_urandom.php b/vendor/paragonie/random_compat/lib/random_bytes_dev_urandom.php new file mode 100644 index 00000000..df5b9152 --- /dev/null +++ b/vendor/paragonie/random_compat/lib/random_bytes_dev_urandom.php @@ -0,0 +1,167 @@ +<?php +/** + * Random_* Compatibility Library + * for using the new PHP 7 random_* API in PHP 5 projects + * + * The MIT License (MIT) + * + * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +if (!defined('RANDOM_COMPAT_READ_BUFFER')) { + define('RANDOM_COMPAT_READ_BUFFER', 8); +} + +if (!is_callable('random_bytes')) { + /** + * Unless open_basedir is enabled, use /dev/urandom for + * random numbers in accordance with best practices + * + * Why we use /dev/urandom and not /dev/random + * @ref http://sockpuppet.org/blog/2014/02/25/safely-generate-random-numbers + * + * @param int $bytes + * + * @throws Exception + * + * @return string + */ + function random_bytes($bytes) + { + static $fp = null; + /** + * This block should only be run once + */ + if (empty($fp)) { + /** + * We use /dev/urandom if it is a char device. + * We never fall back to /dev/random + */ + $fp = fopen('/dev/urandom', 'rb'); + if (!empty($fp)) { + $st = fstat($fp); + if (($st['mode'] & 0170000) !== 020000) { + fclose($fp); + $fp = false; + } + } + + if (!empty($fp)) { + /** + * stream_set_read_buffer() does not exist in HHVM + * + * If we don't set the stream's read buffer to 0, PHP will + * internally buffer 8192 bytes, which can waste entropy + * + * stream_set_read_buffer returns 0 on success + */ + if (is_callable('stream_set_read_buffer')) { + stream_set_read_buffer($fp, RANDOM_COMPAT_READ_BUFFER); + } + if (is_callable('stream_set_chunk_size')) { + stream_set_chunk_size($fp, RANDOM_COMPAT_READ_BUFFER); + } + } + } + + try { + $bytes = RandomCompat_intval($bytes); + } catch (TypeError $ex) { + throw new TypeError( + 'random_bytes(): $bytes must be an integer' + ); + } + + if ($bytes < 1) { + throw new Error( + 'Length must be greater than 0' + ); + } + + /** + * This if() block only runs if we managed to open a file handle + * + * It does not belong in an else {} block, because the above + * if (empty($fp)) line is logic that should only be run once per + * page load. + */ + if (!empty($fp)) { + /** + * @var int + */ + $remaining = $bytes; + + /** + * @var string|bool + */ + $buf = ''; + + /** + * We use fread() in a loop to protect against partial reads + */ + do { + /** + * @var string|bool + */ + $read = fread($fp, $remaining); + if (!is_string($read)) { + if ($read === false) { + /** + * We cannot safely read from the file. Exit the + * do-while loop and trigger the exception condition + * + * @var string|bool + */ + $buf = false; + break; + } + } + /** + * Decrease the number of bytes returned from remaining + */ + $remaining -= RandomCompat_strlen($read); + /** + * @var string|bool + */ + $buf = $buf . $read; + } while ($remaining > 0); + + /** + * Is our result valid? + */ + if (is_string($buf)) { + if (RandomCompat_strlen($buf) === $bytes) { + /** + * Return our random entropy buffer here: + */ + return $buf; + } + } + } + + /** + * If we reach here, PHP has failed us. + */ + throw new Exception( + 'Error reading from source device' + ); + } +} diff --git a/vendor/paragonie/random_compat/lib/random_bytes_libsodium.php b/vendor/paragonie/random_compat/lib/random_bytes_libsodium.php new file mode 100644 index 00000000..4af1a242 --- /dev/null +++ b/vendor/paragonie/random_compat/lib/random_bytes_libsodium.php @@ -0,0 +1,88 @@ +<?php +/** + * Random_* Compatibility Library + * for using the new PHP 7 random_* API in PHP 5 projects + * + * The MIT License (MIT) + * + * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +if (!is_callable('random_bytes')) { + /** + * If the libsodium PHP extension is loaded, we'll use it above any other + * solution. + * + * libsodium-php project: + * @ref https://github.com/jedisct1/libsodium-php + * + * @param int $bytes + * + * @throws Exception + * + * @return string + */ + function random_bytes($bytes) + { + try { + $bytes = RandomCompat_intval($bytes); + } catch (TypeError $ex) { + throw new TypeError( + 'random_bytes(): $bytes must be an integer' + ); + } + + if ($bytes < 1) { + throw new Error( + 'Length must be greater than 0' + ); + } + + /** + * \Sodium\randombytes_buf() doesn't allow more than 2147483647 bytes to be + * generated in one invocation. + */ + if ($bytes > 2147483647) { + $buf = ''; + for ($i = 0; $i < $bytes; $i += 1073741824) { + $n = ($bytes - $i) > 1073741824 + ? 1073741824 + : $bytes - $i; + $buf .= \Sodium\randombytes_buf($n); + } + } else { + $buf = \Sodium\randombytes_buf($bytes); + } + + if ($buf !== false) { + if (RandomCompat_strlen($buf) === $bytes) { + return $buf; + } + } + + /** + * If we reach here, PHP has failed us. + */ + throw new Exception( + 'Could not gather sufficient random data' + ); + } +} diff --git a/vendor/paragonie/random_compat/lib/random_bytes_libsodium_legacy.php b/vendor/paragonie/random_compat/lib/random_bytes_libsodium_legacy.php new file mode 100644 index 00000000..705af526 --- /dev/null +++ b/vendor/paragonie/random_compat/lib/random_bytes_libsodium_legacy.php @@ -0,0 +1,92 @@ +<?php +/** + * Random_* Compatibility Library + * for using the new PHP 7 random_* API in PHP 5 projects + * + * The MIT License (MIT) + * + * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +if (!is_callable('random_bytes')) { + /** + * If the libsodium PHP extension is loaded, we'll use it above any other + * solution. + * + * libsodium-php project: + * @ref https://github.com/jedisct1/libsodium-php + * + * @param int $bytes + * + * @throws Exception + * + * @return string + */ + function random_bytes($bytes) + { + try { + $bytes = RandomCompat_intval($bytes); + } catch (TypeError $ex) { + throw new TypeError( + 'random_bytes(): $bytes must be an integer' + ); + } + + if ($bytes < 1) { + throw new Error( + 'Length must be greater than 0' + ); + } + + /** + * @var string + */ + $buf = ''; + + /** + * \Sodium\randombytes_buf() doesn't allow more than 2147483647 bytes to be + * generated in one invocation. + */ + if ($bytes > 2147483647) { + for ($i = 0; $i < $bytes; $i += 1073741824) { + $n = ($bytes - $i) > 1073741824 + ? 1073741824 + : $bytes - $i; + $buf .= Sodium::randombytes_buf((int) $n); + } + } else { + $buf .= Sodium::randombytes_buf((int) $bytes); + } + + if (is_string($buf)) { + if (RandomCompat_strlen($buf) === $bytes) { + return $buf; + } + } + + /** + * If we reach here, PHP has failed us. + */ + throw new Exception( + 'Could not gather sufficient random data' + ); + } +} diff --git a/vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php b/vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php new file mode 100644 index 00000000..aac9c013 --- /dev/null +++ b/vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php @@ -0,0 +1,77 @@ +<?php +/** + * Random_* Compatibility Library + * for using the new PHP 7 random_* API in PHP 5 projects + * + * The MIT License (MIT) + * + * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +if (!is_callable('random_bytes')) { + /** + * Powered by ext/mcrypt (and thankfully NOT libmcrypt) + * + * @ref https://bugs.php.net/bug.php?id=55169 + * @ref https://github.com/php/php-src/blob/c568ffe5171d942161fc8dda066bce844bdef676/ext/mcrypt/mcrypt.c#L1321-L1386 + * + * @param int $bytes + * + * @throws Exception + * + * @return string + */ + function random_bytes($bytes) + { + try { + $bytes = RandomCompat_intval($bytes); + } catch (TypeError $ex) { + throw new TypeError( + 'random_bytes(): $bytes must be an integer' + ); + } + + if ($bytes < 1) { + throw new Error( + 'Length must be greater than 0' + ); + } + + $buf = @mcrypt_create_iv($bytes, MCRYPT_DEV_URANDOM); + if ( + $buf !== false + && + RandomCompat_strlen($buf) === $bytes + ) { + /** + * Return our random entropy buffer here: + */ + return $buf; + } + + /** + * If we reach here, PHP has failed us. + */ + throw new Exception( + 'Could not gather sufficient random data' + ); + } +} diff --git a/vendor/paragonie/random_compat/lib/random_int.php b/vendor/paragonie/random_compat/lib/random_int.php new file mode 100644 index 00000000..5b2143a1 --- /dev/null +++ b/vendor/paragonie/random_compat/lib/random_int.php @@ -0,0 +1,190 @@ +<?php + +if (!is_callable('random_int')) { + /** + * Random_* Compatibility Library + * for using the new PHP 7 random_* API in PHP 5 projects + * + * The MIT License (MIT) + * + * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + + /** + * Fetch a random integer between $min and $max inclusive + * + * @param int $min + * @param int $max + * + * @throws Exception + * + * @return int + */ + function random_int($min, $max) + { + /** + * Type and input logic checks + * + * If you pass it a float in the range (~PHP_INT_MAX, PHP_INT_MAX) + * (non-inclusive), it will sanely cast it to an int. If you it's equal to + * ~PHP_INT_MAX or PHP_INT_MAX, we let it fail as not an integer. Floats + * lose precision, so the <= and => operators might accidentally let a float + * through. + */ + + try { + $min = RandomCompat_intval($min); + } catch (TypeError $ex) { + throw new TypeError( + 'random_int(): $min must be an integer' + ); + } + + try { + $max = RandomCompat_intval($max); + } catch (TypeError $ex) { + throw new TypeError( + 'random_int(): $max must be an integer' + ); + } + + /** + * Now that we've verified our weak typing system has given us an integer, + * let's validate the logic then we can move forward with generating random + * integers along a given range. + */ + if ($min > $max) { + throw new Error( + 'Minimum value must be less than or equal to the maximum value' + ); + } + + if ($max === $min) { + return (int) $min; + } + + /** + * Initialize variables to 0 + * + * We want to store: + * $bytes => the number of random bytes we need + * $mask => an integer bitmask (for use with the &) operator + * so we can minimize the number of discards + */ + $attempts = $bits = $bytes = $mask = $valueShift = 0; + + /** + * At this point, $range is a positive number greater than 0. It might + * overflow, however, if $max - $min > PHP_INT_MAX. PHP will cast it to + * a float and we will lose some precision. + */ + $range = $max - $min; + + /** + * Test for integer overflow: + */ + if (!is_int($range)) { + + /** + * Still safely calculate wider ranges. + * Provided by @CodesInChaos, @oittaa + * + * @ref https://gist.github.com/CodesInChaos/03f9ea0b58e8b2b8d435 + * + * We use ~0 as a mask in this case because it generates all 1s + * + * @ref https://eval.in/400356 (32-bit) + * @ref http://3v4l.org/XX9r5 (64-bit) + */ + $bytes = PHP_INT_SIZE; + $mask = ~0; + + } else { + + /** + * $bits is effectively ceil(log($range, 2)) without dealing with + * type juggling + */ + while ($range > 0) { + if ($bits % 8 === 0) { + ++$bytes; + } + ++$bits; + $range >>= 1; + $mask = $mask << 1 | 1; + } + $valueShift = $min; + } + + $val = 0; + /** + * Now that we have our parameters set up, let's begin generating + * random integers until one falls between $min and $max + */ + do { + /** + * The rejection probability is at most 0.5, so this corresponds + * to a failure probability of 2^-128 for a working RNG + */ + if ($attempts > 128) { + throw new Exception( + 'random_int: RNG is broken - too many rejections' + ); + } + + /** + * Let's grab the necessary number of random bytes + */ + $randomByteString = random_bytes($bytes); + + /** + * Let's turn $randomByteString into an integer + * + * This uses bitwise operators (<< and |) to build an integer + * out of the values extracted from ord() + * + * Example: [9F] | [6D] | [32] | [0C] => + * 159 + 27904 + 3276800 + 201326592 => + * 204631455 + */ + $val &= 0; + for ($i = 0; $i < $bytes; ++$i) { + $val |= ord($randomByteString[$i]) << ($i * 8); + } + + /** + * Apply mask + */ + $val &= $mask; + $val += $valueShift; + + ++$attempts; + /** + * If $val overflows to a floating point number, + * ... or is larger than $max, + * ... or smaller than $min, + * then try again. + */ + } while (!is_int($val) || $val > $max || $val < $min); + + return (int) $val; + } +} diff --git a/vendor/paragonie/random_compat/other/build_phar.php b/vendor/paragonie/random_compat/other/build_phar.php new file mode 100644 index 00000000..70ef4b2e --- /dev/null +++ b/vendor/paragonie/random_compat/other/build_phar.php @@ -0,0 +1,57 @@ +<?php +$dist = dirname(__DIR__).'/dist'; +if (!is_dir($dist)) { + mkdir($dist, 0755); +} +if (file_exists($dist.'/random_compat.phar')) { + unlink($dist.'/random_compat.phar'); +} +$phar = new Phar( + $dist.'/random_compat.phar', + FilesystemIterator::CURRENT_AS_FILEINFO | \FilesystemIterator::KEY_AS_FILENAME, + 'random_compat.phar' +); +rename( + dirname(__DIR__).'/lib/random.php', + dirname(__DIR__).'/lib/index.php' +); +$phar->buildFromDirectory(dirname(__DIR__).'/lib'); +rename( + dirname(__DIR__).'/lib/index.php', + dirname(__DIR__).'/lib/random.php' +); + +/** + * If we pass an (optional) path to a private key as a second argument, we will + * sign the Phar with OpenSSL. + * + * If you leave this out, it will produce an unsigned .phar! + */ +if ($argc > 1) { + if (!@is_readable($argv[1])) { + echo 'Could not read the private key file:', $argv[1], "\n"; + exit(255); + } + $pkeyFile = file_get_contents($argv[1]); + + $private = openssl_get_privatekey($pkeyFile); + if ($private !== false) { + $pkey = ''; + openssl_pkey_export($private, $pkey); + $phar->setSignatureAlgorithm(Phar::OPENSSL, $pkey); + + /** + * Save the corresponding public key to the file + */ + if (!@is_readable($dist.'/random_compat.phar.pubkey')) { + $details = openssl_pkey_get_details($private); + file_put_contents( + $dist.'/random_compat.phar.pubkey', + $details['key'] + ); + } + } else { + echo 'An error occurred reading the private key from OpenSSL.', "\n"; + exit(255); + } +} diff --git a/vendor/paragonie/random_compat/psalm-autoload.php b/vendor/paragonie/random_compat/psalm-autoload.php new file mode 100644 index 00000000..d71d1b81 --- /dev/null +++ b/vendor/paragonie/random_compat/psalm-autoload.php @@ -0,0 +1,9 @@ +<?php + +require_once 'lib/byte_safe_strings.php'; +require_once 'lib/cast_to_int.php'; +require_once 'lib/error_polyfill.php'; +require_once 'other/ide_stubs/libsodium.php'; +require_once 'lib/random.php'; + +$int = random_int(0, 65536); diff --git a/vendor/paragonie/random_compat/psalm.xml b/vendor/paragonie/random_compat/psalm.xml new file mode 100644 index 00000000..1e914098 --- /dev/null +++ b/vendor/paragonie/random_compat/psalm.xml @@ -0,0 +1,16 @@ +<?xml version="1.0"?> +<psalm + autoloader="psalm-autoload.php" + stopOnFirstError="false" + useDocblockTypes="true" +> + <projectFiles> + <directory name="lib" /> + </projectFiles> + <issueHandlers> + <DuplicateClass errorLevel="info" /> + <InvalidOperand errorLevel="info" /> + <UndefinedConstant errorLevel="info" /> + <MissingReturnType errorLevel="info" /> + </issueHandlers> +</psalm> diff --git a/vendor/pimple/pimple/CHANGELOG b/vendor/pimple/pimple/CHANGELOG index f277b969..ba56760c 100644 --- a/vendor/pimple/pimple/CHANGELOG +++ b/vendor/pimple/pimple/CHANGELOG @@ -1,3 +1,7 @@ +* 3.2.3 (2017-XX-XX) + + * n/a + * 3.2.2 (2017-07-23) * reverted extending a protected closure throws an exception (deprecated it instead) diff --git a/vendor/pimple/pimple/README.rst b/vendor/pimple/pimple/README.rst index d27d8aa3..a03b6d3a 100644 --- a/vendor/pimple/pimple/README.rst +++ b/vendor/pimple/pimple/README.rst @@ -108,7 +108,7 @@ If you change the ``session_storage`` service definition like below: }; You can now easily change the cookie name by overriding the -``session_storage_class`` parameter instead of redefining the service +``cookie_name`` parameter instead of redefining the service definition. Protecting Parameters diff --git a/vendor/pimple/pimple/ext/pimple/php_pimple.h b/vendor/pimple/pimple/ext/pimple/php_pimple.h index 258f3eea..eed7c173 100644 --- a/vendor/pimple/pimple/ext/pimple/php_pimple.h +++ b/vendor/pimple/pimple/ext/pimple/php_pimple.h @@ -41,7 +41,7 @@ extern zend_module_entry pimple_module_entry; #include "TSRM.h" #endif -#define PIMPLE_VERSION "3.2.2-DEV" +#define PIMPLE_VERSION "3.2.3-DEV" #define PIMPLE_NS "Pimple" #define PSR_CONTAINER_NS "Psr\\Container" diff --git a/vendor/pimple/pimple/src/Pimple/Container.php b/vendor/pimple/pimple/src/Pimple/Container.php index e761964b..707b92b8 100644 --- a/vendor/pimple/pimple/src/Pimple/Container.php +++ b/vendor/pimple/pimple/src/Pimple/Container.php @@ -103,9 +103,9 @@ class Container implements \ArrayAccess if ( isset($this->raw[$id]) - || !is_object($this->values[$id]) + || !\is_object($this->values[$id]) || isset($this->protected[$this->values[$id]]) - || !method_exists($this->values[$id], '__invoke') + || !\method_exists($this->values[$id], '__invoke') ) { return $this->values[$id]; } @@ -143,7 +143,7 @@ class Container implements \ArrayAccess public function offsetUnset($id) { if (isset($this->keys[$id])) { - if (is_object($this->values[$id])) { + if (\is_object($this->values[$id])) { unset($this->factories[$this->values[$id]], $this->protected[$this->values[$id]]); } @@ -162,7 +162,7 @@ class Container implements \ArrayAccess */ public function factory($callable) { - if (!method_exists($callable, '__invoke')) { + if (!\method_exists($callable, '__invoke')) { throw new ExpectedInvokableException('Service definition is not a Closure or invokable object.'); } @@ -184,7 +184,7 @@ class Container implements \ArrayAccess */ public function protect($callable) { - if (!method_exists($callable, '__invoke')) { + if (!\method_exists($callable, '__invoke')) { throw new ExpectedInvokableException('Callable is not a Closure or invokable object.'); } @@ -241,15 +241,15 @@ class Container implements \ArrayAccess throw new FrozenServiceException($id); } - if (!is_object($this->values[$id]) || !method_exists($this->values[$id], '__invoke')) { + if (!\is_object($this->values[$id]) || !\method_exists($this->values[$id], '__invoke')) { throw new InvalidServiceIdentifierException($id); } if (isset($this->protected[$this->values[$id]])) { - @trigger_error(sprintf('How Pimple behaves when extending protected closures will be fixed in Pimple 4. Are you sure "%s" should be protected?', $id), E_USER_DEPRECATED); + @\trigger_error(\sprintf('How Pimple behaves when extending protected closures will be fixed in Pimple 4. Are you sure "%s" should be protected?', $id), \E_USER_DEPRECATED); } - if (!is_object($callable) || !method_exists($callable, '__invoke')) { + if (!\is_object($callable) || !\method_exists($callable, '__invoke')) { throw new ExpectedInvokableException('Extension service definition is not a Closure or invokable object.'); } @@ -274,7 +274,7 @@ class Container implements \ArrayAccess */ public function keys() { - return array_keys($this->values); + return \array_keys($this->values); } /** diff --git a/vendor/pimple/pimple/src/Pimple/Exception/FrozenServiceException.php b/vendor/pimple/pimple/src/Pimple/Exception/FrozenServiceException.php index 64b02659..e4d2f6d3 100644 --- a/vendor/pimple/pimple/src/Pimple/Exception/FrozenServiceException.php +++ b/vendor/pimple/pimple/src/Pimple/Exception/FrozenServiceException.php @@ -40,6 +40,6 @@ class FrozenServiceException extends \RuntimeException implements ContainerExcep */ public function __construct($id) { - parent::__construct(sprintf('Cannot override frozen service "%s".', $id)); + parent::__construct(\sprintf('Cannot override frozen service "%s".', $id)); } } diff --git a/vendor/pimple/pimple/src/Pimple/Exception/InvalidServiceIdentifierException.php b/vendor/pimple/pimple/src/Pimple/Exception/InvalidServiceIdentifierException.php index 9df9c663..91e82f98 100644 --- a/vendor/pimple/pimple/src/Pimple/Exception/InvalidServiceIdentifierException.php +++ b/vendor/pimple/pimple/src/Pimple/Exception/InvalidServiceIdentifierException.php @@ -40,6 +40,6 @@ class InvalidServiceIdentifierException extends \InvalidArgumentException implem */ public function __construct($id) { - parent::__construct(sprintf('Identifier "%s" does not contain an object definition.', $id)); + parent::__construct(\sprintf('Identifier "%s" does not contain an object definition.', $id)); } } diff --git a/vendor/pimple/pimple/src/Pimple/Exception/UnknownIdentifierException.php b/vendor/pimple/pimple/src/Pimple/Exception/UnknownIdentifierException.php index 28413189..fb6b626e 100644 --- a/vendor/pimple/pimple/src/Pimple/Exception/UnknownIdentifierException.php +++ b/vendor/pimple/pimple/src/Pimple/Exception/UnknownIdentifierException.php @@ -40,6 +40,6 @@ class UnknownIdentifierException extends \InvalidArgumentException implements No */ public function __construct($id) { - parent::__construct(sprintf('Identifier "%s" is not defined.', $id)); + parent::__construct(\sprintf('Identifier "%s" is not defined.', $id)); } } diff --git a/vendor/pimple/pimple/src/Pimple/Psr11/ServiceLocator.php b/vendor/pimple/pimple/src/Pimple/Psr11/ServiceLocator.php index 61e49848..3361c6f1 100644 --- a/vendor/pimple/pimple/src/Pimple/Psr11/ServiceLocator.php +++ b/vendor/pimple/pimple/src/Pimple/Psr11/ServiceLocator.php @@ -49,7 +49,7 @@ class ServiceLocator implements ContainerInterface $this->container = $container; foreach ($ids as $key => $id) { - $this->aliases[is_int($key) ? $id : $key] = $id; + $this->aliases[\is_int($key) ? $id : $key] = $id; } } diff --git a/vendor/pimple/pimple/src/Pimple/ServiceIterator.php b/vendor/pimple/pimple/src/Pimple/ServiceIterator.php index 744271dd..5cde5188 100644 --- a/vendor/pimple/pimple/src/Pimple/ServiceIterator.php +++ b/vendor/pimple/pimple/src/Pimple/ServiceIterator.php @@ -44,26 +44,26 @@ final class ServiceIterator implements \Iterator public function rewind() { - reset($this->ids); + \reset($this->ids); } public function current() { - return $this->container[current($this->ids)]; + return $this->container[\current($this->ids)]; } public function key() { - return current($this->ids); + return \current($this->ids); } public function next() { - next($this->ids); + \next($this->ids); } public function valid() { - return null !== key($this->ids); + return null !== \key($this->ids); } } diff --git a/vendor/silex/silex/.php_cs.dist b/vendor/silex/silex/.php_cs.dist new file mode 100644 index 00000000..b82c8aed --- /dev/null +++ b/vendor/silex/silex/.php_cs.dist @@ -0,0 +1,19 @@ +<?php + +return PhpCsFixer\Config::create() + ->setRules(array( + '@Symfony' => true, + '@Symfony:risky' => true, + '@PHPUnit48Migration:risky' => true, + 'php_unit_no_expectation_annotation' => false, // part of `PHPUnitXYMigration:risky` ruleset, to be enabled when PHPUnit 4.x support will be dropped, as we don't want to rewrite exceptions handling twice + 'array_syntax' => array('syntax' => 'short'), + 'protected_to_private' => false, + )) + ->setRiskyAllowed(true) + ->setFinder( + PhpCsFixer\Finder::create() + ->in(__DIR__.'/src/') + ->in(__DIR__.'/tests/') + ->name('*.php') + ) +; diff --git a/vendor/silex/silex/.travis.yml b/vendor/silex/silex/.travis.yml index a2b7fe8c..73463e54 100644 --- a/vendor/silex/silex/.travis.yml +++ b/vendor/silex/silex/.travis.yml @@ -5,36 +5,39 @@ sudo: false env: global: - SYMFONY_DEPRECATIONS_HELPER=weak + - SYMFONY_PHPUNIT_DIR=$HOME/.symfony-phpunit cache: directories: - $HOME/.composer/cache/files - - .phpunit + - $HOME/.symfony-phpunit before_install: - - if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then phpenv config-rm xdebug.ini; fi + - phpenv config-rm xdebug.ini -before_script: # Twig 1.x - if [[ $TWIG_VERSION != 2.0 ]]; then sed -i 's/~1.8|~2.0/~1.8/g' composer.json; fi # Symfony 2.8 - - if [[ $SYMFONY_DEPS_VERSION = 2.8 ]]; then sed -i 's/~2\.8|^3\.0/2.8.*@dev/g' composer.json; fi - # Symfony 3.0 - - if [[ $SYMFONY_DEPS_VERSION = 3.0 ]]; then sed -i 's/~2\.8|^3\.0/3.0.*@dev/g' composer.json; fi - # Symfony 3.1 - - if [[ $SYMFONY_DEPS_VERSION = 3.1 ]]; then sed -i 's/~2\.8|^3\.0/3.1.*@dev/g' composer.json; fi - # Symfony 3.2 - - if [[ $SYMFONY_DEPS_VERSION = 3.2 ]]; then sed -i 's/~2\.8|^3\.0/3.2.*@dev/g' composer.json; fi + - if [[ $SYMFONY_DEPS_VERSION = 2.8 ]]; then sed -i 's/~2\.8|^3\.0/2.8.*/g' composer.json; fi # Symfony 3.3 - | if [[ $SYMFONY_DEPS_VERSION = 3.3 ]]; then - sed -i 's/~2\.8|^3\.0/3.3.*@dev/g' composer.json; - composer require --dev --no-update symfony/web-link:3.3.* + sed -i 's/~2\.8|^3\.0/3.3.*/g' composer.json; + composer require --no-update symfony/web-link:3.3.* + fi + # Symfony 3.4 + - | + if [[ $SYMFONY_DEPS_VERSION = 3.4 ]]; then + sed -i 's/~2\.8|^3\.0/3.4.*/g' composer.json; + composer require --no-update symfony/web-link:3.4.* fi - composer update --no-suggest +install: + - ./vendor/bin/simple-phpunit install + script: ./vendor/bin/simple-phpunit matrix: @@ -44,16 +47,11 @@ matrix: env: TWIG_VERSION=2.0 - php: 5.6 env: SYMFONY_DEPS_VERSION=2.8 - - php: 5.6 - env: SYMFONY_DEPS_VERSION=3.0 - - php: 5.6 - env: SYMFONY_DEPS_VERSION=3.1 - - php: 5.6 - env: SYMFONY_DEPS_VERSION=3.2 - php: 5.6 env: SYMFONY_DEPS_VERSION=3.3 + - php: 5.6 + env: SYMFONY_DEPS_VERSION=3.4 - php: 5.6 - php: 7.0 - php: 7.1 - - php: hhvm - dist: trusty + - php: 7.2 diff --git a/vendor/silex/silex/README.rst b/vendor/silex/silex/README.rst index b79e47b6..e7138a76 100644 --- a/vendor/silex/silex/README.rst +++ b/vendor/silex/silex/README.rst @@ -1,6 +1,11 @@ Silex, a simple Web Framework ============================= +**WARNING**: Silex is in maintenance mode only. Ends of life is set to June +2018. Read more on `Symfony's blog <http://symfony.com/blog/the-end-of-silex>`_. +But Silex can be saved! Any **help** to keep Silex alive is greatly appreciated. +See `#1593 <https://github.com/silexphp/Silex/issues/1593>`_. + Silex is a PHP micro-framework to develop websites based on `Symfony components`_: diff --git a/vendor/silex/silex/composer.json b/vendor/silex/silex/composer.json index 935c5181..d7c52c69 100644 --- a/vendor/silex/silex/composer.json +++ b/vendor/silex/silex/composer.json @@ -67,6 +67,5 @@ "branch-alias": { "dev-master": "2.2.x-dev" } - }, - "minimum-stability": "dev" + } } diff --git a/vendor/silex/silex/doc/changelog.rst b/vendor/silex/silex/doc/changelog.rst index a2917561..99bb079b 100644 --- a/vendor/silex/silex/doc/changelog.rst +++ b/vendor/silex/silex/doc/changelog.rst @@ -1,6 +1,23 @@ Changelog ========= +2.2.3 (2018-02-25) +------------------ + + * fixed validator integration into the security provider (order of registration of the validator and security providers does not matter anymore) + * fixed compatibility issues with Symfony 3.4 + +2.2.2 (2018-01-12) +------------------ + +* [SECURITY] fixed before handlers not executed under mounts + +2.2.1 (2017-12-14) +------------------ + +* added support for Swiftmailer SSL stream_context_options option +* fixed usage of namespaces for Twig paths + 2.2.0 (2017-07-23) ------------------ diff --git a/vendor/silex/silex/doc/cookbook/guard_authentication.rst b/vendor/silex/silex/doc/cookbook/guard_authentication.rst index 8774f686..d57d1454 100644 --- a/vendor/silex/silex/doc/cookbook/guard_authentication.rst +++ b/vendor/silex/silex/doc/cookbook/guard_authentication.rst @@ -34,6 +34,7 @@ AbstractGuardAuthenticator. This requires you to implement six methods: use Symfony\Component\Security\Guard\AbstractGuardAuthenticator; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Exception\AuthenticationException; + use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface; class TokenAuthenticator extends AbstractGuardAuthenticator { diff --git a/vendor/silex/silex/doc/cookbook/session_storage.rst b/vendor/silex/silex/doc/cookbook/session_storage.rst index 29328b49..8c439366 100644 --- a/vendor/silex/silex/doc/cookbook/session_storage.rst +++ b/vendor/silex/silex/doc/cookbook/session_storage.rst @@ -28,10 +28,10 @@ With a dedicated PDO service $app['pdo.password'] = 'mypassword'; $app['session.db_options'] = array( - 'db_table' => 'session', - 'db_id_col' => 'session_id', - 'db_data_col' => 'session_value', - 'db_time_col' => 'session_time', + 'db_table' => 'session', + 'db_id_col' => 'session_id', + 'db_data_col' => 'session_value', + 'db_time_col' => 'session_time', ); $app['pdo'] = function () use ($app) { diff --git a/vendor/silex/silex/doc/organizing_controllers.rst b/vendor/silex/silex/doc/organizing_controllers.rst index 50558cbb..89fc6867 100644 --- a/vendor/silex/silex/doc/organizing_controllers.rst +++ b/vendor/silex/silex/doc/organizing_controllers.rst @@ -25,7 +25,7 @@ group them logically:: $app->mount('/blog', $blog); $app->mount('/forum', $forum); - // define controllers for a admin + // define controllers for an admin $app->mount('/admin', function ($admin) { // recursively mount $admin->mount('/blog', function ($user) { diff --git a/vendor/silex/silex/doc/providers/asset.rst b/vendor/silex/silex/doc/providers/asset.rst index 72c3d703..bd5ec652 100644 --- a/vendor/silex/silex/doc/providers/asset.rst +++ b/vendor/silex/silex/doc/providers/asset.rst @@ -12,6 +12,8 @@ Parameters * **assets.format_version** (optional): Default format for assets. +* **assets.base_path**: Default path to prepend to all assets without a package. + * **assets.named_packages** (optional): Named packages. Keys are the package names and values the configuration (supported keys are ``version``, ``version_format``, ``base_urls``, and ``base_path``). @@ -53,7 +55,11 @@ Registering Usage ----- -The AssetServiceProvider is mostly useful with the Twig provider: +The AssetServiceProvider is mostly useful with the Twig provider using the +``asset()`` method. It takes two arguments. In the case of named +packages, the first is the path relative to the base_path specified in the +package definition and the second is the package name. For unmamed packages, +there is only one argument, the path relative to the assets folder: .. code-block:: jinja diff --git a/vendor/silex/silex/doc/providers/index.rst b/vendor/silex/silex/doc/providers/index.rst index 8c5a1754..8989d494 100644 --- a/vendor/silex/silex/doc/providers/index.rst +++ b/vendor/silex/silex/doc/providers/index.rst @@ -22,3 +22,4 @@ Built-in Service Providers service_controller var_dumper doctrine + routing diff --git a/vendor/silex/silex/doc/providers/routing.rst b/vendor/silex/silex/doc/providers/routing.rst new file mode 100644 index 00000000..afa61c96 --- /dev/null +++ b/vendor/silex/silex/doc/providers/routing.rst @@ -0,0 +1,79 @@ +Routing +======= + +The *RoutingServiceProvider* provides a service for generating URLs for +named routes. + +Parameters +---------- + +None. + +Services +-------- + +* **url_generator**: An instance of `UrlGenerator + <http://api.symfony.com/master/Symfony/Component/Routing/Generator/UrlGenerator.html>`_, + using the `RouteCollection + <http://api.symfony.com/master/Symfony/Component/Routing/RouteCollection.html>`_ + that is provided through the ``routes`` service. It has a ``generate`` + method, which takes the route name as an argument, followed by an array of + route parameters. + +Registering +----------- + +.. code-block:: php + + $app->register(new Silex\Provider\RoutingServiceProvider()); + +Usage +----- + +The Routing provider provides a ``url_generator`` service:: + + $app->get('/', function () { + return 'welcome to the homepage'; + }) + ->bind('homepage'); + + $app->get('/hello/{name}', function ($name) { + return "Hello $name!"; + }) + ->bind('hello'); + + $app->get('/navigation', function () use ($app) { + return '<a href="'.$app['url_generator']->generate('homepage').'">Home</a>'. + ' | '. + '<a href="'.$app['url_generator']->generate('hello', array('name' => 'Igor')).'">Hello Igor</a>'; + }); + +When using Twig, the service can be used like this: + +.. code-block:: jinja + + {{ app.url_generator.generate('homepage') }} + +Moreover, if you have ``twig-bridge`` as a Composer dep, you will have access +to the ``path()`` and ``url()`` functions: + +.. code-block:: jinja + + {{ path('homepage') }} + {{ url('homepage') }} {# generates the absolute url http://example.org/ #} + {{ path('hello', {name: 'Fabien'}) }} + {{ url('hello', {name: 'Fabien'}) }} {# generates the absolute url http://example.org/hello/Fabien #} + +Traits +------ + +``Silex\Application\UrlGeneratorTrait`` adds the following shortcuts: + +* **path**: Generates a path. + +* **url**: Generates an absolute URL. + +.. code-block:: php + + $app->path('homepage'); + $app->url('homepage'); diff --git a/vendor/silex/silex/doc/providers/security.rst b/vendor/silex/silex/doc/providers/security.rst index 49da8172..6a6f1516 100644 --- a/vendor/silex/silex/doc/providers/security.rst +++ b/vendor/silex/silex/doc/providers/security.rst @@ -146,7 +146,7 @@ instance of a `RequestMatcher <http://api.symfony.com/master/Symfony/Component/HttpFoundation/RequestMatcher.html>`_ for the ``pattern`` option:: - use Symfony/Component/HttpFoundation/RequestMatcher; + use Symfony\Component\HttpFoundation\RequestMatcher; $app['security.firewalls'] = array( 'admin' => array( @@ -420,6 +420,38 @@ switch back to their primary account: You are an admin but you've switched to another user, <a href="?_switch_user=_exit"> exit</a> the switch. {% endif %} + +Sharing security context between multiple firewalls +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +By default, all the firewalls have a different **security context**. In case you +need to share the same security context between multiple firewalls you can set +the ``context`` setting for each firewall you want the context to be shared +with. + + $app['security.firewalls'] = array( + 'login' => array( + 'context' => 'admin_security', + 'pattern' => '^/login', + // ... + ), + 'secured' => array( + 'context' => 'admin_security', + 'pattern' => '^/admin/', + 'form' => array('login_path' => '/login', 'check_path' => '/admin/login_check'), + 'users' => array( + 'admin' => array('ROLE_ADMIN', '$2y$10$3i9/lVd8UOFIJ6PAMFt8gu3/r5g0qeCJvoSlLCsvMTythye19F77a'), + ), + // ... + ), + ); + +Above configuration ensures that you have the same security context +``admin_security`` inside both, ``login`` and ``admin`` firewalls. This might be +useful for instance to redirect already logged in users to the secured area of +your website when they visit the login form, as you have the possibility to +check if the user has been granted the ``ROLE_ADMIN`` role inside the ``login`` +firewall. Defining a Role Hierarchy ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -594,10 +626,10 @@ Defining a custom Authentication Provider ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The Symfony Security component provides a lot of ready-to-use authentication -providers (form, HTTP, X509, remember me, ...), but you can add new ones -easily. To register a new authentication provider, create a service named -``security.authentication_listener.factory.XXX`` where ``XXX`` is the name you want to -use in your configuration:: +providers (form, HTTP, X509, remember me, ...), but you can add new ones easily. +To register a new authentication provider, create a service named +``security.authentication_listener.factory.XXX`` where ``XXX`` is the name you +want to use in your configuration:: $app['security.authentication_listener.factory.wsse'] = $app->protect(function ($name, $options) use ($app) { // define the authentication provider object diff --git a/vendor/silex/silex/doc/providers/twig.rst b/vendor/silex/silex/doc/providers/twig.rst index b713e1a3..56a2b502 100644 --- a/vendor/silex/silex/doc/providers/twig.rst +++ b/vendor/silex/silex/doc/providers/twig.rst @@ -164,6 +164,9 @@ It gives access to the following methods: {# The debug flag #} {{ global.debug }} + {# The flash messages (Symfony 3.3 or later) #} + {{ global.flashes }} + Rendering a Controller ~~~~~~~~~~~~~~~~~~~~~~ diff --git a/vendor/silex/silex/doc/services.rst b/vendor/silex/silex/doc/services.rst index 0b34ad35..c9545145 100644 --- a/vendor/silex/silex/doc/services.rst +++ b/vendor/silex/silex/doc/services.rst @@ -166,6 +166,31 @@ However, you can inject it via `use($app)`:: // ... }); +Modify services after definition +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Sometimes you want to alter a service after its definition. Pimple facilitates +this by extending the already defined service. + +First argument of the ``extend`` method is the name of the service you want to +modify. Second argument is a callable. This callable is executed with the service +you want to alter as its first argument, the service container itself is provided +in the second argument. + +.. note:: + + Be sure to return the modified service in the callable. + +You can use this pattern to add functionality to :doc:Twig <providers/twig> for +example:: + + $app->extend('twig', function($twig, $app) { + $twig->addGlobal('pi', 3.14); + $twig->addFilter('levenshtein', new \Twig_Filter_Function('levenshtein')); + + return $twig; + }); + Core services ------------- diff --git a/vendor/silex/silex/doc/web_servers.rst b/vendor/silex/silex/doc/web_servers.rst index c3d43aa6..18f5531d 100644 --- a/vendor/silex/silex/doc/web_servers.rst +++ b/vendor/silex/silex/doc/web_servers.rst @@ -44,10 +44,11 @@ Or if you're using a VirtualHost, you can add the same directive to the VirtualH <VirtualHost *:80> # other directives - <Directory /var/www/domain.com/> + Alias /app/ /path/to/app/ + <Directory /path/to/app> # other directives - FallbackResource /index.php + FallbackResource /app/index.php </Directory> </VirtualHost> diff --git a/vendor/silex/silex/src/Silex/AppArgumentValueResolver.php b/vendor/silex/silex/src/Silex/AppArgumentValueResolver.php index cc2197ab..e96b2621 100644 --- a/vendor/silex/silex/src/Silex/AppArgumentValueResolver.php +++ b/vendor/silex/silex/src/Silex/AppArgumentValueResolver.php @@ -34,7 +34,7 @@ class AppArgumentValueResolver implements ArgumentValueResolverInterface */ public function supports(Request $request, ArgumentMetadata $argument) { - return null !== $argument->getType() && ($argument->getType() === Application::class || is_subclass_of($argument->getType(), Application::class)); + return null !== $argument->getType() && (Application::class === $argument->getType() || is_subclass_of($argument->getType(), Application::class)); } /** diff --git a/vendor/silex/silex/src/Silex/Application.php b/vendor/silex/silex/src/Silex/Application.php index c3b751ba..ee206d30 100644 --- a/vendor/silex/silex/src/Silex/Application.php +++ b/vendor/silex/silex/src/Silex/Application.php @@ -41,12 +41,12 @@ use Silex\Provider\HttpKernelServiceProvider; */ class Application extends Container implements HttpKernelInterface, TerminableInterface { - const VERSION = '2.2.0-DEV'; + const VERSION = '2.2.3'; const EARLY_EVENT = 512; const LATE_EVENT = -512; - protected $providers = array(); + protected $providers = []; protected $booted = false; /** @@ -54,9 +54,9 @@ class Application extends Container implements HttpKernelInterface, TerminableIn * * Objects and parameters can be passed as argument to the constructor. * - * @param array $values The parameters or objects. + * @param array $values the parameters or objects */ - public function __construct(array $values = array()) + public function __construct(array $values = []) { parent::__construct(); @@ -83,7 +83,7 @@ class Application extends Container implements HttpKernelInterface, TerminableIn * * @return Application */ - public function register(ServiceProviderInterface $provider, array $values = array()) + public function register(ServiceProviderInterface $provider, array $values = []) { $this->providers[] = $provider; @@ -311,7 +311,7 @@ class Application extends Container implements HttpKernelInterface, TerminableIn * @param string $message The status message * @param array $headers An array of HTTP headers */ - public function abort($statusCode, $message = '', array $headers = array()) + public function abort($statusCode, $message = '', array $headers = []) { throw new HttpException($statusCode, $message, null, $headers); } @@ -385,7 +385,7 @@ class Application extends Container implements HttpKernelInterface, TerminableIn * * @return StreamedResponse */ - public function stream($callback = null, $status = 200, array $headers = array()) + public function stream($callback = null, $status = 200, array $headers = []) { return new StreamedResponse($callback, $status, $headers); } @@ -414,7 +414,7 @@ class Application extends Container implements HttpKernelInterface, TerminableIn * * @return JsonResponse */ - public function json($data = array(), $status = 200, array $headers = array()) + public function json($data = [], $status = 200, array $headers = []) { return new JsonResponse($data, $status, $headers); } @@ -429,7 +429,7 @@ class Application extends Container implements HttpKernelInterface, TerminableIn * * @return BinaryFileResponse */ - public function sendFile($file, $status = 200, array $headers = array(), $contentDisposition = null) + public function sendFile($file, $status = 200, array $headers = [], $contentDisposition = null) { return new BinaryFileResponse($file, $status, $headers, true, $contentDisposition); } diff --git a/vendor/silex/silex/src/Silex/Application/FormTrait.php b/vendor/silex/silex/src/Silex/Application/FormTrait.php index 2eeb23e4..f55775cb 100644 --- a/vendor/silex/silex/src/Silex/Application/FormTrait.php +++ b/vendor/silex/silex/src/Silex/Application/FormTrait.php @@ -11,10 +11,9 @@ namespace Silex\Application; -use Symfony\Component\Form; use Symfony\Component\Form\Extension\Core\Type\FormType; use Symfony\Component\Form\FormBuilder; -use Symfony\Component\OptionsResolver\OptionsResolver\FormTypeInterface; +use Symfony\Component\Form\FormTypeInterface; /** * Form trait. @@ -33,7 +32,7 @@ trait FormTrait * * @return FormBuilder */ - public function form($data = null, array $options = array(), $type = null) + public function form($data = null, array $options = [], $type = null) { return $this['form.factory']->createBuilder($type ?: FormType::class, $data, $options); } @@ -48,7 +47,7 @@ trait FormTrait * * @return FormBuilder */ - public function namedForm($name, $data = null, array $options = array(), $type = null) + public function namedForm($name, $data = null, array $options = [], $type = null) { return $this['form.factory']->createNamedBuilder($name, $type ?: FormType::class, $data, $options); } diff --git a/vendor/silex/silex/src/Silex/Application/MonologTrait.php b/vendor/silex/silex/src/Silex/Application/MonologTrait.php index 18cb54c6..056318f9 100644 --- a/vendor/silex/silex/src/Silex/Application/MonologTrait.php +++ b/vendor/silex/silex/src/Silex/Application/MonologTrait.php @@ -29,7 +29,7 @@ trait MonologTrait * * @return bool Whether the record has been processed */ - public function log($message, array $context = array(), $level = Logger::INFO) + public function log($message, array $context = [], $level = Logger::INFO) { return $this['monolog']->addRecord($level, $message, $context); } diff --git a/vendor/silex/silex/src/Silex/Application/SecurityTrait.php b/vendor/silex/silex/src/Silex/Application/SecurityTrait.php index 43ce5552..e461296b 100644 --- a/vendor/silex/silex/src/Silex/Application/SecurityTrait.php +++ b/vendor/silex/silex/src/Silex/Application/SecurityTrait.php @@ -44,7 +44,7 @@ trait SecurityTrait * * @return bool * - * @throws AuthenticationCredentialsNotFoundException when the token storage has no authentication token. + * @throws AuthenticationCredentialsNotFoundException when the token storage has no authentication token */ public function isGranted($attributes, $object = null) { diff --git a/vendor/silex/silex/src/Silex/Application/TranslationTrait.php b/vendor/silex/silex/src/Silex/Application/TranslationTrait.php index 8b6e818e..ad5a4f03 100644 --- a/vendor/silex/silex/src/Silex/Application/TranslationTrait.php +++ b/vendor/silex/silex/src/Silex/Application/TranslationTrait.php @@ -28,7 +28,7 @@ trait TranslationTrait * * @return string The translated string */ - public function trans($id, array $parameters = array(), $domain = 'messages', $locale = null) + public function trans($id, array $parameters = [], $domain = 'messages', $locale = null) { return $this['translator']->trans($id, $parameters, $domain, $locale); } @@ -44,7 +44,7 @@ trait TranslationTrait * * @return string The translated string */ - public function transChoice($id, $number, array $parameters = array(), $domain = 'messages', $locale = null) + public function transChoice($id, $number, array $parameters = [], $domain = 'messages', $locale = null) { return $this['translator']->transChoice($id, $number, $parameters, $domain, $locale); } diff --git a/vendor/silex/silex/src/Silex/Application/TwigTrait.php b/vendor/silex/silex/src/Silex/Application/TwigTrait.php index cb4127d7..d27bbafa 100644 --- a/vendor/silex/silex/src/Silex/Application/TwigTrait.php +++ b/vendor/silex/silex/src/Silex/Application/TwigTrait.php @@ -32,7 +32,7 @@ trait TwigTrait * * @return Response A Response instance */ - public function render($view, array $parameters = array(), Response $response = null) + public function render($view, array $parameters = [], Response $response = null) { $twig = $this['twig']; @@ -58,7 +58,7 @@ trait TwigTrait * * @return string The rendered view */ - public function renderView($view, array $parameters = array()) + public function renderView($view, array $parameters = []) { return $this['twig']->render($view, $parameters); } diff --git a/vendor/silex/silex/src/Silex/Application/UrlGeneratorTrait.php b/vendor/silex/silex/src/Silex/Application/UrlGeneratorTrait.php index 7ccdf8ac..6eaeb4f6 100644 --- a/vendor/silex/silex/src/Silex/Application/UrlGeneratorTrait.php +++ b/vendor/silex/silex/src/Silex/Application/UrlGeneratorTrait.php @@ -28,7 +28,7 @@ trait UrlGeneratorTrait * * @return string The generated path */ - public function path($route, $parameters = array()) + public function path($route, $parameters = []) { return $this['url_generator']->generate($route, $parameters, UrlGeneratorInterface::ABSOLUTE_PATH); } @@ -41,7 +41,7 @@ trait UrlGeneratorTrait * * @return string The generated URL */ - public function url($route, $parameters = array()) + public function url($route, $parameters = []) { return $this['url_generator']->generate($route, $parameters, UrlGeneratorInterface::ABSOLUTE_URL); } diff --git a/vendor/silex/silex/src/Silex/CallbackResolver.php b/vendor/silex/silex/src/Silex/CallbackResolver.php index 692901c2..ac8730cb 100644 --- a/vendor/silex/silex/src/Silex/CallbackResolver.php +++ b/vendor/silex/silex/src/Silex/CallbackResolver.php @@ -43,13 +43,13 @@ class CallbackResolver * * @return callable * - * @throws \InvalidArgumentException In case the method does not exist. + * @throws \InvalidArgumentException in case the method does not exist */ public function convertCallback($name) { if (preg_match(static::SERVICE_PATTERN, $name)) { list($service, $method) = explode(':', $name, 2); - $callback = array($this->app[$service], $method); + $callback = [$this->app[$service], $method]; } else { $service = $name; $callback = $this->app[$name]; @@ -69,7 +69,7 @@ class CallbackResolver * * @return string|callable A callable value or the string passed in * - * @throws \InvalidArgumentException In case the method does not exist. + * @throws \InvalidArgumentException in case the method does not exist */ public function resolveCallback($name) { diff --git a/vendor/silex/silex/src/Silex/Controller.php b/vendor/silex/silex/src/Silex/Controller.php index 9a807559..c2cf3009 100644 --- a/vendor/silex/silex/src/Silex/Controller.php +++ b/vendor/silex/silex/src/Silex/Controller.php @@ -91,7 +91,7 @@ class Controller throw new \BadMethodCallException(sprintf('Method "%s::%s" does not exist.', get_class($this->route), $method)); } - call_user_func_array(array($this->route, $method), $arguments); + call_user_func_array([$this->route, $method], $arguments); return $this; } @@ -111,7 +111,7 @@ class Controller $methods = implode('_', $this->route->getMethods()).'_'; $routeName = $methods.$prefix.$this->route->getPath(); - $routeName = str_replace(array('/', ':', '|', '-'), '_', $routeName); + $routeName = str_replace(['/', ':', '|', '-'], '_', $routeName); $routeName = preg_replace('/[^a-z0-9A-Z_.]+/', '', $routeName); // Collapse consecutive underscores down into a single underscore. diff --git a/vendor/silex/silex/src/Silex/ControllerCollection.php b/vendor/silex/silex/src/Silex/ControllerCollection.php index 40368964..728a655c 100644 --- a/vendor/silex/silex/src/Silex/ControllerCollection.php +++ b/vendor/silex/silex/src/Silex/ControllerCollection.php @@ -39,7 +39,7 @@ use Symfony\Component\HttpFoundation\Request; */ class ControllerCollection { - protected $controllers = array(); + protected $controllers = []; protected $defaultRoute; protected $defaultController; protected $prefix; @@ -68,6 +68,7 @@ class ControllerCollection { if (is_callable($controllers)) { $collection = $this->controllersFactory ? call_user_func($this->controllersFactory) : new static(new Route(), new RouteCollection()); + $collection->defaultRoute = clone $this->defaultRoute; call_user_func($controllers, $collection); $controllers = $collection; } elseif (!$controllers instanceof self) { @@ -183,10 +184,10 @@ class ControllerCollection throw new \BadMethodCallException(sprintf('Method "%s::%s" does not exist.', get_class($this->defaultRoute), $method)); } - call_user_func_array(array($this->defaultRoute, $method), $arguments); + call_user_func_array([$this->defaultRoute, $method], $arguments); foreach ($this->controllers as $controller) { - call_user_func_array(array($controller, $method), $arguments); + call_user_func_array([$controller, $method], $arguments); } return $this; @@ -210,7 +211,7 @@ class ControllerCollection private function doFlush($prefix, RouteCollection $routes) { - if ($prefix !== '') { + if ('' !== $prefix) { $prefix = '/'.trim(trim($prefix), '/'); } @@ -232,7 +233,7 @@ class ControllerCollection } } - $this->controllers = array(); + $this->controllers = []; return $routes; } diff --git a/vendor/silex/silex/src/Silex/EventListener/ConverterListener.php b/vendor/silex/silex/src/Silex/EventListener/ConverterListener.php index 2fa93c19..dfb2d5c1 100644 --- a/vendor/silex/silex/src/Silex/EventListener/ConverterListener.php +++ b/vendor/silex/silex/src/Silex/EventListener/ConverterListener.php @@ -59,8 +59,8 @@ class ConverterListener implements EventSubscriberInterface public static function getSubscribedEvents() { - return array( + return [ KernelEvents::CONTROLLER => 'onKernelController', - ); + ]; } } diff --git a/vendor/silex/silex/src/Silex/EventListener/LogListener.php b/vendor/silex/silex/src/Silex/EventListener/LogListener.php index 5f3cc904..39c1b112 100644 --- a/vendor/silex/silex/src/Silex/EventListener/LogListener.php +++ b/vendor/silex/silex/src/Silex/EventListener/LogListener.php @@ -116,19 +116,19 @@ class LogListener implements EventSubscriberInterface */ protected function logException(\Exception $e) { - $this->logger->log(call_user_func($this->exceptionLogFilter, $e), sprintf('%s: %s (uncaught exception) at %s line %s', get_class($e), $e->getMessage(), $e->getFile(), $e->getLine()), array('exception' => $e)); + $this->logger->log(call_user_func($this->exceptionLogFilter, $e), sprintf('%s: %s (uncaught exception) at %s line %s', get_class($e), $e->getMessage(), $e->getFile(), $e->getLine()), ['exception' => $e]); } public static function getSubscribedEvents() { - return array( - KernelEvents::REQUEST => array('onKernelRequest', 0), - KernelEvents::RESPONSE => array('onKernelResponse', 0), + return [ + KernelEvents::REQUEST => ['onKernelRequest', 0], + KernelEvents::RESPONSE => ['onKernelResponse', 0], /* * Priority -4 is used to come after those from SecurityServiceProvider (0) * but before the error handlers added with Silex\Application::error (defaults to -8) */ - KernelEvents::EXCEPTION => array('onKernelException', -4), - ); + KernelEvents::EXCEPTION => ['onKernelException', -4], + ]; } } diff --git a/vendor/silex/silex/src/Silex/EventListener/MiddlewareListener.php b/vendor/silex/silex/src/Silex/EventListener/MiddlewareListener.php index 9b28ff1a..32ab4cb8 100644 --- a/vendor/silex/silex/src/Silex/EventListener/MiddlewareListener.php +++ b/vendor/silex/silex/src/Silex/EventListener/MiddlewareListener.php @@ -87,10 +87,10 @@ class MiddlewareListener implements EventSubscriberInterface public static function getSubscribedEvents() { - return array( + return [ // this must be executed after the late events defined with before() (and their priority is -512) - KernelEvents::REQUEST => array('onKernelRequest', -1024), - KernelEvents::RESPONSE => array('onKernelResponse', 128), - ); + KernelEvents::REQUEST => ['onKernelRequest', -1024], + KernelEvents::RESPONSE => ['onKernelResponse', 128], + ]; } } diff --git a/vendor/silex/silex/src/Silex/EventListener/StringToResponseListener.php b/vendor/silex/silex/src/Silex/EventListener/StringToResponseListener.php index 9fdba5fe..5b93b216 100644 --- a/vendor/silex/silex/src/Silex/EventListener/StringToResponseListener.php +++ b/vendor/silex/silex/src/Silex/EventListener/StringToResponseListener.php @@ -44,8 +44,8 @@ class StringToResponseListener implements EventSubscriberInterface public static function getSubscribedEvents() { - return array( - KernelEvents::VIEW => array('onKernelView', -10), - ); + return [ + KernelEvents::VIEW => ['onKernelView', -10], + ]; } } diff --git a/vendor/silex/silex/src/Silex/ExceptionHandler.php b/vendor/silex/silex/src/Silex/ExceptionHandler.php index 34eb8937..0e2abc28 100644 --- a/vendor/silex/silex/src/Silex/ExceptionHandler.php +++ b/vendor/silex/silex/src/Silex/ExceptionHandler.php @@ -51,6 +51,6 @@ class ExceptionHandler implements EventSubscriberInterface */ public static function getSubscribedEvents() { - return array(KernelEvents::EXCEPTION => array('onSilexError', -255)); + return [KernelEvents::EXCEPTION => ['onSilexError', -255]]; } } diff --git a/vendor/silex/silex/src/Silex/Provider/AssetServiceProvider.php b/vendor/silex/silex/src/Silex/Provider/AssetServiceProvider.php index fa603306..062761c7 100644 --- a/vendor/silex/silex/src/Silex/Provider/AssetServiceProvider.php +++ b/vendor/silex/silex/src/Silex/Provider/AssetServiceProvider.php @@ -32,11 +32,11 @@ class AssetServiceProvider implements ServiceProviderInterface public function register(Container $app) { $app['assets.packages'] = function ($app) { - $packages = array(); + $packages = []; foreach ($app['assets.named_packages'] as $name => $package) { $version = $app['assets.strategy_factory'](isset($package['version']) ? $package['version'] : null, isset($package['version_format']) ? $package['version_format'] : null, isset($package['json_manifest_path']) ? $package['json_manifest_path'] : null, $name); - $packages[$name] = $app['assets.package_factory'](isset($package['base_path']) ? $package['base_path'] : '', isset($package['base_urls']) ? $package['base_urls'] : array(), $version, $name); + $packages[$name] = $app['assets.package_factory'](isset($package['base_path']) ? $package['base_path'] : '', isset($package['base_urls']) ? $package['base_urls'] : [], $version, $name); } return new Packages($app['assets.default_package'], $packages); @@ -53,12 +53,12 @@ class AssetServiceProvider implements ServiceProviderInterface }; $app['assets.base_path'] = ''; - $app['assets.base_urls'] = array(); + $app['assets.base_urls'] = []; $app['assets.version'] = null; $app['assets.version_format'] = null; $app['assets.json_manifest_path'] = null; - $app['assets.named_packages'] = array(); + $app['assets.named_packages'] = []; // prototypes diff --git a/vendor/silex/silex/src/Silex/Provider/DoctrineServiceProvider.php b/vendor/silex/silex/src/Silex/Provider/DoctrineServiceProvider.php index 9c71d5b7..13c15597 100644 --- a/vendor/silex/silex/src/Silex/Provider/DoctrineServiceProvider.php +++ b/vendor/silex/silex/src/Silex/Provider/DoctrineServiceProvider.php @@ -27,13 +27,13 @@ class DoctrineServiceProvider implements ServiceProviderInterface { public function register(Container $app) { - $app['db.default_options'] = array( + $app['db.default_options'] = [ 'driver' => 'pdo_mysql', 'dbname' => null, 'host' => 'localhost', 'user' => 'root', 'password' => null, - ); + ]; $app['dbs.options.initializer'] = $app->protect(function () use ($app) { static $initialized = false; @@ -45,7 +45,7 @@ class DoctrineServiceProvider implements ServiceProviderInterface $initialized = true; if (!isset($app['dbs.options'])) { - $app['dbs.options'] = array('default' => isset($app['db.options']) ? $app['db.options'] : array()); + $app['dbs.options'] = ['default' => isset($app['db.options']) ? $app['db.options'] : []]; } $tmp = $app['dbs.options']; diff --git a/vendor/silex/silex/src/Silex/Provider/FormServiceProvider.php b/vendor/silex/silex/src/Silex/Provider/FormServiceProvider.php index 00841d0b..ccecb7fa 100644 --- a/vendor/silex/silex/src/Silex/Provider/FormServiceProvider.php +++ b/vendor/silex/silex/src/Silex/Provider/FormServiceProvider.php @@ -34,15 +34,15 @@ class FormServiceProvider implements ServiceProviderInterface } $app['form.types'] = function ($app) { - return array(); + return []; }; $app['form.type.extensions'] = function ($app) { - return array(); + return []; }; $app['form.type.guessers'] = function ($app) { - return array(); + return []; }; $app['form.extension.csrf'] = function ($app) { @@ -58,9 +58,9 @@ class FormServiceProvider implements ServiceProviderInterface }; $app['form.extensions'] = function ($app) { - $extensions = array( + $extensions = [ new HttpFoundationExtension(), - ); + ]; if (isset($app['csrf.token_manager'])) { $extensions[] = $app['form.extension.csrf']; diff --git a/vendor/silex/silex/src/Silex/Provider/HttpCacheServiceProvider.php b/vendor/silex/silex/src/Silex/Provider/HttpCacheServiceProvider.php index 8b3f37ee..fc4a9874 100644 --- a/vendor/silex/silex/src/Silex/Provider/HttpCacheServiceProvider.php +++ b/vendor/silex/silex/src/Silex/Provider/HttpCacheServiceProvider.php @@ -31,9 +31,9 @@ class HttpCacheServiceProvider implements ServiceProviderInterface, EventListene { $app['http_cache'] = function ($app) { $app['http_cache.options'] = array_replace( - array( + [ 'debug' => $app['debug'], - ), $app['http_cache.options'] + ], $app['http_cache.options'] ); return new HttpCache($app, $app['http_cache.store'], $app['http_cache.esi'], $app['http_cache.options']); @@ -51,7 +51,7 @@ class HttpCacheServiceProvider implements ServiceProviderInterface, EventListene return new SurrogateListener($app['http_cache.esi']); }; - $app['http_cache.options'] = array(); + $app['http_cache.options'] = []; } public function subscribe(Container $app, EventDispatcherInterface $dispatcher) diff --git a/vendor/silex/silex/src/Silex/Provider/HttpFragmentServiceProvider.php b/vendor/silex/silex/src/Silex/Provider/HttpFragmentServiceProvider.php index fb1f4990..2c951cd0 100644 --- a/vendor/silex/silex/src/Silex/Provider/HttpFragmentServiceProvider.php +++ b/vendor/silex/silex/src/Silex/Provider/HttpFragmentServiceProvider.php @@ -69,7 +69,7 @@ class HttpFragmentServiceProvider implements ServiceProviderInterface, EventList $app['fragment.path'] = '/_fragment'; $app['fragment.renderer.hinclude.global_template'] = null; $app['fragment.renderers'] = function ($app) { - $renderers = array($app['fragment.renderer.inline'], $app['fragment.renderer.hinclude']); + $renderers = [$app['fragment.renderer.inline'], $app['fragment.renderer.hinclude']]; if (isset($app['http_cache.esi'])) { $renderers[] = $app['fragment.renderer.esi']; diff --git a/vendor/silex/silex/src/Silex/Provider/HttpKernelServiceProvider.php b/vendor/silex/silex/src/Silex/Provider/HttpKernelServiceProvider.php index 86f155fe..485c2bbd 100644 --- a/vendor/silex/silex/src/Silex/Provider/HttpKernelServiceProvider.php +++ b/vendor/silex/silex/src/Silex/Provider/HttpKernelServiceProvider.php @@ -48,16 +48,16 @@ class HttpKernelServiceProvider implements ServiceProviderInterface, EventListen }; $app['argument_value_resolvers'] = function ($app) { if (Kernel::VERSION_ID < 30200) { - return array( + return [ new AppArgumentValueResolver($app), new RequestAttributeValueResolver(), new RequestValueResolver(), new DefaultValueResolver(), new VariadicValueResolver(), - ); + ]; } - return array_merge(array(new AppArgumentValueResolver($app)), ArgumentResolver::getDefaultArgumentValueResolvers()); + return array_merge([new AppArgumentValueResolver($app)], ArgumentResolver::getDefaultArgumentValueResolvers()); }; } diff --git a/vendor/silex/silex/src/Silex/Provider/Locale/LocaleListener.php b/vendor/silex/silex/src/Silex/Provider/Locale/LocaleListener.php index d5002640..2463cc81 100644 --- a/vendor/silex/silex/src/Silex/Provider/Locale/LocaleListener.php +++ b/vendor/silex/silex/src/Silex/Provider/Locale/LocaleListener.php @@ -75,10 +75,10 @@ class LocaleListener implements EventSubscriberInterface public static function getSubscribedEvents() { - return array( + return [ // must be registered after the Router to have access to the _locale - KernelEvents::REQUEST => array(array('onKernelRequest', 16)), - KernelEvents::FINISH_REQUEST => array(array('onKernelFinishRequest', 0)), - ); + KernelEvents::REQUEST => [['onKernelRequest', 16]], + KernelEvents::FINISH_REQUEST => [['onKernelFinishRequest', 0]], + ]; } } diff --git a/vendor/silex/silex/src/Silex/Provider/MonologServiceProvider.php b/vendor/silex/silex/src/Silex/Provider/MonologServiceProvider.php index f8cba4e2..a94c3f5e 100644 --- a/vendor/silex/silex/src/Silex/Provider/MonologServiceProvider.php +++ b/vendor/silex/silex/src/Silex/Provider/MonologServiceProvider.php @@ -46,7 +46,7 @@ class MonologServiceProvider implements ServiceProviderInterface, BootableProvid if (isset($app['request_stack'])) { $app['monolog.not_found_activation_strategy'] = function () use ($app) { - return new NotFoundActivationStrategy($app['request_stack'], array('^/'), $app['monolog.level']); + return new NotFoundActivationStrategy($app['request_stack'], ['^/'], $app['monolog.level']); }; } } @@ -88,7 +88,7 @@ class MonologServiceProvider implements ServiceProviderInterface, BootableProvid }; $app['monolog.handlers'] = function () use ($app, $defaultHandler) { - $handlers = array(); + $handlers = []; // enables the default handler if a logfile was set or the monolog.handler service was redefined if ($app['monolog.logfile'] || $defaultHandler !== $app->raw('monolog.handler')) { diff --git a/vendor/silex/silex/src/Silex/Provider/RememberMeServiceProvider.php b/vendor/silex/silex/src/Silex/Provider/RememberMeServiceProvider.php index 766631c5..097277b8 100644 --- a/vendor/silex/silex/src/Silex/Provider/RememberMeServiceProvider.php +++ b/vendor/silex/silex/src/Silex/Provider/RememberMeServiceProvider.php @@ -54,17 +54,17 @@ class RememberMeServiceProvider implements ServiceProviderInterface, EventListen $app['security.authentication_provider.'.$name.'.remember_me'] = $app['security.authentication_provider.remember_me._proto']($name, $options); } - return array( + return [ 'security.authentication_provider.'.$name.'.remember_me', 'security.authentication_listener.'.$name.'.remember_me', null, // entry point 'remember_me', - ); + ]; }); $app['security.remember_me.service._proto'] = $app->protect(function ($providerKey, $options) use ($app) { return function () use ($providerKey, $options, $app) { - $options = array_replace(array( + $options = array_replace([ 'name' => 'REMEMBERME', 'lifetime' => 31536000, 'path' => '/', @@ -73,9 +73,9 @@ class RememberMeServiceProvider implements ServiceProviderInterface, EventListen 'httponly' => true, 'always_remember_me' => false, 'remember_me_parameter' => '_remember_me', - ), $options); + ], $options); - return new TokenBasedRememberMeServices(array($app['security.user_provider.'.$providerKey]), $options['key'], $providerKey, $options, $app['logger']); + return new TokenBasedRememberMeServices([$app['security.user_provider.'.$providerKey]], $options['key'], $providerKey, $options, $app['logger']); }; }); diff --git a/vendor/silex/silex/src/Silex/Provider/Routing/RedirectableUrlMatcher.php b/vendor/silex/silex/src/Silex/Provider/Routing/RedirectableUrlMatcher.php index 8b4a4dae..b2630aab 100644 --- a/vendor/silex/silex/src/Silex/Provider/Routing/RedirectableUrlMatcher.php +++ b/vendor/silex/silex/src/Silex/Provider/Routing/RedirectableUrlMatcher.php @@ -29,7 +29,7 @@ class RedirectableUrlMatcher extends BaseRedirectableUrlMatcher $url = $this->context->getBaseUrl().$path; $query = $this->context->getQueryString() ?: ''; - if ($query !== '') { + if ('' !== $query) { $url .= '?'.$query; } @@ -46,10 +46,10 @@ class RedirectableUrlMatcher extends BaseRedirectableUrlMatcher } } - return array( + return [ '_controller' => function ($url) { return new RedirectResponse($url, 301); }, '_route' => $route, 'url' => $url, - ); + ]; } } diff --git a/vendor/silex/silex/src/Silex/Provider/RoutingServiceProvider.php b/vendor/silex/silex/src/Silex/Provider/RoutingServiceProvider.php index d040ba0d..76e6e028 100644 --- a/vendor/silex/silex/src/Silex/Provider/RoutingServiceProvider.php +++ b/vendor/silex/silex/src/Silex/Provider/RoutingServiceProvider.php @@ -76,7 +76,7 @@ class RoutingServiceProvider implements ServiceProviderInterface, EventListenerP return $app['request_matcher']; }); - return new RouterListener($urlMatcher, $app['request_stack'], $app['request_context'], $app['logger']); + return new RouterListener($urlMatcher, $app['request_stack'], $app['request_context'], $app['logger'], null, isset($app['debug']) ? $app['debug'] : false); }; } diff --git a/vendor/silex/silex/src/Silex/Provider/SecurityServiceProvider.php b/vendor/silex/silex/src/Silex/Provider/SecurityServiceProvider.php index ebc5bea6..22df5f7b 100644 --- a/vendor/silex/silex/src/Silex/Provider/SecurityServiceProvider.php +++ b/vendor/silex/silex/src/Silex/Provider/SecurityServiceProvider.php @@ -75,12 +75,12 @@ class SecurityServiceProvider implements ServiceProviderInterface, EventListener public function register(Container $app) { // used to register routes for login_check and logout - $this->fakeRoutes = array(); + $this->fakeRoutes = []; $that = $this; - $app['security.role_hierarchy'] = array(); - $app['security.access_rules'] = array(); + $app['security.role_hierarchy'] = []; + $app['security.access_rules'] = []; $app['security.hide_user_not_found'] = true; $app['security.encoder.bcrypt.cost'] = 13; @@ -113,9 +113,9 @@ class SecurityServiceProvider implements ServiceProviderInterface, EventListener // by default, all users use the digest encoder $app['security.encoder_factory'] = function ($app) { - return new EncoderFactory(array( + return new EncoderFactory([ 'Symfony\Component\Security\Core\User\UserInterface' => $app['security.default_encoder'], - )); + ]); }; // by default, all users use the BCrypt encoder @@ -144,13 +144,21 @@ class SecurityServiceProvider implements ServiceProviderInterface, EventListener }; $app['security.voters'] = function ($app) { - return array( + return [ new RoleHierarchyVoter(new RoleHierarchy($app['security.role_hierarchy'])), new AuthenticatedVoter($app['security.trust_resolver']), - ); + ]; }; $app['security.firewall'] = function ($app) { + if (isset($app['validator'])) { + $app['security.validator.user_password_validator'] = function ($app) { + return new UserPasswordValidator($app['security.token_storage'], $app['security.encoder_factory']); + }; + + $app['validator.validator_service_ids'] = array_merge($app['validator.validator_service_ids'], ['security.validator.user_password' => 'security.validator.user_password_validator']); + } + return new Firewall($app['security.firewall_map'], $app['dispatcher']); }; @@ -166,7 +174,7 @@ class SecurityServiceProvider implements ServiceProviderInterface, EventListener }; // generate the build-in authentication factories - foreach (array('logout', 'pre_auth', 'guard', 'form', 'http', 'remember_me', 'anonymous') as $type) { + foreach (['logout', 'pre_auth', 'guard', 'form', 'http', 'remember_me', 'anonymous'] as $type) { $entryPoint = null; if ('http' === $type) { $entryPoint = 'http'; @@ -195,23 +203,23 @@ class SecurityServiceProvider implements ServiceProviderInterface, EventListener $app['security.authentication_provider.'.$name.'.'.$provider] = $app['security.authentication_provider.'.$provider.'._proto']($name, $options); } - return array( + return [ 'security.authentication_provider.'.$name.'.'.$provider, 'security.authentication_listener.'.$name.'.'.$type, $entryPoint ? 'security.entry_point.'.$name.'.'.$entryPoint : null, $type, - ); + ]; }); } $app['security.firewall_map'] = function ($app) { - $positions = array('logout', 'pre_auth', 'guard', 'form', 'http', 'remember_me', 'anonymous'); - $providers = array(); - $configs = array(); + $positions = ['logout', 'pre_auth', 'guard', 'form', 'http', 'remember_me', 'anonymous']; + $providers = []; + $configs = []; foreach ($app['security.firewalls'] as $name => $firewall) { $entryPoint = null; $pattern = isset($firewall['pattern']) ? $firewall['pattern'] : null; - $users = isset($firewall['users']) ? $firewall['users'] : array(); + $users = isset($firewall['users']) ? $firewall['users'] : []; $security = isset($firewall['security']) ? (bool) $firewall['security'] : true; $stateless = isset($firewall['stateless']) ? (bool) $firewall['stateless'] : false; $context = isset($firewall['context']) ? $firewall['context'] : $name; @@ -219,7 +227,7 @@ class SecurityServiceProvider implements ServiceProviderInterface, EventListener $methods = isset($firewall['methods']) ? $firewall['methods'] : null; unset($firewall['pattern'], $firewall['users'], $firewall['security'], $firewall['stateless'], $firewall['context'], $firewall['methods'], $firewall['hosts']); $protected = false === $security ? false : count($firewall); - $listeners = array('security.channel_listener'); + $listeners = ['security.channel_listener']; if ($protected) { if (!isset($app['security.context_listener.'.$name])) { @@ -227,16 +235,16 @@ class SecurityServiceProvider implements ServiceProviderInterface, EventListener $app['security.user_provider.'.$name] = is_array($users) ? $app['security.user_provider.inmemory._proto']($users) : $users; } - $app['security.context_listener.'.$name] = $app['security.context_listener._proto']($name, array($app['security.user_provider.'.$name])); + $app['security.context_listener.'.$name] = $app['security.context_listener._proto']($name, [$app['security.user_provider.'.$name]]); } if (false === $stateless) { $listeners[] = 'security.context_listener.'.$context; } - $factories = array(); + $factories = []; foreach ($positions as $position) { - $factories[$position] = array(); + $factories[$position] = []; } foreach ($firewall as $type => $options) { @@ -250,7 +258,7 @@ class SecurityServiceProvider implements ServiceProviderInterface, EventListener continue; } - $options = array(); + $options = []; } if (!isset($app['security.authentication_listener.factory.'.$type])) { @@ -284,8 +292,8 @@ class SecurityServiceProvider implements ServiceProviderInterface, EventListener } if (!isset($app['security.exception_listener.'.$name])) { - if (null == $entryPoint) { - $app[$entryPoint = 'security.entry_point.'.$name.'.form'] = $app['security.entry_point.form._proto']($name, array()); + if (null === $entryPoint) { + $app[$entryPoint = 'security.entry_point.'.$name.'.form'] = $app['security.entry_point.form._proto']($name, []); } $accessDeniedHandler = null; if (isset($app['security.access_denied_handler.'.$name])) { @@ -295,13 +303,13 @@ class SecurityServiceProvider implements ServiceProviderInterface, EventListener } } - $configs[$name] = array( + $configs[$name] = [ 'pattern' => $pattern, 'listeners' => $listeners, 'protected' => $protected, 'methods' => $methods, 'hosts' => $hosts, - ); + ]; } $app['security.authentication_providers'] = array_map(function ($provider) use ($app) { @@ -356,14 +364,14 @@ class SecurityServiceProvider implements ServiceProviderInterface, EventListener if (is_string($rule[0])) { $rule[0] = new RequestMatcher($rule[0]); } elseif (is_array($rule[0])) { - $rule[0] += array( + $rule[0] += [ 'path' => null, 'host' => null, 'methods' => null, 'ips' => null, - 'attributes' => array(), + 'attributes' => [], 'schemes' => null, - ); + ]; $rule[0] = new RequestMatcher($rule[0]['path'], $rule[0]['host'], $rule[0]['methods'], $rule[0]['ips'], $rule[0]['attributes'], $rule[0]['schemes']); } $map->add($rule[0], (array) $rule[1], isset($rule[2]) ? $rule[2] : null); @@ -414,9 +422,9 @@ class SecurityServiceProvider implements ServiceProviderInterface, EventListener $app['security.user_provider.inmemory._proto'] = $app->protect(function ($params) use ($app) { return function () use ($app, $params) { - $users = array(); + $users = []; foreach ($params as $name => $user) { - $users[$name] = array('roles' => (array) $user[0], 'password' => $user[1]); + $users[$name] = ['roles' => (array) $user[0], 'password' => $user[1]]; } return new InMemoryUserProvider($users); @@ -467,7 +475,7 @@ class SecurityServiceProvider implements ServiceProviderInterface, EventListener $app['security.authentication.guard_handler'] = new GuardAuthenticatorHandler($app['security.token_storage'], $app['dispatcher']); } - $authenticators = array(); + $authenticators = []; foreach ($options['authenticators'] as $authenticatorId) { $authenticators[] = $app[$authenticatorId]; } @@ -613,7 +621,7 @@ class SecurityServiceProvider implements ServiceProviderInterface, EventListener return $app[$options['entry_point']]; } $authenticatorIds = $options['authenticators']; - if (count($authenticatorIds) == 1) { + if (1 == count($authenticatorIds)) { // if there is only one authenticator, use that as the entry point return $app[reset($authenticatorIds)]; } @@ -638,7 +646,7 @@ class SecurityServiceProvider implements ServiceProviderInterface, EventListener $app['security.authentication_provider.guard._proto'] = $app->protect(function ($name, $options) use ($app) { return function () use ($app, $name, $options) { - $authenticators = array(); + $authenticators = []; foreach ($options['authenticators'] as $authenticatorId) { $authenticators[] = $app[$authenticatorId]; } @@ -657,14 +665,6 @@ class SecurityServiceProvider implements ServiceProviderInterface, EventListener return new AnonymousAuthenticationProvider($name); }; }); - - if (isset($app['validator'])) { - $app['security.validator.user_password_validator'] = function ($app) { - return new UserPasswordValidator($app['security.token_storage'], $app['security.encoder_factory']); - }; - - $app['validator.validator_service_ids'] = array_merge($app['validator.validator_service_ids'], array('security.validator.user_password' => 'security.validator.user_password_validator')); - } } public function subscribe(Container $app, EventDispatcherInterface $dispatcher) @@ -691,6 +691,6 @@ class SecurityServiceProvider implements ServiceProviderInterface, EventListener public function addFakeRoute($method, $pattern, $name) { - $this->fakeRoutes[] = array($method, $pattern, $name); + $this->fakeRoutes[] = [$method, $pattern, $name]; } } diff --git a/vendor/silex/silex/src/Silex/Provider/SerializerServiceProvider.php b/vendor/silex/silex/src/Silex/Provider/SerializerServiceProvider.php index 8986abef..3260807c 100644 --- a/vendor/silex/silex/src/Silex/Provider/SerializerServiceProvider.php +++ b/vendor/silex/silex/src/Silex/Provider/SerializerServiceProvider.php @@ -40,11 +40,11 @@ class SerializerServiceProvider implements ServiceProviderInterface }; $app['serializer.encoders'] = function () { - return array(new JsonEncoder(), new XmlEncoder()); + return [new JsonEncoder(), new XmlEncoder()]; }; $app['serializer.normalizers'] = function () { - return array(new CustomNormalizer(), new GetSetMethodNormalizer()); + return [new CustomNormalizer(), new GetSetMethodNormalizer()]; }; } } diff --git a/vendor/silex/silex/src/Silex/Provider/SessionServiceProvider.php b/vendor/silex/silex/src/Silex/Provider/SessionServiceProvider.php index a51e230e..d05af688 100644 --- a/vendor/silex/silex/src/Silex/Provider/SessionServiceProvider.php +++ b/vendor/silex/silex/src/Silex/Provider/SessionServiceProvider.php @@ -68,7 +68,7 @@ class SessionServiceProvider implements ServiceProviderInterface, EventListenerP return new TestSessionListener($app); }; - $app['session.storage.options'] = array(); + $app['session.storage.options'] = []; $app['session.default_locale'] = 'en'; $app['session.storage.save_path'] = null; $app['session.attribute_bag'] = null; diff --git a/vendor/silex/silex/src/Silex/Provider/SwiftmailerServiceProvider.php b/vendor/silex/silex/src/Silex/Provider/SwiftmailerServiceProvider.php index c3dce6ce..0cd3b35d 100644 --- a/vendor/silex/silex/src/Silex/Provider/SwiftmailerServiceProvider.php +++ b/vendor/silex/silex/src/Silex/Provider/SwiftmailerServiceProvider.php @@ -28,7 +28,7 @@ class SwiftmailerServiceProvider implements ServiceProviderInterface, EventListe { public function register(Container $app) { - $app['swiftmailer.options'] = array(); + $app['swiftmailer.options'] = []; $app['swiftmailer.use_spool'] = true; $app['mailer.initialized'] = false; @@ -51,18 +51,19 @@ class SwiftmailerServiceProvider implements ServiceProviderInterface, EventListe $app['swiftmailer.transport'] = function ($app) { $transport = new \Swift_Transport_EsmtpTransport( $app['swiftmailer.transport.buffer'], - array($app['swiftmailer.transport.authhandler']), + [$app['swiftmailer.transport.authhandler']], $app['swiftmailer.transport.eventdispatcher'] ); - $options = $app['swiftmailer.options'] = array_replace(array( + $options = $app['swiftmailer.options'] = array_replace([ 'host' => 'localhost', 'port' => 25, 'username' => '', 'password' => '', 'encryption' => null, 'auth_mode' => null, - ), $app['swiftmailer.options']); + 'stream_context_options' => [], + ], $app['swiftmailer.options']); $transport->setHost($options['host']); $transport->setPort($options['port']); @@ -70,6 +71,7 @@ class SwiftmailerServiceProvider implements ServiceProviderInterface, EventListe $transport->setUsername($options['username']); $transport->setPassword($options['password']); $transport->setAuthMode($options['auth_mode']); + $transport->setStreamOptions($options['stream_context_options']); return $transport; }; @@ -79,11 +81,11 @@ class SwiftmailerServiceProvider implements ServiceProviderInterface, EventListe }; $app['swiftmailer.transport.authhandler'] = function () { - return new \Swift_Transport_Esmtp_AuthHandler(array( + return new \Swift_Transport_Esmtp_AuthHandler([ new \Swift_Transport_Esmtp_Auth_CramMd5Authenticator(), new \Swift_Transport_Esmtp_Auth_LoginAuthenticator(), new \Swift_Transport_Esmtp_Auth_PlainAuthenticator(), - )); + ]); }; $app['swiftmailer.transport.eventdispatcher'] = function ($app) { @@ -110,12 +112,12 @@ class SwiftmailerServiceProvider implements ServiceProviderInterface, EventListe }; $app['swiftmailer.plugins'] = function ($app) { - return array(); + return []; }; $app['swiftmailer.sender_address'] = null; - $app['swiftmailer.delivery_addresses'] = array(); - $app['swiftmailer.delivery_whitelist'] = array(); + $app['swiftmailer.delivery_addresses'] = []; + $app['swiftmailer.delivery_whitelist'] = []; } public function subscribe(Container $app, EventDispatcherInterface $dispatcher) diff --git a/vendor/silex/silex/src/Silex/Provider/TranslationServiceProvider.php b/vendor/silex/silex/src/Silex/Provider/TranslationServiceProvider.php index a9ee55c9..9b8caff6 100644 --- a/vendor/silex/silex/src/Silex/Provider/TranslationServiceProvider.php +++ b/vendor/silex/silex/src/Silex/Provider/TranslationServiceProvider.php @@ -13,7 +13,9 @@ namespace Silex\Provider; use Pimple\Container; use Pimple\ServiceProviderInterface; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Translation\Translator; +use Symfony\Component\Translation\Formatter\MessageFormatter; use Symfony\Component\Translation\MessageSelector; use Symfony\Component\Translation\Loader\ArrayLoader; use Symfony\Component\Translation\Loader\XliffFileLoader; @@ -77,15 +79,19 @@ class TranslationServiceProvider implements ServiceProviderInterface, EventListe } $app['translator.message_selector'] = function () { - return new MessageSelector(); + if (Kernel::VERSION_ID < 30400) { + return new MessageSelector(); + } + + return new MessageFormatter(); }; $app['translator.resources'] = function ($app) { - return array(); + return []; }; - $app['translator.domains'] = array(); - $app['locale_fallbacks'] = array('en'); + $app['translator.domains'] = []; + $app['locale_fallbacks'] = ['en']; $app['translator.cache_dir'] = null; } diff --git a/vendor/silex/silex/src/Silex/Provider/TwigServiceProvider.php b/vendor/silex/silex/src/Silex/Provider/TwigServiceProvider.php index f15a93bf..0f800490 100644 --- a/vendor/silex/silex/src/Silex/Provider/TwigServiceProvider.php +++ b/vendor/silex/silex/src/Silex/Provider/TwigServiceProvider.php @@ -27,6 +27,8 @@ use Symfony\Bridge\Twig\Extension\WebLinkExtension; use Symfony\Bridge\Twig\Form\TwigRendererEngine; use Symfony\Bridge\Twig\Form\TwigRenderer; use Symfony\Bridge\Twig\Extension\HttpKernelRuntime; +use Symfony\Component\Form\FormRenderer; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\WebLink\HttpHeaderSerializer; /** @@ -38,10 +40,10 @@ class TwigServiceProvider implements ServiceProviderInterface { public function register(Container $app) { - $app['twig.options'] = array(); - $app['twig.form.templates'] = array('form_div_layout.html.twig'); - $app['twig.path'] = array(); - $app['twig.templates'] = array(); + $app['twig.options'] = []; + $app['twig.form.templates'] = ['form_div_layout.html.twig']; + $app['twig.path'] = []; + $app['twig.templates'] = []; $app['twig.date.format'] = 'F j, Y H:i'; $app['twig.date.interval_format'] = '%d days'; @@ -53,11 +55,11 @@ class TwigServiceProvider implements ServiceProviderInterface $app['twig'] = function ($app) { $app['twig.options'] = array_replace( - array( + [ 'charset' => $app['charset'], 'debug' => $app['debug'], 'strict_variables' => $app['debug'], - ), $app['twig.options'] + ], $app['twig.options'] ); $twig = $app['twig.environment_factory']($app); @@ -126,7 +128,11 @@ class TwigServiceProvider implements ServiceProviderInterface $app['twig.form.renderer'] = function ($app) { $csrfTokenManager = isset($app['csrf.token_manager']) ? $app['csrf.token_manager'] : null; - return new TwigRenderer($app['twig.form.engine'], $csrfTokenManager); + if (Kernel::VERSION_ID < 30400) { + return new TwigRenderer($app['twig.form.engine'], $csrfTokenManager); + } + + return new FormRenderer($app['twig.form.engine'], $csrfTokenManager); }; $twig->addExtension(new FormExtension(class_exists(HttpKernelRuntime::class) ? null : $app['twig.form.renderer'])); @@ -154,7 +160,16 @@ class TwigServiceProvider implements ServiceProviderInterface }; $app['twig.loader.filesystem'] = function ($app) { - return new \Twig_Loader_Filesystem($app['twig.path']); + $loader = new \Twig_Loader_Filesystem(); + foreach (is_array($app['twig.path']) ? $app['twig.path'] : [$app['twig.path']] as $key => $val) { + if (is_string($key)) { + $loader->addPath($key, $val); + } else { + $loader->addPath($val); + } + } + + return $loader; }; $app['twig.loader.array'] = function ($app) { @@ -162,10 +177,10 @@ class TwigServiceProvider implements ServiceProviderInterface }; $app['twig.loader'] = function ($app) { - return new \Twig_Loader_Chain(array( + return new \Twig_Loader_Chain([ $app['twig.loader.array'], $app['twig.loader.filesystem'], - )); + ]); }; $app['twig.environment_factory'] = $app->protect(function ($app) { @@ -177,10 +192,17 @@ class TwigServiceProvider implements ServiceProviderInterface }; $app['twig.runtimes'] = function ($app) { - return array( + $runtimes = [ HttpKernelRuntime::class => 'twig.runtime.httpkernel', - TwigRenderer::class => 'twig.form.renderer', - ); + ]; + + if (Kernel::VERSION_ID < 30400) { + $runtimes[TwigRenderer::class] = 'twig.form.renderer'; + } else { + $runtimes[FormRenderer::class] = 'twig.form.renderer'; + } + + return $runtimes; }; $app['twig.runtime_loader'] = function ($app) { diff --git a/vendor/silex/silex/src/Silex/Provider/Validator/ConstraintValidatorFactory.php b/vendor/silex/silex/src/Silex/Provider/Validator/ConstraintValidatorFactory.php index 9f5e499d..d74a2b18 100644 --- a/vendor/silex/silex/src/Silex/Provider/Validator/ConstraintValidatorFactory.php +++ b/vendor/silex/silex/src/Silex/Provider/Validator/ConstraintValidatorFactory.php @@ -39,7 +39,7 @@ class ConstraintValidatorFactory extends BaseConstraintValidatorFactory * @param Container $container DI container * @param array $serviceNames Validator service names */ - public function __construct(Container $container, array $serviceNames = array(), $propertyAccessor = null) + public function __construct(Container $container, array $serviceNames = [], $propertyAccessor = null) { parent::__construct($propertyAccessor); diff --git a/vendor/silex/silex/src/Silex/Provider/ValidatorServiceProvider.php b/vendor/silex/silex/src/Silex/Provider/ValidatorServiceProvider.php index d89a3cb5..9aa7ebd5 100644 --- a/vendor/silex/silex/src/Silex/Provider/ValidatorServiceProvider.php +++ b/vendor/silex/silex/src/Silex/Provider/ValidatorServiceProvider.php @@ -54,9 +54,9 @@ class ValidatorServiceProvider implements ServiceProviderInterface }; $app['validator.object_initializers'] = function ($app) { - return array(); + return []; }; - $app['validator.validator_service_ids'] = array(); + $app['validator.validator_service_ids'] = []; } } diff --git a/vendor/silex/silex/src/Silex/Route.php b/vendor/silex/silex/src/Silex/Route.php index 99e82d87..b9365d88 100644 --- a/vendor/silex/silex/src/Silex/Route.php +++ b/vendor/silex/silex/src/Silex/Route.php @@ -35,7 +35,7 @@ class Route extends BaseRoute * @param string|array $schemes A required URI scheme or an array of restricted schemes * @param string|array $methods A required HTTP method or an array of restricted methods */ - public function __construct($path = '/', array $defaults = array(), array $requirements = array(), array $options = array(), $host = '', $schemes = array(), $methods = array()) + public function __construct($path = '/', array $defaults = [], array $requirements = [], array $options = [], $host = '', $schemes = [], $methods = []) { // overridden constructor to make $path optional parent::__construct($path, $defaults, $requirements, $options, $host, $schemes, $methods); diff --git a/vendor/silex/silex/src/Silex/ServiceControllerResolver.php b/vendor/silex/silex/src/Silex/ServiceControllerResolver.php index 87f91b04..304f7bd4 100644 --- a/vendor/silex/silex/src/Silex/ServiceControllerResolver.php +++ b/vendor/silex/silex/src/Silex/ServiceControllerResolver.php @@ -17,7 +17,7 @@ use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface; /** * Enables name_of_service:method_name syntax for declaring controllers. * - * @link http://silex.sensiolabs.org/doc/providers/service_controller.html + * @see http://silex.sensiolabs.org/doc/providers/service_controller.html */ class ServiceControllerResolver implements ControllerResolverInterface { diff --git a/vendor/silex/silex/src/Silex/WebTestCase.php b/vendor/silex/silex/src/Silex/WebTestCase.php index e72403a1..8580b79c 100644 --- a/vendor/silex/silex/src/Silex/WebTestCase.php +++ b/vendor/silex/silex/src/Silex/WebTestCase.php @@ -54,7 +54,7 @@ abstract class WebTestCase extends TestCase * * @return Client A Client instance */ - public function createClient(array $server = array()) + public function createClient(array $server = []) { if (!class_exists('Symfony\Component\BrowserKit\Client')) { throw new \LogicException('Component "symfony/browser-kit" is required by WebTestCase.'.PHP_EOL.'Run composer require symfony/browser-kit'); diff --git a/vendor/silex/silex/tests/Silex/Tests/Application/MonologTraitTest.php b/vendor/silex/silex/tests/Silex/Tests/Application/MonologTraitTest.php index 73dcda65..7487f43a 100644 --- a/vendor/silex/silex/tests/Silex/Tests/Application/MonologTraitTest.php +++ b/vendor/silex/silex/tests/Silex/Tests/Application/MonologTraitTest.php @@ -28,7 +28,7 @@ class MonologTraitTest extends TestCase $app = $this->createApplication(); $app->log('Foo'); - $app->log('Bar', array(), Logger::DEBUG); + $app->log('Bar', [], Logger::DEBUG); $this->assertTrue($app['monolog.handler']->hasInfo('Foo')); $this->assertTrue($app['monolog.handler']->hasDebug('Bar')); } @@ -36,12 +36,12 @@ class MonologTraitTest extends TestCase public function createApplication() { $app = new MonologApplication(); - $app->register(new MonologServiceProvider(), array( + $app->register(new MonologServiceProvider(), [ 'monolog.handler' => function () use ($app) { return new TestHandler($app['monolog.level']); }, 'monolog.logfile' => 'php://memory', - )); + ]); return $app; } diff --git a/vendor/silex/silex/tests/Silex/Tests/Application/SecurityTraitTest.php b/vendor/silex/silex/tests/Silex/Tests/Application/SecurityTraitTest.php index 71cb3af6..ce1ff5d2 100644 --- a/vendor/silex/silex/tests/Silex/Tests/Application/SecurityTraitTest.php +++ b/vendor/silex/silex/tests/Silex/Tests/Application/SecurityTraitTest.php @@ -25,9 +25,9 @@ class SecurityTraitTest extends TestCase { public function testEncodePassword() { - $app = $this->createApplication(array( - 'fabien' => array('ROLE_ADMIN', '$2y$15$lzUNsTegNXvZW3qtfucV0erYBcEqWVeyOmjolB7R1uodsAVJ95vvu'), - )); + $app = $this->createApplication([ + 'fabien' => ['ROLE_ADMIN', '$2y$15$lzUNsTegNXvZW3qtfucV0erYBcEqWVeyOmjolB7R1uodsAVJ95vvu'], + ]); $user = new User('foo', 'bar'); $password = 'foo'; @@ -53,10 +53,10 @@ class SecurityTraitTest extends TestCase { $request = Request::create('/'); - $app = $this->createApplication(array( - 'fabien' => array('ROLE_ADMIN', '$2y$15$lzUNsTegNXvZW3qtfucV0erYBcEqWVeyOmjolB7R1uodsAVJ95vvu'), - 'monique' => array('ROLE_USER', '$2y$15$lzUNsTegNXvZW3qtfucV0erYBcEqWVeyOmjolB7R1uodsAVJ95vvu'), - )); + $app = $this->createApplication([ + 'fabien' => ['ROLE_ADMIN', '$2y$15$lzUNsTegNXvZW3qtfucV0erYBcEqWVeyOmjolB7R1uodsAVJ95vvu'], + 'monique' => ['ROLE_USER', '$2y$15$lzUNsTegNXvZW3qtfucV0erYBcEqWVeyOmjolB7R1uodsAVJ95vvu'], + ]); $app->get('/', function () { return 'foo'; }); // User is Monique (ROLE_USER) @@ -74,17 +74,17 @@ class SecurityTraitTest extends TestCase $this->assertTrue($app->isGranted('ROLE_ADMIN')); } - public function createApplication($users = array()) + public function createApplication($users = []) { $app = new SecurityApplication(); - $app->register(new SecurityServiceProvider(), array( - 'security.firewalls' => array( - 'default' => array( + $app->register(new SecurityServiceProvider(), [ + 'security.firewalls' => [ + 'default' => [ 'http' => true, 'users' => $users, - ), - ), - )); + ], + ], + ]); return $app; } diff --git a/vendor/silex/silex/tests/Silex/Tests/Application/TwigTraitTest.php b/vendor/silex/silex/tests/Silex/Tests/Application/TwigTraitTest.php index 250ebcfa..09ee8606 100644 --- a/vendor/silex/silex/tests/Silex/Tests/Application/TwigTraitTest.php +++ b/vendor/silex/silex/tests/Silex/Tests/Application/TwigTraitTest.php @@ -42,7 +42,7 @@ class TwigTraitTest extends TestCase $app['twig'] = $mailer = $this->getMockBuilder('Twig_Environment')->disableOriginalConstructor()->getMock(); $mailer->expects($this->once())->method('render')->will($this->returnValue('foo')); - $response = $app->render('view', array(), new Response('', 404)); + $response = $app->render('view', [], new Response('', 404)); $this->assertEquals(404, $response->getStatusCode()); } @@ -53,7 +53,7 @@ class TwigTraitTest extends TestCase $app['twig'] = $mailer = $this->getMockBuilder('Twig_Environment')->disableOriginalConstructor()->getMock(); $mailer->expects($this->once())->method('display')->will($this->returnCallback(function () { echo 'foo'; })); - $response = $app->render('view', array(), new StreamedResponse()); + $response = $app->render('view', [], new StreamedResponse()); $this->assertEquals('Symfony\Component\HttpFoundation\StreamedResponse', get_class($response)); ob_start(); diff --git a/vendor/silex/silex/tests/Silex/Tests/Application/UrlGeneratorTraitTest.php b/vendor/silex/silex/tests/Silex/Tests/Application/UrlGeneratorTraitTest.php index df29d6e7..db6de1e2 100644 --- a/vendor/silex/silex/tests/Silex/Tests/Application/UrlGeneratorTraitTest.php +++ b/vendor/silex/silex/tests/Silex/Tests/Application/UrlGeneratorTraitTest.php @@ -25,7 +25,7 @@ class UrlGeneratorTraitTest extends TestCase { $app = new UrlGeneratorApplication(); $app['url_generator'] = $this->getMockBuilder('Symfony\Component\Routing\Generator\UrlGeneratorInterface')->disableOriginalConstructor()->getMock(); - $app['url_generator']->expects($this->once())->method('generate')->with('foo', array(), UrlGeneratorInterface::ABSOLUTE_URL); + $app['url_generator']->expects($this->once())->method('generate')->with('foo', [], UrlGeneratorInterface::ABSOLUTE_URL); $app->url('foo'); } @@ -33,7 +33,7 @@ class UrlGeneratorTraitTest extends TestCase { $app = new UrlGeneratorApplication(); $app['url_generator'] = $this->getMockBuilder('Symfony\Component\Routing\Generator\UrlGeneratorInterface')->disableOriginalConstructor()->getMock(); - $app['url_generator']->expects($this->once())->method('generate')->with('foo', array(), UrlGeneratorInterface::ABSOLUTE_PATH); + $app['url_generator']->expects($this->once())->method('generate')->with('foo', [], UrlGeneratorInterface::ABSOLUTE_PATH); $app->path('foo'); } } diff --git a/vendor/silex/silex/tests/Silex/Tests/ApplicationTest.php b/vendor/silex/silex/tests/Silex/Tests/ApplicationTest.php index 57a1d637..c46e4ff9 100644 --- a/vendor/silex/silex/tests/Silex/Tests/ApplicationTest.php +++ b/vendor/silex/silex/tests/Silex/Tests/ApplicationTest.php @@ -60,12 +60,12 @@ class ApplicationTest extends TestCase public function testConstructorInjection() { // inject a custom parameter - $params = array('param' => 'value'); + $params = ['param' => 'value']; $app = new Application($params); $this->assertSame($params['param'], $app['param']); // inject an existing parameter - $params = array('locale' => 'value'); + $params = ['locale' => 'value']; $app = new Application($params); $this->assertSame($params['locale'], $app['locale']); } @@ -88,7 +88,7 @@ class ApplicationTest extends TestCase $routes = $app['routes']; $this->assertInstanceOf('Symfony\Component\Routing\RouteCollection', $routes); - $this->assertEquals(0, count($routes->all())); + $this->assertCount(0, $routes->all()); } public function testGetRoutesWithRoutes() @@ -105,9 +105,9 @@ class ApplicationTest extends TestCase $routes = $app['routes']; $this->assertInstanceOf('Symfony\Component\Routing\RouteCollection', $routes); - $this->assertEquals(0, count($routes->all())); + $this->assertCount(0, $routes->all()); $app->flush(); - $this->assertEquals(2, count($routes->all())); + $this->assertCount(2, $routes->all()); } public function testOnCoreController() @@ -116,14 +116,14 @@ class ApplicationTest extends TestCase $app->get('/foo/{foo}', function (\ArrayObject $foo) { return $foo['foo']; - })->convert('foo', function ($foo) { return new \ArrayObject(array('foo' => $foo)); }); + })->convert('foo', function ($foo) { return new \ArrayObject(['foo' => $foo]); }); $response = $app->handle(Request::create('/foo/bar')); $this->assertEquals('bar', $response->getContent()); $app->get('/foo/{foo}/{bar}', function (\ArrayObject $foo) { return $foo['foo']; - })->convert('foo', function ($foo, Request $request) { return new \ArrayObject(array('foo' => $foo.$request->attributes->get('bar'))); }); + })->convert('foo', function ($foo, Request $request) { return new \ArrayObject(['foo' => $foo.$request->attributes->get('bar')]); }); $response = $app->handle(Request::create('/foo/foo/bar')); $this->assertEquals('foobar', $response->getContent()); @@ -167,13 +167,13 @@ class ApplicationTest extends TestCase public function escapeProvider() { - return array( - array('<', '<'), - array('>', '>'), - array('"', '"'), - array("'", "'"), - array('abc', 'abc'), - ); + return [ + ['<', '<'], + ['>', '>'], + ['"', '"'], + ["'", "'"], + ['abc', 'abc'], + ]; } public function testControllersAsMethods() @@ -234,7 +234,7 @@ class ApplicationTest extends TestCase $test = $this; - $middlewareTarget = array(); + $middlewareTarget = []; $beforeMiddleware1 = function (Request $request) use (&$middlewareTarget, $test) { $test->assertEquals('/reached', $request->getRequestUri()); $middlewareTarget[] = 'before_middleware1_triggered'; @@ -277,7 +277,7 @@ class ApplicationTest extends TestCase $result = $app->handle(Request::create('/reached')); - $this->assertSame(array('before_middleware1_triggered', 'before_middleware2_triggered', 'route_triggered', 'after_middleware1_triggered', 'after_middleware2_triggered'), $middlewareTarget); + $this->assertSame(['before_middleware1_triggered', 'before_middleware2_triggered', 'route_triggered', 'after_middleware1_triggered', 'after_middleware2_triggered'], $middlewareTarget); $this->assertEquals('hello', $result->getContent()); } @@ -337,7 +337,7 @@ class ApplicationTest extends TestCase { $app = new Application(); - $middlewareTarget = array(); + $middlewareTarget = []; $middleware = function (Request $request) use (&$middlewareTarget) { $middlewareTarget[] = 'middleware_triggered'; }; @@ -353,14 +353,14 @@ class ApplicationTest extends TestCase $app->handle(Request::create('/foo')); - $this->assertSame(array('before_triggered', 'middleware_triggered', 'route_triggered'), $middlewareTarget); + $this->assertSame(['before_triggered', 'middleware_triggered', 'route_triggered'], $middlewareTarget); } public function testRoutesAfterMiddlewaresTriggeredBeforeSilexAfterFilters() { $app = new Application(); - $middlewareTarget = array(); + $middlewareTarget = []; $middleware = function (Request $request) use (&$middlewareTarget) { $middlewareTarget[] = 'middleware_triggered'; }; @@ -376,12 +376,12 @@ class ApplicationTest extends TestCase $app->handle(Request::create('/foo')); - $this->assertSame(array('route_triggered', 'middleware_triggered', 'after_triggered'), $middlewareTarget); + $this->assertSame(['route_triggered', 'middleware_triggered', 'after_triggered'], $middlewareTarget); } public function testFinishFilter() { - $containerTarget = array(); + $containerTarget = []; $app = new Application(); @@ -403,7 +403,7 @@ class ApplicationTest extends TestCase $app->run(Request::create('/foo')); - $this->assertSame(array('1_routeTriggered', '2_filterAfter', '3_responseSent', '4_filterFinish'), $containerTarget); + $this->assertSame(['1_routeTriggered', '2_filterAfter', '3_responseSent', '4_filterFinish'], $containerTarget); } /** @@ -485,7 +485,7 @@ class ApplicationTest extends TestCase $app->get('/after')->bind('third'); $app->flush(); - $this->assertEquals(array('first', 'second', 'third'), array_keys(iterator_to_array($app['routes']))); + $this->assertEquals(['first', 'second', 'third'], array_keys(iterator_to_array($app['routes']))); } /** @@ -524,7 +524,7 @@ class ApplicationTest extends TestCase { $app = new Application(); - $response = $app->sendFile(__FILE__, 200, array('Content-Type: application/php')); + $response = $app->sendFile(__FILE__, 200, ['Content-Type: application/php']); $this->assertInstanceOf('Symfony\Component\HttpFoundation\BinaryFileResponse', $response); $this->assertEquals(__FILE__, (string) $response->getFile()); } @@ -569,7 +569,7 @@ class ApplicationTest extends TestCase public function testViewListenerWithArrayTypeHint() { $app = new Application(); - $app->get('/foo', function () { return array('ok'); }); + $app->get('/foo', function () { return ['ok']; }); $app->view(function (array $view) { return new Response($view[0]); }); @@ -582,7 +582,7 @@ class ApplicationTest extends TestCase public function testViewListenerWithObjectTypeHint() { $app = new Application(); - $app->get('/foo', function () { return (object) array('name' => 'world'); }); + $app->get('/foo', function () { return (object) ['name' => 'world']; }); $app->view(function (\stdClass $view) { return new Response('Hello '.$view->name); }); @@ -608,10 +608,10 @@ class ApplicationTest extends TestCase public function testViewListenersCanBeChained() { $app = new Application(); - $app->get('/foo', function () { return (object) array('name' => 'world'); }); + $app->get('/foo', function () { return (object) ['name' => 'world']; }); $app->view(function (\stdClass $view) { - return array('msg' => 'Hello '.$view->name); + return ['msg' => 'Hello '.$view->name]; }); $app->view(function (array $view) { diff --git a/vendor/silex/silex/tests/Silex/Tests/CallbackResolverTest.php b/vendor/silex/silex/tests/Silex/Tests/CallbackResolverTest.php index b637a944..fc664759 100644 --- a/vendor/silex/silex/tests/Silex/Tests/CallbackResolverTest.php +++ b/vendor/silex/silex/tests/Silex/Tests/CallbackResolverTest.php @@ -37,7 +37,7 @@ class CallbackResolverTest extends Testcase $this->assertTrue($this->resolver->isValid('some_service:methodName')); $this->assertTrue($this->resolver->isValid('callable_service')); $this->assertEquals( - array($this->app['some_service'], 'append'), + [$this->app['some_service'], 'append'], $this->resolver->convertCallback('some_service:append') ); $this->assertSame($callable, $this->resolver->convertCallback('callable_service')); @@ -53,11 +53,11 @@ class CallbackResolverTest extends Testcase public function nonStringsAreNotValidProvider() { - return array( - array(null), - array('some_service::methodName'), - array('missing_service'), - ); + return [ + [null], + ['some_service::methodName'], + ['missing_service'], + ]; } /** @@ -68,15 +68,15 @@ class CallbackResolverTest extends Testcase public function testShouldThrowAnExceptionIfServiceIsNotCallable($name) { $this->app['non_callable_obj'] = function () { return new \stdClass(); }; - $this->app['non_callable'] = function () { return array(); }; + $this->app['non_callable'] = function () { return []; }; $this->resolver->convertCallback($name); } public function shouldThrowAnExceptionIfServiceIsNotCallableProvider() { - return array( - array('non_callable_obj:methodA'), - array('non_callable'), - ); + return [ + ['non_callable_obj:methodA'], + ['non_callable'], + ]; } } diff --git a/vendor/silex/silex/tests/Silex/Tests/CallbackServicesTest.php b/vendor/silex/silex/tests/Silex/Tests/CallbackServicesTest.php index 915c0496..2210977b 100644 --- a/vendor/silex/silex/tests/Silex/Tests/CallbackServicesTest.php +++ b/vendor/silex/silex/tests/Silex/Tests/CallbackServicesTest.php @@ -23,7 +23,7 @@ use Silex\Provider\ServiceControllerServiceProvider; */ class CallbackServicesTest extends TestCase { - public $called = array(); + public $called = []; public function testCallbacksAsServices() { @@ -51,7 +51,7 @@ class CallbackServicesTest extends TestCase $response = $app->handle($request); $app->terminate($request, $response); - $this->assertEquals(array( + $this->assertEquals([ 'BEFORE APP', 'ON REQUEST', 'BEFORE', @@ -60,7 +60,7 @@ class CallbackServicesTest extends TestCase 'AFTER', 'AFTER APP', 'FINISH APP', - ), $app['service']->called); + ], $app['service']->called); } public function controller(Application $app) diff --git a/vendor/silex/silex/tests/Silex/Tests/ControllerCollectionTest.php b/vendor/silex/silex/tests/Silex/Tests/ControllerCollectionTest.php index 53e33844..319ed7a3 100644 --- a/vendor/silex/silex/tests/Silex/Tests/ControllerCollectionTest.php +++ b/vendor/silex/silex/tests/Silex/Tests/ControllerCollectionTest.php @@ -30,7 +30,7 @@ class ControllerCollectionTest extends TestCase { $controllers = new ControllerCollection(new Route()); $routes = $controllers->flush(); - $this->assertEquals(0, count($routes->all())); + $this->assertCount(0, $routes->all()); } public function testGetRouteCollectionWithRoutes() @@ -40,7 +40,7 @@ class ControllerCollectionTest extends TestCase $controllers->match('/bar', function () {}); $routes = $controllers->flush(); - $this->assertEquals(2, count($routes->all())); + $this->assertCount(2, $routes->all()); } public function testControllerFreezing() @@ -58,11 +58,15 @@ class ControllerCollectionTest extends TestCase } catch (ControllerFrozenException $e) { } + $this->addToAssertionCount(1); + try { $barController->bind('bar2'); $this->fail(); } catch (ControllerFrozenException $e) { } + + $this->addToAssertionCount(1); } public function testConflictingRouteNames() @@ -90,7 +94,7 @@ class ControllerCollectionTest extends TestCase $routes = $controllers->flush(); $this->assertCount(3, $routes->all()); - $this->assertEquals(array('_a_a', '_a_a_1', '_a_a_2'), array_keys($routes->all())); + $this->assertEquals(['_a_a', '_a_a_1', '_a_a_2'], array_keys($routes->all())); } public function testUniqueGeneratedRouteNamesAmongMounts() @@ -106,7 +110,7 @@ class ControllerCollectionTest extends TestCase $routes = $controllers->flush(); $this->assertCount(2, $routes->all()); - $this->assertEquals(array('_root_a_leaf', '_root_a_leaf_1'), array_keys($routes->all())); + $this->assertEquals(['_root_a_leaf', '_root_a_leaf_1'], array_keys($routes->all())); } public function testUniqueGeneratedRouteNamesAmongNestedMounts() @@ -125,7 +129,7 @@ class ControllerCollectionTest extends TestCase $routes = $controllers->flush(); $this->assertCount(2, $routes->all()); - $this->assertEquals(array('_root_a_tree_leaf', '_root_a_tree_leaf_1'), array_keys($routes->all())); + $this->assertEquals(['_root_a_tree_leaf', '_root_a_tree_leaf_1'], array_keys($routes->all())); } public function testMountCallable() @@ -154,7 +158,7 @@ class ControllerCollectionTest extends TestCase $routes = $controllers->flush(); $subRoutes = $subControllers->flush(); - $this->assertTrue($routes->count() == 2 && $subRoutes->count() == 0); + $this->assertTrue(2 == $routes->count() && 0 == $subRoutes->count()); } public function testMountControllersFactory() @@ -191,6 +195,23 @@ class ControllerCollectionTest extends TestCase $this->assertEquals('\w+', $controller->getRoute()->getRequirement('extra')); } + public function testAssertWithMountCallable() + { + $controllers = new ControllerCollection(new Route()); + $controller = null; + $controllers->mount('/{name}', function ($mounted) use (&$controller) { + $mounted->assert('name', '\w+'); + $mounted->mount('/{id}', function ($mounted2) use (&$controller) { + $mounted2->assert('id', '\d+'); + $controller = $mounted2->match('/{extra}', function () {})->assert('extra', '\w+'); + }); + }); + + $this->assertEquals('\d+', $controller->getRoute()->getRequirement('id')); + $this->assertEquals('\w+', $controller->getRoute()->getRequirement('name')); + $this->assertEquals('\w+', $controller->getRoute()->getRequirement('extra')); + } + public function testValue() { $controllers = new ControllerCollection(new Route()); @@ -210,7 +231,7 @@ class ControllerCollectionTest extends TestCase $controller = $controllers->match('/{id}/{name}/{extra}', function () {})->convert('name', 'Fabien')->convert('extra', 'Symfony'); $controllers->convert('extra', 'Twig'); - $this->assertEquals(array('id' => '1', 'name' => 'Fabien', 'extra' => 'Twig'), $controller->getRoute()->getOption('_converters')); + $this->assertEquals(['id' => '1', 'name' => 'Fabien', 'extra' => 'Twig'], $controller->getRoute()->getOption('_converters')); } public function testRequireHttp() @@ -219,11 +240,11 @@ class ControllerCollectionTest extends TestCase $controllers->requireHttp(); $controller = $controllers->match('/{id}/{name}/{extra}', function () {})->requireHttps(); - $this->assertEquals(array('https'), $controller->getRoute()->getSchemes()); + $this->assertEquals(['https'], $controller->getRoute()->getSchemes()); $controllers->requireHttp(); - $this->assertEquals(array('http'), $controller->getRoute()->getSchemes()); + $this->assertEquals(['http'], $controller->getRoute()->getSchemes()); } public function testBefore() @@ -233,7 +254,7 @@ class ControllerCollectionTest extends TestCase $controller = $controllers->match('/{id}/{name}/{extra}', function () {})->before('mid2'); $controllers->before('mid3'); - $this->assertEquals(array('mid1', 'mid2', 'mid3'), $controller->getRoute()->getOption('_before_middlewares')); + $this->assertEquals(['mid1', 'mid2', 'mid3'], $controller->getRoute()->getOption('_before_middlewares')); } public function testAfter() @@ -243,7 +264,7 @@ class ControllerCollectionTest extends TestCase $controller = $controllers->match('/{id}/{name}/{extra}', function () {})->after('mid2'); $controllers->after('mid3'); - $this->assertEquals(array('mid1', 'mid2', 'mid3'), $controller->getRoute()->getOption('_after_middlewares')); + $this->assertEquals(['mid1', 'mid2', 'mid3'], $controller->getRoute()->getOption('_after_middlewares')); } public function testWhen() @@ -288,9 +309,9 @@ class ControllerCollectionTest extends TestCase $cl1->flush(); - $this->assertEquals(array('before'), $c1->getRoute()->getOption('_before_middlewares')); - $this->assertEquals(array('before'), $c2->getRoute()->getOption('_before_middlewares')); - $this->assertEquals(array('before'), $c3->getRoute()->getOption('_before_middlewares')); + $this->assertEquals(['before'], $c1->getRoute()->getOption('_before_middlewares')); + $this->assertEquals(['before'], $c2->getRoute()->getOption('_before_middlewares')); + $this->assertEquals(['before'], $c3->getRoute()->getOption('_before_middlewares')); } public function testRoutesFactoryOmitted() diff --git a/vendor/silex/silex/tests/Silex/Tests/ControllerResolverTest.php b/vendor/silex/silex/tests/Silex/Tests/ControllerResolverTest.php index efc39c99..14ccbbdf 100644 --- a/vendor/silex/silex/tests/Silex/Tests/ControllerResolverTest.php +++ b/vendor/silex/silex/tests/Silex/Tests/ControllerResolverTest.php @@ -15,6 +15,7 @@ use PHPUnit\Framework\TestCase; use Silex\ControllerResolver; use Silex\Application; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\Kernel; /** * ControllerResolver test cases. @@ -28,6 +29,10 @@ class ControllerResolverTest extends TestCase */ public function testGetArguments() { + if (Kernel::VERSION_ID >= 30100) { + self::markTestSkipped('HttpKernel < 3.1.0 is required'); + } + $app = new Application(); $resolver = new ControllerResolver($app); diff --git a/vendor/silex/silex/tests/Silex/Tests/ControllerTest.php b/vendor/silex/silex/tests/Silex/Tests/ControllerTest.php index 88c6f0a1..ebf10b1e 100644 --- a/vendor/silex/silex/tests/Silex/Tests/ControllerTest.php +++ b/vendor/silex/silex/tests/Silex/Tests/ControllerTest.php @@ -48,7 +48,7 @@ class ControllerTest extends TestCase $ret = $controller->assert('bar', '\d+'); $this->assertSame($ret, $controller); - $this->assertEquals(array('bar' => '\d+'), $controller->getRoute()->getRequirements()); + $this->assertEquals(['bar' => '\d+'], $controller->getRoute()->getRequirements()); } public function testValue() @@ -57,7 +57,7 @@ class ControllerTest extends TestCase $ret = $controller->value('bar', 'foo'); $this->assertSame($ret, $controller); - $this->assertEquals(array('bar' => 'foo'), $controller->getRoute()->getDefaults()); + $this->assertEquals(['bar' => 'foo'], $controller->getRoute()->getDefaults()); } public function testConvert() @@ -66,7 +66,7 @@ class ControllerTest extends TestCase $ret = $controller->convert('bar', $func = function ($bar) { return $bar; }); $this->assertSame($ret, $controller); - $this->assertEquals(array('bar' => $func), $controller->getRoute()->getOption('_converters')); + $this->assertEquals(['bar' => $func], $controller->getRoute()->getOption('_converters')); } public function testRun() @@ -91,13 +91,13 @@ class ControllerTest extends TestCase public function provideRouteAndExpectedRouteName() { - return array( - array(new Route('/Invalid%Symbols#Stripped', array(), array(), array(), '', array(), array('POST')), '', 'POST_InvalidSymbolsStripped'), - array(new Route('/post/{id}', array(), array(), array(), '', array(), array('GET')), '', 'GET_post_id'), - array(new Route('/colon:pipe|dashes-escaped'), '', '_colon_pipe_dashes_escaped'), - array(new Route('/underscores_and.periods'), '', '_underscores_and.periods'), - array(new Route('/post/{id}', array(), array(), array(), '', array(), array('GET')), 'prefix', 'GET_prefix_post_id'), - ); + return [ + [new Route('/Invalid%Symbols#Stripped', [], [], [], '', [], ['POST']), '', 'POST_InvalidSymbolsStripped'], + [new Route('/post/{id}', [], [], [], '', [], ['GET']), '', 'GET_post_id'], + [new Route('/colon:pipe|dashes-escaped'), '', '_colon_pipe_dashes_escaped'], + [new Route('/underscores_and.periods'), '', '_underscores_and.periods'], + [new Route('/post/{id}', [], [], [], '', [], ['GET']), 'prefix', 'GET_prefix_post_id'], + ]; } public function testRouteExtension() diff --git a/vendor/silex/silex/tests/Silex/Tests/ExceptionHandlerTest.php b/vendor/silex/silex/tests/Silex/Tests/ExceptionHandlerTest.php index aea31b08..e5c43fbb 100644 --- a/vendor/silex/silex/tests/Silex/Tests/ExceptionHandlerTest.php +++ b/vendor/silex/silex/tests/Silex/Tests/ExceptionHandlerTest.php @@ -381,7 +381,7 @@ class ExceptionHandlerTest extends TestCase }); // Array style callback for error handler - $app->error(array($this, 'exceptionHandler')); + $app->error([$this, 'exceptionHandler']); $request = Request::create('/foo'); $response = $app->handle($request); diff --git a/vendor/silex/silex/tests/Silex/Tests/JsonTest.php b/vendor/silex/silex/tests/Silex/Tests/JsonTest.php index 950437c3..a471ccc8 100644 --- a/vendor/silex/silex/tests/Silex/Tests/JsonTest.php +++ b/vendor/silex/silex/tests/Silex/Tests/JsonTest.php @@ -28,14 +28,14 @@ class JsonTest extends TestCase $response = $app->json(); $this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response); $response = json_decode($response->getContent(), true); - $this->assertSame(array(), $response); + $this->assertSame([], $response); } public function testJsonUsesData() { $app = new Application(); - $response = $app->json(array('foo' => 'bar')); + $response = $app->json(['foo' => 'bar']); $this->assertSame('{"foo":"bar"}', $response->getContent()); } @@ -43,7 +43,7 @@ class JsonTest extends TestCase { $app = new Application(); - $response = $app->json(array(), 202); + $response = $app->json([], 202); $this->assertSame(202, $response->getStatusCode()); } @@ -51,7 +51,7 @@ class JsonTest extends TestCase { $app = new Application(); - $response = $app->json(array(), 200, array('ETag' => 'foo')); + $response = $app->json([], 200, ['ETag' => 'foo']); $this->assertSame('foo', $response->headers->get('ETag')); } } diff --git a/vendor/silex/silex/tests/Silex/Tests/MiddlewareTest.php b/vendor/silex/silex/tests/Silex/Tests/MiddlewareTest.php index 6335dad3..494636be 100644 --- a/vendor/silex/silex/tests/Silex/Tests/MiddlewareTest.php +++ b/vendor/silex/silex/tests/Silex/Tests/MiddlewareTest.php @@ -255,7 +255,7 @@ class MiddlewareTest extends TestCase $test = $this; - $middlewareTarget = array(); + $middlewareTarget = []; $applicationBeforeMiddleware = function ($request, $app) use (&$middlewareTarget, $test) { $test->assertInstanceOf('\Symfony\Component\HttpFoundation\Request', $request); $test->assertInstanceOf('\Silex\Application', $app); @@ -303,6 +303,6 @@ class MiddlewareTest extends TestCase $response = $app->handle($request); $app->terminate($request, $response); - $this->assertSame(array('application_before_middleware_triggered', 'route_before_middleware_triggered', 'route_after_middleware_triggered', 'application_after_middleware_triggered', 'application_finish_middleware_triggered'), $middlewareTarget); + $this->assertSame(['application_before_middleware_triggered', 'route_before_middleware_triggered', 'route_after_middleware_triggered', 'application_after_middleware_triggered', 'application_finish_middleware_triggered'], $middlewareTarget); } } diff --git a/vendor/silex/silex/tests/Silex/Tests/Provider/AssetServiceProviderTest.php b/vendor/silex/silex/tests/Silex/Tests/Provider/AssetServiceProviderTest.php index 940fdca3..7ddc4218 100644 --- a/vendor/silex/silex/tests/Silex/Tests/Provider/AssetServiceProviderTest.php +++ b/vendor/silex/silex/tests/Silex/Tests/Provider/AssetServiceProviderTest.php @@ -20,14 +20,14 @@ class AssetServiceProviderTest extends TestCase public function testGenerateAssetUrl() { $app = new Application(); - $app->register(new AssetServiceProvider(), array( + $app->register(new AssetServiceProvider(), [ 'assets.version' => 'v1', 'assets.version_format' => '%s?version=%s', - 'assets.named_packages' => array( - 'css' => array('version' => 'css2', 'base_path' => '/whatever-makes-sense'), - 'images' => array('base_urls' => array('https://img.example.com')), - ), - )); + 'assets.named_packages' => [ + 'css' => ['version' => 'css2', 'base_path' => '/whatever-makes-sense'], + 'images' => ['base_urls' => ['https://img.example.com']], + ], + ]); $this->assertEquals('/foo.png?version=v1', $app['assets.packages']->getUrl('/foo.png')); $this->assertEquals('/whatever-makes-sense/foo.css?css2', $app['assets.packages']->getUrl('foo.css', 'css')); @@ -43,9 +43,9 @@ class AssetServiceProviderTest extends TestCase } $app = new Application(); - $app->register(new AssetServiceProvider(), array( + $app->register(new AssetServiceProvider(), [ 'assets.json_manifest_path' => __DIR__.'/../Fixtures/manifest.json', - )); + ]); $this->assertEquals('/some-random-hash.js', $app['assets.packages']->getUrl('app.js')); } diff --git a/vendor/silex/silex/tests/Silex/Tests/Provider/DoctrineServiceProviderTest.php b/vendor/silex/silex/tests/Silex/Tests/Provider/DoctrineServiceProviderTest.php index 9da8b8e0..ad67969e 100644 --- a/vendor/silex/silex/tests/Silex/Tests/Provider/DoctrineServiceProviderTest.php +++ b/vendor/silex/silex/tests/Silex/Tests/Provider/DoctrineServiceProviderTest.php @@ -38,9 +38,9 @@ class DoctrineServiceProviderTest extends TestCase } $app = new Application(); - $app->register(new DoctrineServiceProvider(), array( - 'db.options' => array('driver' => 'pdo_sqlite', 'memory' => true), - )); + $app->register(new DoctrineServiceProvider(), [ + 'db.options' => ['driver' => 'pdo_sqlite', 'memory' => true], + ]); $db = $app['db']; $params = $db->getParams(); @@ -59,12 +59,12 @@ class DoctrineServiceProviderTest extends TestCase } $app = new Application(); - $app->register(new DoctrineServiceProvider(), array( - 'dbs.options' => array( - 'sqlite1' => array('driver' => 'pdo_sqlite', 'memory' => true), - 'sqlite2' => array('driver' => 'pdo_sqlite', 'path' => sys_get_temp_dir().'/silex'), - ), - )); + $app->register(new DoctrineServiceProvider(), [ + 'dbs.options' => [ + 'sqlite1' => ['driver' => 'pdo_sqlite', 'memory' => true], + 'sqlite2' => ['driver' => 'pdo_sqlite', 'path' => sys_get_temp_dir().'/silex'], + ], + ]); $db = $app['db']; $params = $db->getParams(); @@ -88,13 +88,13 @@ class DoctrineServiceProviderTest extends TestCase } $app = new Application(); - $this->assertTrue(isset($app['logger'])); + $this->assertArrayHasKey('logger', $app); $this->assertNull($app['logger']); - $app->register(new DoctrineServiceProvider(), array( - 'dbs.options' => array( - 'sqlite1' => array('driver' => 'pdo_sqlite', 'memory' => true), - ), - )); + $app->register(new DoctrineServiceProvider(), [ + 'dbs.options' => [ + 'sqlite1' => ['driver' => 'pdo_sqlite', 'memory' => true], + ], + ]); $this->assertEquals(22, $app['db']->fetchColumn('SELECT 22')); $this->assertNull($app['db']->getConfiguration()->getSQLLogger()); } @@ -106,11 +106,11 @@ class DoctrineServiceProviderTest extends TestCase } $app = new Container(); - $app->register(new DoctrineServiceProvider(), array( - 'dbs.options' => array( - 'sqlite1' => array('driver' => 'pdo_sqlite', 'memory' => true), - ), - )); + $app->register(new DoctrineServiceProvider(), [ + 'dbs.options' => [ + 'sqlite1' => ['driver' => 'pdo_sqlite', 'memory' => true], + ], + ]); $this->assertEquals(22, $app['db']->fetchColumn('SELECT 22')); $this->assertNull($app['db']->getConfiguration()->getSQLLogger()); } diff --git a/vendor/silex/silex/tests/Silex/Tests/Provider/FormServiceProviderTest.php b/vendor/silex/silex/tests/Silex/Tests/Provider/FormServiceProviderTest.php index 981826e6..30fae97d 100644 --- a/vendor/silex/silex/tests/Silex/Tests/Provider/FormServiceProviderTest.php +++ b/vendor/silex/silex/tests/Silex/Tests/Provider/FormServiceProviderTest.php @@ -54,7 +54,7 @@ class FormServiceProviderTest extends TestCase return $extensions; }); - $form = $app['form.factory']->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', array()) + $form = $app['form.factory']->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', []) ->add('dummy', 'Silex\Tests\Provider\DummyFormType') ->getForm(); @@ -77,7 +77,7 @@ class FormServiceProviderTest extends TestCase }); $form = $app['form.factory'] - ->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', array()) + ->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', []) ->add('dummy', 'dummy') ->getForm(); @@ -101,7 +101,7 @@ class FormServiceProviderTest extends TestCase }); $app['form.factory'] - ->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', array()) + ->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', []) ->add('dummy', 'dummy') ->getForm(); } @@ -118,8 +118,8 @@ class FormServiceProviderTest extends TestCase return $extensions; }); - $form = $app['form.factory']->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', array()) - ->add('file', 'Symfony\Component\Form\Extension\Core\Type\FileType', array('image_path' => 'webPath')) + $form = $app['form.factory']->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', []) + ->add('file', 'Symfony\Component\Form\Extension\Core\Type\FileType', ['image_path' => 'webPath']) ->getForm(); $this->assertInstanceOf('Symfony\Component\Form\Form', $form); @@ -141,8 +141,8 @@ class FormServiceProviderTest extends TestCase }); $form = $app['form.factory'] - ->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', array()) - ->add('file', 'Symfony\Component\Form\Extension\Core\Type\FileType', array('image_path' => 'webPath')) + ->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', []) + ->add('file', 'Symfony\Component\Form\Extension\Core\Type\FileType', ['image_path' => 'webPath']) ->getForm(); $this->assertInstanceOf('Symfony\Component\Form\Form', $form); @@ -165,7 +165,7 @@ class FormServiceProviderTest extends TestCase }); $app['form.factory'] - ->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', array()) + ->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', []) ->add('dummy', 'dummy.form.type') ->getForm(); } @@ -177,7 +177,7 @@ class FormServiceProviderTest extends TestCase $app->register(new FormServiceProvider()); $app->extend('form.type.guessers', function ($guessers) { - $guessers[] = new FormTypeGuesserChain(array()); + $guessers[] = new FormTypeGuesserChain([]); return $guessers; }); @@ -192,7 +192,7 @@ class FormServiceProviderTest extends TestCase $app->register(new FormServiceProvider()); $app['dummy.form.type.guesser'] = function () { - return new FormTypeGuesserChain(array()); + return new FormTypeGuesserChain([]); }; $app->extend('form.type.guessers', function ($guessers) { $guessers[] = 'dummy.form.type.guesser'; @@ -228,25 +228,25 @@ class FormServiceProviderTest extends TestCase $app->register(new FormServiceProvider()); $app->register(new TranslationServiceProvider()); - $app['translator.domains'] = array( - 'messages' => array( - 'de' => array( + $app['translator.domains'] = [ + 'messages' => [ + 'de' => [ 'The CSRF token is invalid. Please try to resubmit the form.' => 'German translation', - ), - ), - ); + ], + ], + ]; $app['locale'] = 'de'; $app['csrf.token_manager'] = function () { return $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock(); }; - $form = $app['form.factory']->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', array()) + $form = $app['form.factory']->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', []) ->getForm(); - $form->handleRequest($req = Request::create('/', 'POST', array('form' => array( + $form->handleRequest($req = Request::create('/', 'POST', ['form' => [ '_token' => 'the wrong token', - )))); + ]])); $this->assertFalse($form->isValid()); $r = new \ReflectionMethod($form, 'getErrors'); @@ -260,21 +260,22 @@ class FormServiceProviderTest extends TestCase public function testFormServiceProviderWillNotAddNonexistentTranslationFiles() { - $app = new Application(array( + $app = new Application([ 'locale' => 'nonexistent', - )); + ]); $app->register(new FormServiceProvider()); $app->register(new ValidatorServiceProvider()); - $app->register(new TranslationServiceProvider(), array( - 'locale_fallbacks' => array(), - )); + $app->register(new TranslationServiceProvider(), [ + 'locale_fallbacks' => [], + ]); $app['form.factory']; $translator = $app['translator']; try { $translator->trans('test'); + $this->addToAssertionCount(1); } catch (NotFoundResourceException $e) { $this->fail('Form factory should not add a translation resource that does not exist'); } @@ -288,7 +289,7 @@ class FormServiceProviderTest extends TestCase $app->register(new CsrfServiceProvider()); $app['session.test'] = true; - $form = $app['form.factory']->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', array())->getForm(); + $form = $app['form.factory']->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', [])->getForm(); $this->assertTrue(isset($form->createView()['_token'])); } @@ -306,7 +307,7 @@ class FormServiceProviderTest extends TestCase return $extensions; }); - $form = $app['form.factory']->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', array())->getForm(); + $form = $app['form.factory']->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', [])->getForm(); $this->assertFalse($form->getConfig()->getOption('csrf_protection')); } @@ -340,7 +341,7 @@ if (method_exists('Symfony\Component\Form\AbstractType', 'configureOptions')) { public function configureOptions(OptionsResolver $resolver) { - $resolver->setDefined(array('image_path')); + $resolver->setDefined(['image_path']); } } } else { @@ -354,9 +355,9 @@ if (method_exists('Symfony\Component\Form\AbstractType', 'configureOptions')) { public function setDefaultOptions(OptionsResolverInterface $resolver) { if (!method_exists($resolver, 'setDefined')) { - $resolver->setOptional(array('image_path')); + $resolver->setOptional(['image_path']); } else { - $resolver->setDefined(array('image_path')); + $resolver->setDefined(['image_path']); } } } diff --git a/vendor/silex/silex/tests/Silex/Tests/Provider/FormServiceProviderTest/DisableCsrfExtension.php b/vendor/silex/silex/tests/Silex/Tests/Provider/FormServiceProviderTest/DisableCsrfExtension.php index 8c82237d..ec55da1e 100644 --- a/vendor/silex/silex/tests/Silex/Tests/Provider/FormServiceProviderTest/DisableCsrfExtension.php +++ b/vendor/silex/silex/tests/Silex/Tests/Provider/FormServiceProviderTest/DisableCsrfExtension.php @@ -10,9 +10,9 @@ class DisableCsrfExtension extends AbstractTypeExtension { public function configureOptions(OptionsResolver $resolver) { - $resolver->setDefaults(array( + $resolver->setDefaults([ 'csrf_protection' => false, - )); + ]); } public function getExtendedType() diff --git a/vendor/silex/silex/tests/Silex/Tests/Provider/HttpCacheServiceProviderTest.php b/vendor/silex/silex/tests/Silex/Tests/Provider/HttpCacheServiceProviderTest.php index dca3f6a8..3b903ee1 100644 --- a/vendor/silex/silex/tests/Silex/Tests/Provider/HttpCacheServiceProviderTest.php +++ b/vendor/silex/silex/tests/Silex/Tests/Provider/HttpCacheServiceProviderTest.php @@ -28,9 +28,9 @@ class HttpCacheServiceProviderTest extends TestCase { $app = new Application(); - $app->register(new HttpCacheServiceProvider(), array( + $app->register(new HttpCacheServiceProvider(), [ 'http_cache.cache_dir' => sys_get_temp_dir().'/silex_http_cache_'.uniqid(), - )); + ]); $this->assertInstanceOf('Silex\Provider\HttpCache\HttpCache', $app['http_cache']); @@ -62,9 +62,9 @@ class HttpCacheServiceProviderTest extends TestCase { $app = new Application(); - $app->register(new HttpCacheServiceProvider(), array( + $app->register(new HttpCacheServiceProvider(), [ 'http_cache.cache_dir' => sys_get_temp_dir().'/silex_http_cache_'.uniqid(), - )); + ]); $app['debug'] = true; $app['http_cache']; diff --git a/vendor/silex/silex/tests/Silex/Tests/Provider/HttpFragmentServiceProviderTest.php b/vendor/silex/silex/tests/Silex/Tests/Provider/HttpFragmentServiceProviderTest.php index 6e12fcc5..6f4bab10 100644 --- a/vendor/silex/silex/tests/Silex/Tests/Provider/HttpFragmentServiceProviderTest.php +++ b/vendor/silex/silex/tests/Silex/Tests/Provider/HttpFragmentServiceProviderTest.php @@ -26,13 +26,13 @@ class HttpFragmentServiceProviderTest extends TestCase unset($app['exception_handler']); $app->register(new HttpFragmentServiceProvider()); - $app->register(new HttpCacheServiceProvider(), array('http_cache.cache_dir' => sys_get_temp_dir())); - $app->register(new TwigServiceProvider(), array( - 'twig.templates' => array( + $app->register(new HttpCacheServiceProvider(), ['http_cache.cache_dir' => sys_get_temp_dir()]); + $app->register(new TwigServiceProvider(), [ + 'twig.templates' => [ 'hello' => '{{ render("/foo") }}{{ render_esi("/foo") }}{{ render_hinclude("/foo") }}', 'foo' => 'foo', - ), - )); + ], + ]); $app->get('/hello', function () use ($app) { return $app['twig']->render('hello'); diff --git a/vendor/silex/silex/tests/Silex/Tests/Provider/MonologServiceProviderTest.php b/vendor/silex/silex/tests/Silex/Tests/Provider/MonologServiceProviderTest.php index 4585378f..eca21f0a 100644 --- a/vendor/silex/silex/tests/Silex/Tests/Provider/MonologServiceProviderTest.php +++ b/vendor/silex/silex/tests/Silex/Tests/Provider/MonologServiceProviderTest.php @@ -87,10 +87,10 @@ class MonologServiceProviderTest extends TestCase { $app = new Application(); - $app->register(new MonologServiceProvider(), array( + $app->register(new MonologServiceProvider(), [ 'monolog.formatter' => new JsonFormatter(), 'monolog.logfile' => 'php://memory', - )); + ]); $this->assertInstanceOf('Monolog\Formatter\JsonFormatter', $app['monolog.handler']->getFormatter()); } @@ -151,15 +151,15 @@ class MonologServiceProviderTest extends TestCase $app = $this->getApplication(); $app['monolog.level'] = Logger::ERROR; - $app->register(new \Silex\Provider\SecurityServiceProvider(), array( - 'security.firewalls' => array( - 'admin' => array( + $app->register(new \Silex\Provider\SecurityServiceProvider(), [ + 'security.firewalls' => [ + 'admin' => [ 'pattern' => '^/admin', 'http' => true, - 'users' => array(), - ), - ), - )); + 'users' => [], + ], + ], + ]); $app->get('/admin', function () { return 'SECURE!'; @@ -209,7 +209,7 @@ class MonologServiceProviderTest extends TestCase }); $level = Logger::ERROR; - $app->register(new MonologServiceProvider(), array( + $app->register(new MonologServiceProvider(), [ 'monolog.exception.logger_filter' => $app->protect(function () { return Logger::DEBUG; }), @@ -218,7 +218,7 @@ class MonologServiceProviderTest extends TestCase }, 'monolog.level' => $level, 'monolog.logfile' => 'php://memory', - )); + ]); $request = Request::create('/foo'); $app->handle($request); @@ -243,14 +243,14 @@ class MonologServiceProviderTest extends TestCase { $app = new Application(); - $app->register(new MonologServiceProvider(), array( + $app->register(new MonologServiceProvider(), [ 'monolog.handler' => function () use ($app) { $level = MonologServiceProvider::translateLevel($app['monolog.level']); return new TestHandler($level); }, 'monolog.logfile' => 'php://memory', - )); + ]); return $app; } diff --git a/vendor/silex/silex/tests/Silex/Tests/Provider/RememberMeServiceProviderTest.php b/vendor/silex/silex/tests/Silex/Tests/Provider/RememberMeServiceProviderTest.php index b027497c..a673ac62 100644 --- a/vendor/silex/silex/tests/Silex/Tests/Provider/RememberMeServiceProviderTest.php +++ b/vendor/silex/silex/tests/Silex/Tests/Provider/RememberMeServiceProviderTest.php @@ -31,13 +31,13 @@ class RememberMeServiceProviderTest extends WebTestCase $app = $this->createApplication(); $interactiveLogin = new InteractiveLoginTriggered(); - $app->on(SecurityEvents::INTERACTIVE_LOGIN, array($interactiveLogin, 'onInteractiveLogin')); + $app->on(SecurityEvents::INTERACTIVE_LOGIN, [$interactiveLogin, 'onInteractiveLogin']); $client = new Client($app); $client->request('get', '/'); $this->assertFalse($interactiveLogin->triggered, 'The interactive login has not been triggered yet'); - $client->request('post', '/login_check', array('_username' => 'fabien', '_password' => 'foo', '_remember_me' => 'true')); + $client->request('post', '/login_check', ['_username' => 'fabien', '_password' => 'foo', '_remember_me' => 'true']); $client->followRedirect(); $this->assertEquals('AUTHENTICATED_FULLY', $client->getResponse()->getContent()); $this->assertTrue($interactiveLogin->triggered, 'The interactive login has been triggered'); @@ -64,23 +64,23 @@ class RememberMeServiceProviderTest extends WebTestCase $app['debug'] = true; unset($app['exception_handler']); - $app->register(new SessionServiceProvider(), array( + $app->register(new SessionServiceProvider(), [ 'session.test' => true, - )); + ]); $app->register(new SecurityServiceProvider()); $app->register(new RememberMeServiceProvider()); - $app['security.firewalls'] = array( - 'http-auth' => array( + $app['security.firewalls'] = [ + 'http-auth' => [ 'pattern' => '^.*$', 'form' => true, - 'remember_me' => array(), + 'remember_me' => [], 'logout' => true, - 'users' => array( - 'fabien' => array('ROLE_USER', '$2y$15$lzUNsTegNXvZW3qtfucV0erYBcEqWVeyOmjolB7R1uodsAVJ95vvu'), - ), - ), - ); + 'users' => [ + 'fabien' => ['ROLE_USER', '$2y$15$lzUNsTegNXvZW3qtfucV0erYBcEqWVeyOmjolB7R1uodsAVJ95vvu'], + ], + ], + ]; $app->get('/', function () use ($app) { if ($app['security.authorization_checker']->isGranted('IS_AUTHENTICATED_FULLY')) { diff --git a/vendor/silex/silex/tests/Silex/Tests/Provider/RoutingServiceProviderTest.php b/vendor/silex/silex/tests/Silex/Tests/Provider/RoutingServiceProviderTest.php index 2faaa683..fc30e6ed 100644 --- a/vendor/silex/silex/tests/Silex/Tests/Provider/RoutingServiceProviderTest.php +++ b/vendor/silex/silex/tests/Silex/Tests/Provider/RoutingServiceProviderTest.php @@ -48,7 +48,7 @@ class RoutingServiceProviderTest extends TestCase ->bind('hello'); $app->get('/', function () use ($app) { - return $app['url_generator']->generate('hello', array('name' => 'john')); + return $app['url_generator']->generate('hello', ['name' => 'john']); }); $request = Request::create('/'); @@ -65,7 +65,7 @@ class RoutingServiceProviderTest extends TestCase ->bind('hello'); $app->get('/', function () use ($app) { - return $app['url_generator']->generate('hello', array('name' => 'john'), UrlGeneratorInterface::ABSOLUTE_URL); + return $app['url_generator']->generate('hello', ['name' => 'john'], UrlGeneratorInterface::ABSOLUTE_URL); }); $request = Request::create('https://localhost:81/'); diff --git a/vendor/silex/silex/tests/Silex/Tests/Provider/SecurityServiceProviderTest.php b/vendor/silex/silex/tests/Silex/Tests/Provider/SecurityServiceProviderTest.php index 3436c53b..b52040c0 100644 --- a/vendor/silex/silex/tests/Silex/Tests/Provider/SecurityServiceProviderTest.php +++ b/vendor/silex/silex/tests/Silex/Tests/Provider/SecurityServiceProviderTest.php @@ -33,14 +33,14 @@ class SecurityServiceProviderTest extends WebTestCase public function testWrongAuthenticationType() { $app = new Application(); - $app->register(new SecurityServiceProvider(), array( - 'security.firewalls' => array( - 'wrong' => array( + $app->register(new SecurityServiceProvider(), [ + 'security.firewalls' => [ + 'wrong' => [ 'foobar' => true, - 'users' => array(), - ), - ), - )); + 'users' => [], + ], + ], + ]); $app->get('/', function () {}); $app->handle(Request::create('/')); } @@ -54,12 +54,12 @@ class SecurityServiceProviderTest extends WebTestCase $client->request('get', '/'); $this->assertEquals('ANONYMOUS', $client->getResponse()->getContent()); - $client->request('post', '/login_check', array('_username' => 'fabien', '_password' => 'bar')); + $client->request('post', '/login_check', ['_username' => 'fabien', '_password' => 'bar']); $this->assertContains('Bad credentials', $app['security.last_error']($client->getRequest())); // hack to re-close the session as the previous assertions re-opens it $client->getRequest()->getSession()->save(); - $client->request('post', '/login_check', array('_username' => 'fabien', '_password' => 'foo')); + $client->request('post', '/login_check', ['_username' => 'fabien', '_password' => 'foo']); $this->assertEquals('', $app['security.last_error']($client->getRequest())); $client->getRequest()->getSession()->save(); $this->assertEquals(302, $client->getResponse()->getStatusCode()); @@ -81,7 +81,7 @@ class SecurityServiceProviderTest extends WebTestCase $this->assertEquals(302, $client->getResponse()->getStatusCode()); $this->assertEquals('http://localhost/login', $client->getResponse()->getTargetUrl()); - $client->request('post', '/login_check', array('_username' => 'admin', '_password' => 'foo')); + $client->request('post', '/login_check', ['_username' => 'admin', '_password' => 'foo']); $this->assertEquals('', $app['security.last_error']($client->getRequest())); $client->getRequest()->getSession()->save(); $this->assertEquals(302, $client->getResponse()->getStatusCode()); @@ -103,7 +103,7 @@ class SecurityServiceProviderTest extends WebTestCase $this->assertEquals(401, $client->getResponse()->getStatusCode()); $this->assertEquals('Basic realm="Secured"', $client->getResponse()->headers->get('www-authenticate')); - $client->request('get', '/', array(), array(), array('PHP_AUTH_USER' => 'dennis', 'PHP_AUTH_PW' => 'foo')); + $client->request('get', '/', [], [], ['PHP_AUTH_USER' => 'dennis', 'PHP_AUTH_PW' => 'foo']); $this->assertEquals('dennisAUTHENTICATED', $client->getResponse()->getContent()); $client->request('get', '/admin'); $this->assertEquals(403, $client->getResponse()->getStatusCode()); @@ -114,7 +114,7 @@ class SecurityServiceProviderTest extends WebTestCase $this->assertEquals(401, $client->getResponse()->getStatusCode()); $this->assertEquals('Basic realm="Secured"', $client->getResponse()->headers->get('www-authenticate')); - $client->request('get', '/', array(), array(), array('PHP_AUTH_USER' => 'admin', 'PHP_AUTH_PW' => 'foo')); + $client->request('get', '/', [], [], ['PHP_AUTH_USER' => 'admin', 'PHP_AUTH_PW' => 'foo']); $this->assertEquals('adminAUTHENTICATEDADMIN', $client->getResponse()->getContent()); $client->request('get', '/admin'); $this->assertEquals('admin', $client->getResponse()->getContent()); @@ -130,15 +130,15 @@ class SecurityServiceProviderTest extends WebTestCase $this->assertEquals(401, $client->getResponse()->getStatusCode(), 'The entry point is configured'); $this->assertEquals('{"message":"Authentication Required"}', $client->getResponse()->getContent()); - $client->request('get', '/', array(), array(), array('HTTP_X_AUTH_TOKEN' => 'lili:not the secret')); + $client->request('get', '/', [], [], ['HTTP_X_AUTH_TOKEN' => 'lili:not the secret']); $this->assertEquals(403, $client->getResponse()->getStatusCode(), 'User not found'); $this->assertEquals('{"message":"Username could not be found."}', $client->getResponse()->getContent()); - $client->request('get', '/', array(), array(), array('HTTP_X_AUTH_TOKEN' => 'victoria:not the secret')); + $client->request('get', '/', [], [], ['HTTP_X_AUTH_TOKEN' => 'victoria:not the secret']); $this->assertEquals(403, $client->getResponse()->getStatusCode(), 'Invalid credentials'); $this->assertEquals('{"message":"Invalid credentials."}', $client->getResponse()->getContent()); - $client->request('get', '/', array(), array(), array('HTTP_X_AUTH_TOKEN' => 'victoria:victoriasecret')); + $client->request('get', '/', [], [], ['HTTP_X_AUTH_TOKEN' => 'victoria:victoriasecret']); $this->assertEquals('victoria', $client->getResponse()->getContent()); } @@ -146,18 +146,18 @@ class SecurityServiceProviderTest extends WebTestCase { $app = new Application(); - $app->register(new ValidatorServiceProvider()); - $app->register(new SecurityServiceProvider(), array( - 'security.firewalls' => array( - 'admin' => array( + $app->register(new SecurityServiceProvider(), [ + 'security.firewalls' => [ + 'admin' => [ 'pattern' => '^/admin', 'http' => true, - 'users' => array( - 'admin' => array('ROLE_ADMIN', '513aeb0121909'), - ), - ), - ), - )); + 'users' => [ + 'admin' => ['ROLE_ADMIN', '513aeb0121909'], + ], + ], + ], + ]); + $app->register(new ValidatorServiceProvider()); $app->boot(); @@ -174,11 +174,11 @@ class SecurityServiceProviderTest extends WebTestCase $client->request('get', '/'); $this->assertEquals('ANONYMOUS', $client->getResponse()->getContent()); - $client->request('post', '/login_check', array('_username' => 'fabien', '_password' => 'bar')); + $client->request('post', '/login_check', ['_username' => 'fabien', '_password' => 'bar']); $this->assertEquals('The presented password is invalid.', $app['security.last_error']($client->getRequest())); $client->getRequest()->getSession()->save(); - $client->request('post', '/login_check', array('_username' => 'unknown', '_password' => 'bar')); + $client->request('post', '/login_check', ['_username' => 'unknown', '_password' => 'bar']); $this->assertEquals('Username "unknown" does not exist.', $app['security.last_error']($client->getRequest())); $client->getRequest()->getSession()->save(); } @@ -187,13 +187,13 @@ class SecurityServiceProviderTest extends WebTestCase { $app = new Application(); - $app->register(new SecurityServiceProvider(), array( - 'security.firewalls' => array( - 'admin' => array( + $app->register(new SecurityServiceProvider(), [ + 'security.firewalls' => [ + 'admin' => [ 'logout' => true, - ), - ), - )); + ], + ], + ]); $app->boot(); $app->flush(); @@ -204,15 +204,15 @@ class SecurityServiceProviderTest extends WebTestCase public function testFirewallWithMethod() { $app = new Application(); - $app->register(new SecurityServiceProvider(), array( - 'security.firewalls' => array( - 'default' => array( + $app->register(new SecurityServiceProvider(), [ + 'security.firewalls' => [ + 'default' => [ 'pattern' => '/', 'http' => true, - 'methods' => array('POST'), - ), - ), - )); + 'methods' => ['POST'], + ], + ], + ]); $app->match('/', function () { return 'foo'; }) ->method('POST|GET'); @@ -228,15 +228,15 @@ class SecurityServiceProviderTest extends WebTestCase public function testFirewallWithHost() { $app = new Application(); - $app->register(new SecurityServiceProvider(), array( - 'security.firewalls' => array( - 'default' => array( + $app->register(new SecurityServiceProvider(), [ + 'security.firewalls' => [ + 'default' => [ 'pattern' => '/', 'http' => true, 'hosts' => 'localhost2', - ), - ), - )); + ], + ], + ]); $app->get('/', function () { return 'foo'; }) ->host('localhost2'); @@ -255,16 +255,16 @@ class SecurityServiceProviderTest extends WebTestCase public function testUser() { $app = new Application(); - $app->register(new SecurityServiceProvider(), array( - 'security.firewalls' => array( - 'default' => array( + $app->register(new SecurityServiceProvider(), [ + 'security.firewalls' => [ + 'default' => [ 'http' => true, - 'users' => array( - 'fabien' => array('ROLE_ADMIN', '$2y$15$lzUNsTegNXvZW3qtfucV0erYBcEqWVeyOmjolB7R1uodsAVJ95vvu'), - ), - ), - ), - )); + 'users' => [ + 'fabien' => ['ROLE_ADMIN', '$2y$15$lzUNsTegNXvZW3qtfucV0erYBcEqWVeyOmjolB7R1uodsAVJ95vvu'], + ], + ], + ], + ]); $app->get('/', function () { return 'foo'; }); $request = Request::create('/'); @@ -281,13 +281,13 @@ class SecurityServiceProviderTest extends WebTestCase public function testUserWithNoToken() { $app = new Application(); - $app->register(new SecurityServiceProvider(), array( - 'security.firewalls' => array( - 'default' => array( + $app->register(new SecurityServiceProvider(), [ + 'security.firewalls' => [ + 'default' => [ 'http' => true, - ), - ), - )); + ], + ], + ]); $request = Request::create('/'); @@ -299,13 +299,13 @@ class SecurityServiceProviderTest extends WebTestCase public function testUserWithInvalidUser() { $app = new Application(); - $app->register(new SecurityServiceProvider(), array( - 'security.firewalls' => array( - 'default' => array( + $app->register(new SecurityServiceProvider(), [ + 'security.firewalls' => [ + 'default' => [ 'http' => true, - ), - ), - )); + ], + ], + ]); $request = Request::create('/'); $app->boot(); @@ -319,26 +319,26 @@ class SecurityServiceProviderTest extends WebTestCase public function testAccessRulePathArray() { $app = new Application(); - $app->register(new SecurityServiceProvider(), array( - 'security.firewalls' => array( - 'default' => array( + $app->register(new SecurityServiceProvider(), [ + 'security.firewalls' => [ + 'default' => [ 'http' => true, - ), - ), - 'security.access_rules' => array( - array(array( + ], + ], + 'security.access_rules' => [ + [[ 'path' => '^/admin', - ), 'ROLE_ADMIN'), - ), - )); + ], 'ROLE_ADMIN'], + ], + ]); $request = Request::create('/admin'); $app->boot(); $accessMap = $app['security.access_map']; - $this->assertEquals($accessMap->getPatterns($request), array( - array('ROLE_ADMIN'), + $this->assertEquals($accessMap->getPatterns($request), [ + ['ROLE_ADMIN'], '', - )); + ]); } public function createApplication($authenticationMethod = 'form') @@ -346,7 +346,7 @@ class SecurityServiceProviderTest extends WebTestCase $app = new Application(); $app->register(new SessionServiceProvider()); - $app = call_user_func(array($this, 'add'.ucfirst($authenticationMethod).'Authentication'), $app); + $app = call_user_func([$this, 'add'.ucfirst($authenticationMethod).'Authentication'], $app); $app['session.test'] = true; @@ -355,32 +355,32 @@ class SecurityServiceProviderTest extends WebTestCase private function addFormAuthentication($app) { - $app->register(new SecurityServiceProvider(), array( - 'security.firewalls' => array( - 'login' => array( + $app->register(new SecurityServiceProvider(), [ + 'security.firewalls' => [ + 'login' => [ 'pattern' => '^/login$', - ), - 'default' => array( + ], + 'default' => [ 'pattern' => '^.*$', 'anonymous' => true, - 'form' => array( + 'form' => [ 'require_previous_session' => false, - ), + ], 'logout' => true, - 'users' => array( + 'users' => [ // password is foo - 'fabien' => array('ROLE_USER', '$2y$15$lzUNsTegNXvZW3qtfucV0erYBcEqWVeyOmjolB7R1uodsAVJ95vvu'), - 'admin' => array('ROLE_ADMIN', '$2y$15$lzUNsTegNXvZW3qtfucV0erYBcEqWVeyOmjolB7R1uodsAVJ95vvu'), - ), - ), - ), - 'security.access_rules' => array( - array('^/admin', 'ROLE_ADMIN'), - ), - 'security.role_hierarchy' => array( - 'ROLE_ADMIN' => array('ROLE_USER'), - ), - )); + 'fabien' => ['ROLE_USER', '$2y$15$lzUNsTegNXvZW3qtfucV0erYBcEqWVeyOmjolB7R1uodsAVJ95vvu'], + 'admin' => ['ROLE_ADMIN', '$2y$15$lzUNsTegNXvZW3qtfucV0erYBcEqWVeyOmjolB7R1uodsAVJ95vvu'], + ], + ], + ], + 'security.access_rules' => [ + ['^/admin', 'ROLE_ADMIN'], + ], + 'security.role_hierarchy' => [ + 'ROLE_ADMIN' => ['ROLE_USER'], + ], + ]); $app->get('/login', function (Request $request) use ($app) { $app['session']->start(); @@ -413,25 +413,25 @@ class SecurityServiceProviderTest extends WebTestCase private function addHttpAuthentication($app) { - $app->register(new SecurityServiceProvider(), array( - 'security.firewalls' => array( - 'http-auth' => array( + $app->register(new SecurityServiceProvider(), [ + 'security.firewalls' => [ + 'http-auth' => [ 'pattern' => '^.*$', 'http' => true, - 'users' => array( + 'users' => [ // password is foo - 'dennis' => array('ROLE_USER', '$2y$15$lzUNsTegNXvZW3qtfucV0erYBcEqWVeyOmjolB7R1uodsAVJ95vvu'), - 'admin' => array('ROLE_ADMIN', '$2y$15$lzUNsTegNXvZW3qtfucV0erYBcEqWVeyOmjolB7R1uodsAVJ95vvu'), - ), - ), - ), - 'security.access_rules' => array( - array('^/admin', 'ROLE_ADMIN'), - ), - 'security.role_hierarchy' => array( - 'ROLE_ADMIN' => array('ROLE_USER'), - ), - )); + 'dennis' => ['ROLE_USER', '$2y$15$lzUNsTegNXvZW3qtfucV0erYBcEqWVeyOmjolB7R1uodsAVJ95vvu'], + 'admin' => ['ROLE_ADMIN', '$2y$15$lzUNsTegNXvZW3qtfucV0erYBcEqWVeyOmjolB7R1uodsAVJ95vvu'], + ], + ], + ], + 'security.access_rules' => [ + ['^/admin', 'ROLE_ADMIN'], + ], + 'security.role_hierarchy' => [ + 'ROLE_ADMIN' => ['ROLE_USER'], + ], + ]); $app->get('/', function () use ($app) { $user = $app['security.token_storage']->getToken()->getUser(); @@ -461,22 +461,22 @@ class SecurityServiceProviderTest extends WebTestCase return new SecurityServiceProviderTest\TokenAuthenticator($app); }; - $app->register(new SecurityServiceProvider(), array( - 'security.firewalls' => array( - 'guard' => array( + $app->register(new SecurityServiceProvider(), [ + 'security.firewalls' => [ + 'guard' => [ 'pattern' => '^.*$', 'form' => true, - 'guard' => array( - 'authenticators' => array( + 'guard' => [ + 'authenticators' => [ 'app.authenticator.token', - ), - ), - 'users' => array( - 'victoria' => array('ROLE_USER', 'victoriasecret'), - ), - ), - ), - )); + ], + ], + 'users' => [ + 'victoria' => ['ROLE_USER', 'victoriasecret'], + ], + ], + ], + ]); $app->get('/', function () use ($app) { $user = $app['security.token_storage']->getToken()->getUser(); diff --git a/vendor/silex/silex/tests/Silex/Tests/Provider/SecurityServiceProviderTest/TokenAuthenticator.php b/vendor/silex/silex/tests/Silex/Tests/Provider/SecurityServiceProviderTest/TokenAuthenticator.php index c569428b..3435fd12 100644 --- a/vendor/silex/silex/tests/Silex/Tests/Provider/SecurityServiceProviderTest/TokenAuthenticator.php +++ b/vendor/silex/silex/tests/Silex/Tests/Provider/SecurityServiceProviderTest/TokenAuthenticator.php @@ -13,6 +13,7 @@ namespace Silex\Tests\Provider\SecurityServiceProviderTest; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\JsonResponse; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Security\Core\User\UserProviderInterface; use Symfony\Component\Security\Guard\AbstractGuardAuthenticator; @@ -27,15 +28,20 @@ class TokenAuthenticator extends AbstractGuardAuthenticator public function getCredentials(Request $request) { if (!$token = $request->headers->get('X-AUTH-TOKEN')) { - return; + return Kernel::VERSION_ID < 30400 ? null : false; } list($username, $secret) = explode(':', $token); - return array( + return [ 'username' => $username, 'secret' => $secret, - ); + ]; + } + + public function supports(Request $request) + { + return !empty($request->headers->get('X-AUTH-TOKEN')); } public function getUser($credentials, UserProviderInterface $userProvider) @@ -56,18 +62,18 @@ class TokenAuthenticator extends AbstractGuardAuthenticator public function onAuthenticationFailure(Request $request, AuthenticationException $exception) { - $data = array( + $data = [ 'message' => strtr($exception->getMessageKey(), $exception->getMessageData()), - ); + ]; return new JsonResponse($data, 403); } public function start(Request $request, AuthenticationException $authException = null) { - $data = array( + $data = [ 'message' => 'Authentication Required', - ); + ]; return new JsonResponse($data, 401); } diff --git a/vendor/silex/silex/tests/Silex/Tests/Provider/SessionServiceProviderTest.php b/vendor/silex/silex/tests/Silex/Tests/Provider/SessionServiceProviderTest.php index fb7ae0cf..9c1e342b 100644 --- a/vendor/silex/silex/tests/Silex/Tests/Provider/SessionServiceProviderTest.php +++ b/vendor/silex/silex/tests/Silex/Tests/Provider/SessionServiceProviderTest.php @@ -27,11 +27,6 @@ class SessionServiceProviderTest extends WebTestCase { public function testRegister() { - /* - * Smoke test - */ - $defaultStorage = $this->app['session.storage.native']; - $client = $this->createClient(); $client->request('get', '/login'); @@ -51,9 +46,9 @@ class SessionServiceProviderTest extends WebTestCase { $app = new Application(); - $app->register(new SessionServiceProvider(), array( + $app->register(new SessionServiceProvider(), [ 'session.test' => true, - )); + ]); $app->get('/login', function () use ($app) { $app['session']->set('logged_in', true); @@ -82,9 +77,9 @@ class SessionServiceProviderTest extends WebTestCase { $app = new Application(); - $app->register(new SessionServiceProvider(), array( + $app->register(new SessionServiceProvider(), [ 'session.test' => true, - )); + ]); $app->get('/', function () { return 'A welcome page.'; @@ -112,11 +107,11 @@ class SessionServiceProviderTest extends WebTestCase $attrs = new Session\Attribute\AttributeBag(); $flash = new Session\Flash\FlashBag(); - $app->register(new SessionServiceProvider(), array( + $app->register(new SessionServiceProvider(), [ 'session.attribute_bag' => $attrs, 'session.flash_bag' => $flash, 'session.test' => true, - )); + ]); $session = $app['session']; diff --git a/vendor/silex/silex/tests/Silex/Tests/Provider/SpoolStub.php b/vendor/silex/silex/tests/Silex/Tests/Provider/SpoolStub.php index c1eb2b0f..753e5974 100644 --- a/vendor/silex/silex/tests/Silex/Tests/Provider/SpoolStub.php +++ b/vendor/silex/silex/tests/Silex/Tests/Provider/SpoolStub.php @@ -13,7 +13,7 @@ namespace Silex\Tests\Provider; class SpoolStub implements \Swift_Spool { - private $messages = array(); + private $messages = []; public $hasFlushed = false; public function getMessages() @@ -42,6 +42,6 @@ class SpoolStub implements \Swift_Spool public function flushQueue(\Swift_Transport $transport, &$failedRecipients = null) { $this->hasFlushed = true; - $this->messages = array(); + $this->messages = []; } } diff --git a/vendor/silex/silex/tests/Silex/Tests/Provider/SwiftmailerServiceProviderTest.php b/vendor/silex/silex/tests/Silex/Tests/Provider/SwiftmailerServiceProviderTest.php index f80c2256..3dbf6b0c 100644 --- a/vendor/silex/silex/tests/Silex/Tests/Provider/SwiftmailerServiceProviderTest.php +++ b/vendor/silex/silex/tests/Silex/Tests/Provider/SwiftmailerServiceProviderTest.php @@ -124,7 +124,7 @@ class SwiftmailerServiceProviderTest extends TestCase $app->register(new SwiftmailerServiceProvider()); $app['swiftmailer.plugins'] = function ($app) use ($plugin) { - return array($plugin); + return [$plugin]; }; $dispatcher = $app['swiftmailer.transport.eventdispatcher']; diff --git a/vendor/silex/silex/tests/Silex/Tests/Provider/TranslationServiceProviderTest.php b/vendor/silex/silex/tests/Silex/Tests/Provider/TranslationServiceProviderTest.php index b4132f9e..5c942a4d 100644 --- a/vendor/silex/silex/tests/Silex/Tests/Provider/TranslationServiceProviderTest.php +++ b/vendor/silex/silex/tests/Silex/Tests/Provider/TranslationServiceProviderTest.php @@ -34,54 +34,54 @@ class TranslationServiceProviderTest extends TestCase $app->register(new LocaleServiceProvider()); $app->register(new TranslationServiceProvider()); - $app['translator.domains'] = array( - 'messages' => array( - 'en' => array( + $app['translator.domains'] = [ + 'messages' => [ + 'en' => [ 'key1' => 'The translation', 'key_only_english' => 'Foo', 'key2' => 'One apple|%count% apples', - 'test' => array( + 'test' => [ 'key' => 'It works', - ), - ), - 'de' => array( + ], + ], + 'de' => [ 'key1' => 'The german translation', 'key2' => 'One german apple|%count% german apples', - 'test' => array( + 'test' => [ 'key' => 'It works in german', - ), - ), - ), - ); + ], + ], + ], + ]; return $app; } public function transChoiceProvider() { - return array( - array('key2', 0, null, '0 apples'), - array('key2', 1, null, 'One apple'), - array('key2', 2, null, '2 apples'), - array('key2', 0, 'de', '0 german apples'), - array('key2', 1, 'de', 'One german apple'), - array('key2', 2, 'de', '2 german apples'), - array('key2', 0, 'ru', '0 apples'), // fallback - array('key2', 1, 'ru', 'One apple'), // fallback - array('key2', 2, 'ru', '2 apples'), // fallback - ); + return [ + ['key2', 0, null, '0 apples'], + ['key2', 1, null, 'One apple'], + ['key2', 2, null, '2 apples'], + ['key2', 0, 'de', '0 german apples'], + ['key2', 1, 'de', 'One german apple'], + ['key2', 2, 'de', '2 german apples'], + ['key2', 0, 'ru', '0 apples'], // fallback + ['key2', 1, 'ru', 'One apple'], // fallback + ['key2', 2, 'ru', '2 apples'], // fallback + ]; } public function transProvider() { - return array( - array('key1', null, 'The translation'), - array('key1', 'de', 'The german translation'), - array('key1', 'ru', 'The translation'), // fallback - array('test.key', null, 'It works'), - array('test.key', 'de', 'It works in german'), - array('test.key', 'ru', 'It works'), // fallback - ); + return [ + ['key1', null, 'The translation'], + ['key1', 'de', 'The german translation'], + ['key1', 'ru', 'The translation'], // fallback + ['test.key', null, 'It works'], + ['test.key', 'de', 'It works in german'], + ['test.key', 'ru', 'It works'], // fallback + ]; } /** @@ -91,7 +91,7 @@ class TranslationServiceProviderTest extends TestCase { $app = $this->getPreparedApp(); - $result = $app['translator']->trans($key, array(), null, $locale); + $result = $app['translator']->trans($key, [], null, $locale); $this->assertEquals($expected, $result); } @@ -103,21 +103,21 @@ class TranslationServiceProviderTest extends TestCase { $app = $this->getPreparedApp(); - $result = $app['translator']->transChoice($key, $number, array('%count%' => $number), null, $locale); + $result = $app['translator']->transChoice($key, $number, ['%count%' => $number], null, $locale); $this->assertEquals($expected, $result); } public function testFallbacks() { $app = $this->getPreparedApp(); - $app['locale_fallbacks'] = array('de', 'en'); + $app['locale_fallbacks'] = ['de', 'en']; // fallback to english - $result = $app['translator']->trans('key_only_english', array(), null, 'ru'); + $result = $app['translator']->trans('key_only_english', [], null, 'ru'); $this->assertEquals('Foo', $result); // fallback to german - $result = $app['translator']->trans('key1', array(), null, 'ru'); + $result = $app['translator']->trans('key1', [], null, 'ru'); $this->assertEquals('The german translation', $result); } diff --git a/vendor/silex/silex/tests/Silex/Tests/Provider/TwigServiceProviderTest.php b/vendor/silex/silex/tests/Silex/Tests/Provider/TwigServiceProviderTest.php index 1b5aef2c..58b2f28e 100644 --- a/vendor/silex/silex/tests/Silex/Tests/Provider/TwigServiceProviderTest.php +++ b/vendor/silex/silex/tests/Silex/Tests/Provider/TwigServiceProviderTest.php @@ -20,6 +20,7 @@ use Silex\Provider\TwigServiceProvider; use Silex\Provider\AssetServiceProvider; use Symfony\Bridge\Twig\Extension\WebLinkExtension; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\WebLink\HttpHeaderSerializer; /** @@ -33,12 +34,12 @@ class TwigServiceProviderTest extends TestCase { $app = new Application(); - $app->register(new TwigServiceProvider(), array( - 'twig.templates' => array('hello' => 'Hello {{ name }}!'), - )); + $app->register(new TwigServiceProvider(), [ + 'twig.templates' => ['hello' => 'Hello {{ name }}!'], + ]); $app->get('/hello/{name}', function ($name) use ($app) { - return $app['twig']->render('hello', array('name' => $name)); + return $app['twig']->render('hello', ['name' => $name]); }); $request = Request::create('/hello/john'); @@ -49,11 +50,13 @@ class TwigServiceProviderTest extends TestCase public function testLoaderPriority() { $app = new Application(); - $app->register(new TwigServiceProvider(), array( - 'twig.templates' => array('foo' => 'foo'), - )); + $app->register(new TwigServiceProvider(), [ + 'twig.templates' => ['foo' => 'foo'], + ]); $loader = $this->getMockBuilder('\Twig_LoaderInterface')->getMock(); - $loader->expects($this->never())->method('getSourceContext'); + if (method_exists('\Twig_LoaderInterface', 'getSourceContext')) { + $loader->expects($this->never())->method('getSourceContext'); + } $app['twig.loader.filesystem'] = function ($app) use ($loader) { return $loader; }; @@ -64,12 +67,12 @@ class TwigServiceProviderTest extends TestCase { $app = new Application(); $app['request_stack']->push(Request::create('/dir1/dir2/file')); - $app->register(new TwigServiceProvider(), array( - 'twig.templates' => array( + $app->register(new TwigServiceProvider(), [ + 'twig.templates' => [ 'absolute' => '{{ absolute_url("foo.css") }}', 'relative' => '{{ relative_path("/dir1/foo.css") }}', - ), - )); + ], + ]); $this->assertEquals('http://localhost/dir1/dir2/foo.css', $app['twig']->render('absolute')); $this->assertEquals('../foo.css', $app['twig']->render('relative')); @@ -78,12 +81,12 @@ class TwigServiceProviderTest extends TestCase public function testAssetIntegration() { $app = new Application(); - $app->register(new TwigServiceProvider(), array( - 'twig.templates' => array('hello' => '{{ asset("/foo.css") }}'), - )); - $app->register(new AssetServiceProvider(), array( + $app->register(new TwigServiceProvider(), [ + 'twig.templates' => ['hello' => '{{ asset("/foo.css") }}'], + ]); + $app->register(new AssetServiceProvider(), [ 'assets.version' => 1, - )); + ]); $this->assertEquals('/foo.css?1', $app['twig']->render('hello')); } @@ -93,9 +96,9 @@ class TwigServiceProviderTest extends TestCase $app = new Application(); $app['request_stack']->push(Request::create('/?name=Fabien')); - $app->register(new TwigServiceProvider(), array( - 'twig.templates' => array('hello' => '{{ global.request.get("name") }}'), - )); + $app->register(new TwigServiceProvider(), [ + 'twig.templates' => ['hello' => '{{ global.request.get("name") }}'], + ]); $this->assertEquals('Fabien', $app['twig']->render('hello')); } @@ -107,9 +110,13 @@ class TwigServiceProviderTest extends TestCase $app->register(new CsrfServiceProvider()); $app->register(new TwigServiceProvider()); - $this->assertInstanceOf('Twig_Environment', $app['twig'], 'Service twig is created successful.'); - $this->assertInstanceOf('Symfony\Bridge\Twig\Form\TwigRendererEngine', $app['twig.form.engine'], 'Service twig.form.engine is created successful.'); - $this->assertInstanceOf('Symfony\Bridge\Twig\Form\TwigRenderer', $app['twig.form.renderer'], 'Service twig.form.renderer is created successful.'); + $this->assertInstanceOf('Twig_Environment', $app['twig']); + $this->assertInstanceOf('Symfony\Bridge\Twig\Form\TwigRendererEngine', $app['twig.form.engine']); + if (Kernel::VERSION_ID < 30400) { + $this->assertInstanceOf('Symfony\Bridge\Twig\Form\TwigRenderer', $app['twig.form.renderer']); + } else { + $this->assertInstanceOf('Symfony\Component\Form\FormRenderer', $app['twig.form.renderer']); + } } public function testFormWithoutCsrf() @@ -127,20 +134,20 @@ class TwigServiceProviderTest extends TestCase $timezone = new \DateTimeZone('Europe/Paris'); - $app->register(new TwigServiceProvider(), array( + $app->register(new TwigServiceProvider(), [ 'twig.date.format' => 'Y-m-d', 'twig.date.interval_format' => '%h hours', 'twig.date.timezone' => $timezone, 'twig.number_format.decimals' => 2, 'twig.number_format.decimal_point' => ',', 'twig.number_format.thousands_separator' => ' ', - )); + ]); $twig = $app['twig']; - $this->assertSame(array('Y-m-d', '%h hours'), $twig->getExtension('Twig_Extension_Core')->getDateFormat()); + $this->assertSame(['Y-m-d', '%h hours'], $twig->getExtension('Twig_Extension_Core')->getDateFormat()); $this->assertSame($timezone, $twig->getExtension('Twig_Extension_Core')->getTimezone()); - $this->assertSame(array(2, ',', ' '), $twig->getExtension('Twig_Extension_Core')->getNumberFormat()); + $this->assertSame([2, ',', ' '], $twig->getExtension('Twig_Extension_Core')->getNumberFormat()); } public function testWebLinkIntegration() @@ -151,15 +158,15 @@ class TwigServiceProviderTest extends TestCase $app = new Application(); $app['request_stack']->push($request = Request::create('/')); - $app->register(new TwigServiceProvider(), array( - 'twig.templates' => array( + $app->register(new TwigServiceProvider(), [ + 'twig.templates' => [ 'preload' => '{{ preload("/foo.css") }}', - ), - )); + ], + ]); $this->assertEquals('/foo.css', $app['twig']->render('preload')); $link = new Link('preload', '/foo.css'); - $this->assertEquals(array($link), array_values($request->attributes->get('_links')->getLinks())); + $this->assertEquals([$link], array_values($request->attributes->get('_links')->getLinks())); } } diff --git a/vendor/silex/silex/tests/Silex/Tests/Provider/ValidatorServiceProviderTest.php b/vendor/silex/silex/tests/Silex/Tests/Provider/ValidatorServiceProviderTest.php index 6abb2644..14c7f097 100644 --- a/vendor/silex/silex/tests/Silex/Tests/Provider/ValidatorServiceProviderTest.php +++ b/vendor/silex/silex/tests/Silex/Tests/Provider/ValidatorServiceProviderTest.php @@ -36,6 +36,8 @@ class ValidatorServiceProviderTest extends TestCase $app->register(new ValidatorServiceProvider()); $app->register(new FormServiceProvider()); + $this->assertInstanceOf('Symfony\Component\Validator\Validator\ValidatorInterface', $app['validator']); + return $app; } @@ -47,11 +49,13 @@ class ValidatorServiceProviderTest extends TestCase return new CustomValidator(); }; - $app->register(new ValidatorServiceProvider(), array( - 'validator.validator_service_ids' => array( + $app->register(new ValidatorServiceProvider(), [ + 'validator.validator_service_ids' => [ 'test.custom.validator' => 'custom.validator', - ), - )); + ], + ]); + + $this->assertInstanceOf('Symfony\Component\Validator\Validator\ValidatorInterface', $app['validator']); return $app; } @@ -91,45 +95,46 @@ class ValidatorServiceProviderTest extends TestCase */ public function testValidatorConstraint($email, $isValid, $nbGlobalError, $nbEmailError, $app) { - $constraints = new Assert\Collection(array( - 'email' => array( + $constraints = new Assert\Collection([ + 'email' => [ new Assert\NotBlank(), new Assert\Email(), - ), - )); + ], + ]); - $builder = $app['form.factory']->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', array(), array( + $builder = $app['form.factory']->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', [], [ 'constraints' => $constraints, - )); + ]); $form = $builder - ->add('email', 'Symfony\Component\Form\Extension\Core\Type\EmailType', array('label' => 'Email')) + ->add('email', 'Symfony\Component\Form\Extension\Core\Type\EmailType', ['label' => 'Email']) ->getForm() ; - $form->submit(array('email' => $email)); + $form->submit(['email' => $email]); $this->assertEquals($isValid, $form->isValid()); - $this->assertEquals($nbGlobalError, count($form->getErrors())); - $this->assertEquals($nbEmailError, count($form->offsetGet('email')->getErrors())); + $this->assertCount($nbGlobalError, $form->getErrors()); + $this->assertCount($nbEmailError, $form->offsetGet('email')->getErrors()); } public function testValidatorWillNotAddNonexistentTranslationFiles() { - $app = new Application(array( + $app = new Application([ 'locale' => 'nonexistent', - )); + ]); $app->register(new ValidatorServiceProvider()); - $app->register(new TranslationServiceProvider(), array( - 'locale_fallbacks' => array(), - )); + $app->register(new TranslationServiceProvider(), [ + 'locale_fallbacks' => [], + ]); $app['validator']; $translator = $app['translator']; try { $translator->trans('test'); + $this->addToAssertionCount(1); } catch (NotFoundResourceException $e) { $this->fail('Validator should not add a translation resource that does not exist'); } @@ -138,11 +143,11 @@ class ValidatorServiceProviderTest extends TestCase public function getTestValidatorConstraintProvider() { // Email, form is valid, nb global error, nb email error - return array( - array('', false, 0, 1), - array('not an email', false, 0, 1), - array('email@sample.com', true, 0, 0), - ); + return [ + ['', false, 0, 1], + ['not an email', false, 0, 1], + ['email@sample.com', true, 0, 0], + ]; } /** @@ -156,7 +161,7 @@ class ValidatorServiceProviderTest extends TestCase $app->register(new ValidatorServiceProvider()); $app->register(new TranslationServiceProvider()); $app['translator'] = $app->extend('translator', function ($translator, $app) { - $translator->addResource('array', array('This value should not be blank.' => 'Pas vide'), 'fr', 'validators'); + $translator->addResource('array', ['This value should not be blank.' => 'Pas vide'], 'fr', 'validators'); return $translator; }); @@ -165,12 +170,12 @@ class ValidatorServiceProviderTest extends TestCase $app['validator']; } - $this->assertEquals('Pas vide', $app['translator']->trans('This value should not be blank.', array(), 'validators', 'fr')); + $this->assertEquals('Pas vide', $app['translator']->trans('This value should not be blank.', [], 'validators', 'fr')); } public function getAddResourceData() { - return array(array(false), array(true)); + return [[false], [true]]; } public function testAddResourceAlternate() @@ -181,16 +186,16 @@ class ValidatorServiceProviderTest extends TestCase $app->register(new ValidatorServiceProvider()); $app->register(new TranslationServiceProvider()); $app->factory($app->extend('translator.resources', function ($resources, $app) { - $resources = array_merge($resources, array( - array('array', array('This value should not be blank.' => 'Pas vide'), 'fr', 'validators'), - )); + $resources = array_merge($resources, [ + ['array', ['This value should not be blank.' => 'Pas vide'], 'fr', 'validators'], + ]); return $resources; })); $app['validator']; - $this->assertEquals('Pas vide', $app['translator']->trans('This value should not be blank.', array(), 'validators', 'fr')); + $this->assertEquals('Pas vide', $app['translator']->trans('This value should not be blank.', [], 'validators', 'fr')); } public function testTranslatorResourcesIsArray() diff --git a/vendor/silex/silex/tests/Silex/Tests/Route/SecurityTraitTest.php b/vendor/silex/silex/tests/Silex/Tests/Route/SecurityTraitTest.php index e984fefb..1eebca40 100644 --- a/vendor/silex/silex/tests/Silex/Tests/Route/SecurityTraitTest.php +++ b/vendor/silex/silex/tests/Silex/Tests/Route/SecurityTraitTest.php @@ -70,16 +70,16 @@ class SecurityTraitTest extends TestCase { $app = new Application(); $app['route_class'] = 'Silex\Tests\Route\SecurityRoute'; - $app->register(new SecurityServiceProvider(), array( - 'security.firewalls' => array( - 'default' => array( + $app->register(new SecurityServiceProvider(), [ + 'security.firewalls' => [ + 'default' => [ 'http' => true, - 'users' => array( - 'fabien' => array('ROLE_ADMIN', '$2y$15$lzUNsTegNXvZW3qtfucV0erYBcEqWVeyOmjolB7R1uodsAVJ95vvu'), - ), - ), - ), - )); + 'users' => [ + 'fabien' => ['ROLE_ADMIN', '$2y$15$lzUNsTegNXvZW3qtfucV0erYBcEqWVeyOmjolB7R1uodsAVJ95vvu'], + ], + ], + ], + ]); return $app; } diff --git a/vendor/silex/silex/tests/Silex/Tests/RouterTest.php b/vendor/silex/silex/tests/Silex/Tests/RouterTest.php index 0d0bf518..5cf8cce3 100644 --- a/vendor/silex/silex/tests/Silex/Tests/RouterTest.php +++ b/vendor/silex/silex/tests/Silex/Tests/RouterTest.php @@ -161,7 +161,7 @@ class RouterTest extends TestCase return new Response($request->getRequestUri()); }); - foreach (array('/foo', '/bar') as $path) { + foreach (['/foo', '/bar'] as $path) { $request = Request::create($path); $response = $app->handle($request); $this->assertContains($path, $response->getContent()); diff --git a/vendor/silex/silex/tests/Silex/Tests/ServiceControllerResolverTest.php b/vendor/silex/silex/tests/Silex/Tests/ServiceControllerResolverTest.php index 398e2cef..e1404eea 100644 --- a/vendor/silex/silex/tests/Silex/Tests/ServiceControllerResolverTest.php +++ b/vendor/silex/silex/tests/Silex/Tests/ServiceControllerResolverTest.php @@ -15,6 +15,7 @@ use PHPUnit\Framework\TestCase; use Silex\ServiceControllerResolver; use Silex\Application; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\Kernel; /** * Unit tests for ServiceControllerResolver, see ServiceControllerResolverRouterTest for some @@ -49,14 +50,14 @@ class ServiceControllerResolverTest extends Testcase $this->mockCallbackResolver->expects($this->once()) ->method('convertCallback') ->with('some_service:methodName') - ->will($this->returnValue(array('callback'))); + ->will($this->returnValue(['callback'])); $this->app['some_service'] = function () { return new \stdClass(); }; $req = Request::create('/'); $req->attributes->set('_controller', 'some_service:methodName'); - $this->assertEquals(array('callback'), $this->resolver->getController($req)); + $this->assertEquals(['callback'], $this->resolver->getController($req)); } public function testShouldUnresolvedControllerNames() @@ -77,8 +78,15 @@ class ServiceControllerResolverTest extends Testcase $this->assertEquals(123, $this->resolver->getController($req)); } + /** + * @group legacy + */ public function testShouldDelegateGetArguments() { + if (Kernel::VERSION_ID >= 40000) { + self::markTestSkipped('HttpKernel < 4.0 is required'); + } + $req = Request::create('/'); $this->mockResolver->expects($this->once()) ->method('getArguments') diff --git a/vendor/silex/silex/tests/Silex/Tests/StreamTest.php b/vendor/silex/silex/tests/Silex/Tests/StreamTest.php index c494d5b4..24c26b4c 100644 --- a/vendor/silex/silex/tests/Silex/Tests/StreamTest.php +++ b/vendor/silex/silex/tests/Silex/Tests/StreamTest.php @@ -28,7 +28,7 @@ class StreamTest extends TestCase $response = $app->stream(); $this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response); - $this->assertSame(false, $response->getContent()); + $this->assertFalse($response->getContent()); } public function testStreamActuallyStreams() diff --git a/vendor/silex/silex/tests/Silex/Tests/WebTestCaseTest.php b/vendor/silex/silex/tests/Silex/Tests/WebTestCaseTest.php index 474ffc38..a5961ae3 100644 --- a/vendor/silex/silex/tests/Silex/Tests/WebTestCaseTest.php +++ b/vendor/silex/silex/tests/Silex/Tests/WebTestCaseTest.php @@ -67,10 +67,10 @@ class WebTestCaseTest extends WebTestCase $user = 'klaus'; $pass = '123456'; - $client = $this->createClient(array( + $client = $this->createClient([ 'PHP_AUTH_USER' => $user, 'PHP_AUTH_PW' => $pass, - )); + ]); $crawler = $client->request('GET', '/server'); $this->assertEquals("$user:$pass", $crawler->filter('h1')->text()); diff --git a/vendor/symfony/debug/CHANGELOG.md b/vendor/symfony/debug/CHANGELOG.md index a853b7a0..31c67eb6 100644 --- a/vendor/symfony/debug/CHANGELOG.md +++ b/vendor/symfony/debug/CHANGELOG.md @@ -1,6 +1,11 @@ CHANGELOG ========= +3.4.0 +----- + +* deprecated `ErrorHandler::stackErrors()` and `ErrorHandler::unstackErrors()` + 3.3.0 ----- diff --git a/vendor/symfony/debug/DebugClassLoader.php b/vendor/symfony/debug/DebugClassLoader.php index eb48baf8..78bfb853 100644 --- a/vendor/symfony/debug/DebugClassLoader.php +++ b/vendor/symfony/debug/DebugClassLoader.php @@ -28,10 +28,13 @@ class DebugClassLoader private $isFinder; private $loaded = array(); private static $caseCheck; + private static $checkedClasses = array(); private static $final = array(); private static $finalMethods = array(); private static $deprecated = array(); - private static $php7Reserved = array('int', 'float', 'bool', 'string', 'true', 'false', 'null'); + private static $internal = array(); + private static $internalMethods = array(); + private static $php7Reserved = array('int' => 1, 'float' => 1, 'bool' => 1, 'string' => 1, 'true' => 1, 'false' => 1, 'null' => 1); private static $darwinCache = array('/' => array('/', array())); public function __construct(callable $classLoader) @@ -132,121 +135,153 @@ class DebugClassLoader */ public function loadClass($class) { - ErrorHandler::stackErrors(); + $e = error_reporting(error_reporting() | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR); try { if ($this->isFinder && !isset($this->loaded[$class])) { $this->loaded[$class] = true; - if ($file = $this->classLoader[0]->findFile($class)) { + if ($file = $this->classLoader[0]->findFile($class) ?: false) { + $wasCached = \function_exists('opcache_is_script_cached') && opcache_is_script_cached($file); + require $file; + + if ($wasCached) { + return; + } } } else { call_user_func($this->classLoader, $class); $file = false; } } finally { - ErrorHandler::unstackErrors(); + error_reporting($e); } - $exists = class_exists($class, false) || interface_exists($class, false) || trait_exists($class, false); + $this->checkClass($class, $file); + } + + private function checkClass($class, $file = null) + { + $exists = null === $file || \class_exists($class, false) || \interface_exists($class, false) || \trait_exists($class, false); - if ($class && '\\' === $class[0]) { + if (null !== $file && $class && '\\' === $class[0]) { $class = substr($class, 1); } if ($exists) { + if (isset(self::$checkedClasses[$class])) { + return; + } + self::$checkedClasses[$class] = true; + $refl = new \ReflectionClass($class); + if (null === $file && $refl->isInternal()) { + return; + } $name = $refl->getName(); - if ($name !== $class && 0 === strcasecmp($name, $class)) { + if ($name !== $class && 0 === \strcasecmp($name, $class)) { throw new \RuntimeException(sprintf('Case mismatch between loaded and declared class names: "%s" vs "%s".', $class, $name)); } - $parent = get_parent_class($class); + // Don't trigger deprecations for classes in the same vendor + if (2 > $len = 1 + (\strpos($name, '\\') ?: \strpos($name, '_'))) { + $len = 0; + $ns = ''; + } else { + $ns = \substr($name, 0, $len); + } - // Not an interface nor a trait - if (class_exists($name, false)) { - if (preg_match('#\n \* @final(?:( .+?)\.?)?\r?\n \*(?: @|/$)#s', $refl->getDocComment(), $notice)) { - self::$final[$name] = isset($notice[1]) ? preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]) : ''; + // Detect annotations on the class + if (false !== $doc = $refl->getDocComment()) { + foreach (array('final', 'deprecated', 'internal') as $annotation) { + if (false !== \strpos($doc, $annotation) && preg_match('#\n \* @'.$annotation.'(?:( .+?)\.?)?\r?\n \*(?: @|/$)#s', $doc, $notice)) { + self::${$annotation}[$name] = isset($notice[1]) ? preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]) : ''; + } } + } - if ($parent && isset(self::$final[$parent])) { - @trigger_error(sprintf('The "%s" class is considered final%s. It may change without further notice as of its next major version. You should not extend it from "%s".', $parent, self::$final[$parent], $name), E_USER_DEPRECATED); - } + $parentAndTraits = \class_uses($name, false); + if ($parent = \get_parent_class($class)) { + $parentAndTraits[] = $parent; - // Inherit @final annotations - self::$finalMethods[$name] = $parent && isset(self::$finalMethods[$parent]) ? self::$finalMethods[$parent] : array(); + if (!isset(self::$checkedClasses[$parent])) { + $this->checkClass($parent); + } - foreach ($refl->getMethods(\ReflectionMethod::IS_PUBLIC | \ReflectionMethod::IS_PROTECTED) as $method) { - if ($method->class !== $name) { - continue; - } + if (isset(self::$final[$parent])) { + @trigger_error(sprintf('The "%s" class is considered final%s. It may change without further notice as of its next major version. You should not extend it from "%s".', $parent, self::$final[$parent], $name), E_USER_DEPRECATED); + } + } - if ($parent && isset(self::$finalMethods[$parent][$method->name])) { - @trigger_error(sprintf('%s It may change without further notice as of its next major version. You should not extend it from "%s".', self::$finalMethods[$parent][$method->name], $name), E_USER_DEPRECATED); - } + // Detect if the parent is annotated + foreach ($parentAndTraits + $this->getOwnInterfaces($name, $parent) as $use) { + if (!isset(self::$checkedClasses[$use])) { + $this->checkClass($use); + } + if (isset(self::$deprecated[$use]) && \strncmp($ns, $use, $len)) { + $type = class_exists($name, false) ? 'class' : (interface_exists($name, false) ? 'interface' : 'trait'); + $verb = class_exists($use, false) || interface_exists($name, false) ? 'extends' : (interface_exists($use, false) ? 'implements' : 'uses'); - $doc = $method->getDocComment(); - if (false === $doc || false === strpos($doc, '@final')) { - continue; - } + @trigger_error(sprintf('The "%s" %s %s "%s" that is deprecated%s.', $name, $type, $verb, $use, self::$deprecated[$use]), E_USER_DEPRECATED); + } + if (isset(self::$internal[$use]) && \strncmp($ns, $use, $len)) { + @trigger_error(sprintf('The "%s" %s is considered internal%s. It may change without further notice. You should not use it from "%s".', $use, class_exists($use, false) ? 'class' : (interface_exists($use, false) ? 'interface' : 'trait'), self::$internal[$use], $name), E_USER_DEPRECATED); + } + } - if (preg_match('#\n\s+\* @final(?:( .+?)\.?)?\r?\n\s+\*(?: @|/$)#s', $doc, $notice)) { - $message = isset($notice[1]) ? preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]) : ''; - self::$finalMethods[$name][$method->name] = sprintf('The "%s::%s()" method is considered final%s.', $name, $method->name, $message); + // Inherit @final and @internal annotations for methods + self::$finalMethods[$name] = array(); + self::$internalMethods[$name] = array(); + foreach ($parentAndTraits as $use) { + foreach (array('finalMethods', 'internalMethods') as $property) { + if (isset(self::${$property}[$use])) { + self::${$property}[$name] = self::${$property}[$name] ? self::${$property}[$use] + self::${$property}[$name] : self::${$property}[$use]; } } } - if (in_array(strtolower($refl->getShortName()), self::$php7Reserved)) { - @trigger_error(sprintf('The "%s" class uses the reserved name "%s", it will break on PHP 7 and higher', $name, $refl->getShortName()), E_USER_DEPRECATED); - } elseif (preg_match('#\n \* @deprecated (.*?)\r?\n \*(?: @|/$)#s', $refl->getDocComment(), $notice)) { - self::$deprecated[$name] = preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]); - } else { - // Don't trigger deprecations for classes in the same vendor - if (2 > $len = 1 + (strpos($name, '\\', 1 + strpos($name, '\\')) ?: strpos($name, '_'))) { - $len = 0; - $ns = ''; - } else { - switch ($ns = substr($name, 0, $len)) { - case 'Symfony\Bridge\\': - case 'Symfony\Bundle\\': - case 'Symfony\Component\\': - $ns = 'Symfony\\'; - $len = strlen($ns); - break; - } + $isClass = \class_exists($name, false); + foreach ($refl->getMethods(\ReflectionMethod::IS_PUBLIC | \ReflectionMethod::IS_PROTECTED) as $method) { + if ($method->class !== $name) { + continue; } - if (!$parent || strncmp($ns, $parent, $len)) { - if ($parent && isset(self::$deprecated[$parent]) && strncmp($ns, $parent, $len)) { - @trigger_error(sprintf('The "%s" class extends "%s" that is deprecated %s', $name, $parent, self::$deprecated[$parent]), E_USER_DEPRECATED); - } + // Method from a trait + if ($method->getFilename() !== $refl->getFileName()) { + continue; + } - $parentInterfaces = array(); - $deprecatedInterfaces = array(); - if ($parent) { - foreach (class_implements($parent) as $interface) { - $parentInterfaces[$interface] = 1; - } - } + if ($isClass && $parent && isset(self::$finalMethods[$parent][$method->name])) { + list($declaringClass, $message) = self::$finalMethods[$parent][$method->name]; + @trigger_error(sprintf('The "%s::%s()" method is considered final%s. It may change without further notice as of its next major version. You should not extend it from "%s".', $declaringClass, $method->name, $message, $name), E_USER_DEPRECATED); + } - foreach ($refl->getInterfaceNames() as $interface) { - if (isset(self::$deprecated[$interface]) && strncmp($ns, $interface, $len)) { - $deprecatedInterfaces[] = $interface; - } - foreach (class_implements($interface) as $interface) { - $parentInterfaces[$interface] = 1; + foreach ($parentAndTraits as $use) { + if (isset(self::$internalMethods[$use][$method->name])) { + list($declaringClass, $message) = self::$internalMethods[$use][$method->name]; + if (\strncmp($ns, $declaringClass, $len)) { + @trigger_error(sprintf('The "%s::%s()" method is considered internal%s. It may change without further notice. You should not extend it from "%s".', $declaringClass, $method->name, $message, $name), E_USER_DEPRECATED); } } + } - foreach ($deprecatedInterfaces as $interface) { - if (!isset($parentInterfaces[$interface])) { - @trigger_error(sprintf('The "%s" %s "%s" that is deprecated %s', $name, $refl->isInterface() ? 'interface extends' : 'class implements', $interface, self::$deprecated[$interface]), E_USER_DEPRECATED); - } + // Detect method annotations + if (false === $doc = $method->getDocComment()) { + continue; + } + + foreach (array('final', 'internal') as $annotation) { + if (false !== \strpos($doc, $annotation) && preg_match('#\n\s+\* @'.$annotation.'(?:( .+?)\.?)?\r?\n\s+\*(?: @|/$)#s', $doc, $notice)) { + $message = isset($notice[1]) ? preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]) : ''; + self::${$annotation.'Methods'}[$name][$method->name] = array($name, $message); } } } + + if (isset(self::$php7Reserved[\strtolower($refl->getShortName())])) { + @trigger_error(sprintf('The "%s" class uses the reserved name "%s", it will break on PHP 7 and higher', $name, $refl->getShortName()), E_USER_DEPRECATED); + } } if ($file) { @@ -342,8 +377,33 @@ class DebugClassLoader throw new \RuntimeException(sprintf('Case mismatch between class and real file names: "%s" vs "%s" in "%s".', substr($tail, -$tailLen + 1), substr($real, -$tailLen + 1), substr($real, 0, -$tailLen + 1))); } } + } + } + + /** + * `class_implements` includes interfaces from the parents so we have to manually exclude them. + * + * @param string $class + * @param string|false $parent + * + * @return string[] + */ + private function getOwnInterfaces($class, $parent) + { + $ownInterfaces = class_implements($class, false); + + if ($parent) { + foreach (class_implements($parent, false) as $interface) { + unset($ownInterfaces[$interface]); + } + } - return true; + foreach ($ownInterfaces as $interface) { + foreach (class_implements($interface) as $interface) { + unset($ownInterfaces[$interface]); + } } + + return $ownInterfaces; } } diff --git a/vendor/symfony/debug/ErrorHandler.php b/vendor/symfony/debug/ErrorHandler.php index 369ed26f..90e5535d 100644 --- a/vendor/symfony/debug/ErrorHandler.php +++ b/vendor/symfony/debug/ErrorHandler.php @@ -134,11 +134,14 @@ class ErrorHandler $handler = $prev[0]; $replace = false; } - if ($replace || !$prev) { - $handler->setExceptionHandler(set_exception_handler(array($handler, 'handleException'))); - } else { + if (!$replace && $prev) { restore_error_handler(); } + if (is_array($prev = set_exception_handler(array($handler, 'handleException'))) && $prev[0] === $handler) { + restore_exception_handler(); + } else { + $handler->setExceptionHandler($prev); + } $handler->throwAt(E_ALL & $handler->thrownErrors, true); @@ -409,21 +412,25 @@ class ErrorHandler $errorAsException = self::$toStringException; self::$toStringException = null; } elseif (!$throw && !($type & $level)) { - if (isset(self::$silencedErrorCache[$message])) { + if (!isset(self::$silencedErrorCache[$id = $file.':'.$line])) { + $lightTrace = $this->tracedErrors & $type ? $this->cleanTrace(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3), $type, $file, $line, false) : array(); + $errorAsException = new SilencedErrorContext($type, $file, $line, $lightTrace); + } elseif (isset(self::$silencedErrorCache[$id][$message])) { $lightTrace = null; - $errorAsException = self::$silencedErrorCache[$message]; + $errorAsException = self::$silencedErrorCache[$id][$message]; ++$errorAsException->count; } else { - $lightTrace = $this->tracedErrors & $type ? $this->cleanTrace(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3), $type, $file, $line, false) : array(); - $errorAsException = new SilencedErrorContext($type, $file, $line, $lightTrace); + $lightTrace = array(); + $errorAsException = null; } if (100 < ++self::$silencedErrorCount) { self::$silencedErrorCache = $lightTrace = array(); self::$silencedErrorCount = 1; } - self::$silencedErrorCache[$message] = $errorAsException; - + if ($errorAsException) { + self::$silencedErrorCache[$id][$message] = $errorAsException; + } if (null === $lightTrace) { return; } @@ -494,13 +501,13 @@ class ErrorHandler $this->loggers[$type][0], ($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $logMessage, - array('exception' => $errorAsException), + $errorAsException ? array('exception' => $errorAsException) : array(), ); } else { try { $this->isRecursive = true; $level = ($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG; - $this->loggers[$type][0]->log($level, $logMessage, array('exception' => $errorAsException)); + $this->loggers[$type][0]->log($level, $logMessage, $errorAsException ? array('exception' => $errorAsException) : array()); } finally { $this->isRecursive = false; } @@ -526,6 +533,7 @@ class ErrorHandler $exception = new FatalThrowableError($exception); } $type = $exception instanceof FatalErrorException ? $exception->getSeverity() : E_ERROR; + $handlerException = null; if (($this->loggedErrors & $type) || $exception instanceof FatalThrowableError) { if ($exception instanceof FatalErrorException) { @@ -560,18 +568,20 @@ class ErrorHandler } } } - if (empty($this->exceptionHandler)) { - throw $exception; // Give back $exception to the native handler - } try { - call_user_func($this->exceptionHandler, $exception); + if (null !== $this->exceptionHandler) { + return \call_user_func($this->exceptionHandler, $exception); + } + $handlerException = $handlerException ?: $exception; } catch (\Exception $handlerException) { } catch (\Throwable $handlerException) { } - if (isset($handlerException)) { - $this->exceptionHandler = null; - $this->handleException($handlerException); + $this->exceptionHandler = null; + if ($exception === $handlerException) { + self::$reservedMemory = null; // Disable the fatal error handler + throw $exception; // Give back $exception to the native handler } + $this->handleException($handlerException); } /** @@ -587,15 +597,39 @@ class ErrorHandler return; } - self::$reservedMemory = null; + $handler = self::$reservedMemory = null; + $handlers = array(); + $previousHandler = null; + $sameHandlerLimit = 10; - $handler = set_error_handler('var_dump'); - $handler = is_array($handler) ? $handler[0] : null; - restore_error_handler(); + while (!is_array($handler) || !$handler[0] instanceof self) { + $handler = set_exception_handler('var_dump'); + restore_exception_handler(); - if (!$handler instanceof self) { + if (!$handler) { + break; + } + restore_exception_handler(); + + if ($handler !== $previousHandler) { + array_unshift($handlers, $handler); + $previousHandler = $handler; + } elseif (0 === --$sameHandlerLimit) { + $handler = null; + break; + } + } + foreach ($handlers as $h) { + set_exception_handler($h); + } + if (!$handler) { return; } + if ($handler !== $h) { + $handler[0]->setExceptionHandler($h); + } + $handler = $handler[0]; + $handlers = array(); if ($exit = null === $error) { $error = error_get_last(); @@ -648,17 +682,25 @@ class ErrorHandler * * The most important feature of this is to prevent * autoloading until unstackErrors() is called. + * + * @deprecated since version 3.4, to be removed in 4.0. */ public static function stackErrors() { + @trigger_error('Support for stacking errors is deprecated since Symfony 3.4 and will be removed in 4.0.', E_USER_DEPRECATED); + self::$stackedErrorLevels[] = error_reporting(error_reporting() | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR); } /** * Unstacks stacked errors and forwards to the logger. + * + * @deprecated since version 3.4, to be removed in 4.0. */ public static function unstackErrors() { + @trigger_error('Support for unstacking errors is deprecated since Symfony 3.4 and will be removed in 4.0.', E_USER_DEPRECATED); + $level = array_pop(self::$stackedErrorLevels); if (null !== $level) { @@ -707,7 +749,7 @@ class ErrorHandler } if (!($throw || $this->scopedErrors & $type)) { for ($i = 0; isset($lightTrace[$i]); ++$i) { - unset($lightTrace[$i]['args']); + unset($lightTrace[$i]['args'], $lightTrace[$i]['object']); } } diff --git a/vendor/symfony/debug/Exception/ContextErrorException.php b/vendor/symfony/debug/Exception/ContextErrorException.php index 6561d4df..554139da 100644 --- a/vendor/symfony/debug/Exception/ContextErrorException.php +++ b/vendor/symfony/debug/Exception/ContextErrorException.php @@ -33,7 +33,7 @@ class ContextErrorException extends \ErrorException */ public function getContext() { - @trigger_error(sprintf('The %s class is deprecated since version 3.3 and will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED); + @trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED); return $this->context; } diff --git a/vendor/symfony/debug/ExceptionHandler.php b/vendor/symfony/debug/ExceptionHandler.php index a82a3246..97470cb6 100644 --- a/vendor/symfony/debug/ExceptionHandler.php +++ b/vendor/symfony/debug/ExceptionHandler.php @@ -196,8 +196,6 @@ class ExceptionHandler /** * Gets the HTML content associated with the given exception. * - * @param FlattenException $exception A FlattenException instance - * * @return string The content as a string */ public function getContent(FlattenException $exception) @@ -276,8 +274,6 @@ EOF; /** * Gets the stylesheet associated with the given exception. * - * @param FlattenException $exception A FlattenException instance - * * @return string The stylesheet as a string */ public function getStylesheet(FlattenException $exception) diff --git a/vendor/symfony/debug/LICENSE b/vendor/symfony/debug/LICENSE index 17d16a13..21d7fb9e 100644 --- a/vendor/symfony/debug/LICENSE +++ b/vendor/symfony/debug/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2017 Fabien Potencier +Copyright (c) 2004-2018 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/symfony/debug/Resources/ext/tests/001.phpt b/vendor/symfony/debug/Resources/ext/tests/001.phpt index 15e183a7..4a87cd31 100644 --- a/vendor/symfony/debug/Resources/ext/tests/001.phpt +++ b/vendor/symfony/debug/Resources/ext/tests/001.phpt @@ -1,7 +1,9 @@ --TEST-- Test symfony_zval_info API --SKIPIF-- -<?php if (!extension_loaded('symfony_debug')) print 'skip'; ?> +<?php if (!extension_loaded('symfony_debug')) { + echo 'skip'; +} ?> --FILE-- <?php diff --git a/vendor/symfony/debug/Resources/ext/tests/002.phpt b/vendor/symfony/debug/Resources/ext/tests/002.phpt index 2bc6d712..afc7bb49 100644 --- a/vendor/symfony/debug/Resources/ext/tests/002.phpt +++ b/vendor/symfony/debug/Resources/ext/tests/002.phpt @@ -1,7 +1,9 @@ --TEST-- Test symfony_debug_backtrace in case of fatal error --SKIPIF-- -<?php if (!extension_loaded('symfony_debug')) print 'skip'; ?> +<?php if (!extension_loaded('symfony_debug')) { + echo 'skip'; +} ?> --FILE-- <?php diff --git a/vendor/symfony/debug/Resources/ext/tests/002_1.phpt b/vendor/symfony/debug/Resources/ext/tests/002_1.phpt index 4e9e34f1..86de3e17 100644 --- a/vendor/symfony/debug/Resources/ext/tests/002_1.phpt +++ b/vendor/symfony/debug/Resources/ext/tests/002_1.phpt @@ -1,7 +1,9 @@ --TEST-- Test symfony_debug_backtrace in case of non fatal error --SKIPIF-- -<?php if (!extension_loaded('symfony_debug')) print 'skip'; ?> +<?php if (!extension_loaded('symfony_debug')) { + echo 'skip'; +} ?> --FILE-- <?php diff --git a/vendor/symfony/debug/Resources/ext/tests/003.phpt b/vendor/symfony/debug/Resources/ext/tests/003.phpt index 2a494e27..ce3c4e0a 100644 --- a/vendor/symfony/debug/Resources/ext/tests/003.phpt +++ b/vendor/symfony/debug/Resources/ext/tests/003.phpt @@ -1,7 +1,9 @@ --TEST-- Test ErrorHandler in case of fatal error --SKIPIF-- -<?php if (!extension_loaded('symfony_debug')) print 'skip'; ?> +<?php if (!extension_loaded('symfony_debug')) { + echo 'skip'; +} ?> --FILE-- <?php diff --git a/vendor/symfony/debug/Tests/DebugClassLoaderTest.php b/vendor/symfony/debug/Tests/DebugClassLoaderTest.php index 7145951f..0219f533 100644 --- a/vendor/symfony/debug/Tests/DebugClassLoaderTest.php +++ b/vendor/symfony/debug/Tests/DebugClassLoaderTest.php @@ -204,7 +204,7 @@ class DebugClassLoaderTest extends TestCase $xError = array( 'type' => E_USER_DEPRECATED, - 'message' => 'The "Test\Symfony\Component\Debug\Tests\\'.$class.'" class '.$type.' "Symfony\Component\Debug\Tests\Fixtures\\'.$super.'" that is deprecated but this is a test deprecation notice', + 'message' => 'The "Test\Symfony\Component\Debug\Tests\\'.$class.'" class '.$type.' "Symfony\Component\Debug\Tests\Fixtures\\'.$super.'" that is deprecated but this is a test deprecation notice.', ); $this->assertSame($xError, $lastError); @@ -331,6 +331,42 @@ class DebugClassLoaderTest extends TestCase $this->assertSame($xError, $lastError); } + + public function testExtendedDeprecatedMethodDoesntTriggerAnyNotice() + { + set_error_handler(function () { return false; }); + $e = error_reporting(0); + trigger_error('', E_USER_NOTICE); + + class_exists('Test\\'.__NAMESPACE__.'\\ExtendsAnnotatedClass', true); + + error_reporting($e); + restore_error_handler(); + + $lastError = error_get_last(); + unset($lastError['file'], $lastError['line']); + + $this->assertSame(array('type' => E_USER_NOTICE, 'message' => ''), $lastError); + } + + public function testInternalsUse() + { + $deprecations = array(); + set_error_handler(function ($type, $msg) use (&$deprecations) { $deprecations[] = $msg; }); + $e = error_reporting(E_USER_DEPRECATED); + + class_exists('Test\\'.__NAMESPACE__.'\\ExtendsInternals', true); + + error_reporting($e); + restore_error_handler(); + + $this->assertSame($deprecations, array( + 'The "Symfony\Component\Debug\Tests\Fixtures\InternalClass" class is considered internal since version 3.4. It may change without further notice. You should not use it from "Test\Symfony\Component\Debug\Tests\ExtendsInternalsParent".', + 'The "Symfony\Component\Debug\Tests\Fixtures\InternalInterface" interface is considered internal. It may change without further notice. You should not use it from "Test\Symfony\Component\Debug\Tests\ExtendsInternalsParent".', + 'The "Symfony\Component\Debug\Tests\Fixtures\InternalTrait" trait is considered internal. It may change without further notice. You should not use it from "Test\Symfony\Component\Debug\Tests\ExtendsInternals".', + 'The "Symfony\Component\Debug\Tests\Fixtures\InternalTrait2::internalMethod()" method is considered internal since version 3.4. It may change without further notice. You should not extend it from "Test\Symfony\Component\Debug\Tests\ExtendsInternals".', + )); + } } class ClassLoader @@ -354,22 +390,12 @@ class ClassLoader eval('namespace '.__NAMESPACE__.'; class TestingStacking { function foo() {} }'); } elseif (__NAMESPACE__.'\TestingCaseMismatch' === $class) { eval('namespace '.__NAMESPACE__.'; class TestingCaseMisMatch {}'); - } elseif (__NAMESPACE__.'\Fixtures\CaseMismatch' === $class) { - return $fixtureDir.'CaseMismatch.php'; } elseif (__NAMESPACE__.'\Fixtures\Psr4CaseMismatch' === $class) { return $fixtureDir.'psr4'.DIRECTORY_SEPARATOR.'Psr4CaseMismatch.php'; } elseif (__NAMESPACE__.'\Fixtures\NotPSR0' === $class) { return $fixtureDir.'reallyNotPsr0.php'; } elseif (__NAMESPACE__.'\Fixtures\NotPSR0bis' === $class) { return $fixtureDir.'notPsr0Bis.php'; - } elseif (__NAMESPACE__.'\Fixtures\DeprecatedInterface' === $class) { - return $fixtureDir.'DeprecatedInterface.php'; - } elseif (__NAMESPACE__.'\Fixtures\FinalClass' === $class) { - return $fixtureDir.'FinalClass.php'; - } elseif (__NAMESPACE__.'\Fixtures\FinalMethod' === $class) { - return $fixtureDir.'FinalMethod.php'; - } elseif (__NAMESPACE__.'\Fixtures\ExtendedFinalMethod' === $class) { - return $fixtureDir.'ExtendedFinalMethod.php'; } elseif ('Symfony\Bridge\Debug\Tests\Fixtures\ExtendsDeprecatedParent' === $class) { eval('namespace Symfony\Bridge\Debug\Tests\Fixtures; class ExtendsDeprecatedParent extends \\'.__NAMESPACE__.'\Fixtures\DeprecatedClass {}'); } elseif ('Test\\'.__NAMESPACE__.'\DeprecatedParentClass' === $class) { @@ -382,6 +408,18 @@ class ClassLoader eval('namespace Test\\'.__NAMESPACE__.'; class Float {}'); } elseif ('Test\\'.__NAMESPACE__.'\ExtendsFinalClass' === $class) { eval('namespace Test\\'.__NAMESPACE__.'; class ExtendsFinalClass extends \\'.__NAMESPACE__.'\Fixtures\FinalClass {}'); + } elseif ('Test\\'.__NAMESPACE__.'\ExtendsAnnotatedClass' === $class) { + eval('namespace Test\\'.__NAMESPACE__.'; class ExtendsAnnotatedClass extends \\'.__NAMESPACE__.'\Fixtures\AnnotatedClass { + public function deprecatedMethod() { } + }'); + } elseif ('Test\\'.__NAMESPACE__.'\ExtendsInternals' === $class) { + eval('namespace Test\\'.__NAMESPACE__.'; class ExtendsInternals extends ExtendsInternalsParent { + use \\'.__NAMESPACE__.'\Fixtures\InternalTrait; + + public function internalMethod() { } + }'); + } elseif ('Test\\'.__NAMESPACE__.'\ExtendsInternalsParent' === $class) { + eval('namespace Test\\'.__NAMESPACE__.'; class ExtendsInternalsParent extends \\'.__NAMESPACE__.'\Fixtures\InternalClass implements \\'.__NAMESPACE__.'\Fixtures\InternalInterface { }'); } } } diff --git a/vendor/symfony/debug/Tests/ErrorHandlerTest.php b/vendor/symfony/debug/Tests/ErrorHandlerTest.php index a14accf3..a57e83ee 100644 --- a/vendor/symfony/debug/Tests/ErrorHandlerTest.php +++ b/vendor/symfony/debug/Tests/ErrorHandlerTest.php @@ -98,8 +98,6 @@ class ErrorHandlerTest extends TestCase // dummy function to test trace in error handler. private static function triggerNotice($that) { - // dummy variable to check for in error handler. - $foobar = 123; $that->assertSame('', $foo.$foo.$bar); } @@ -301,6 +299,9 @@ class ErrorHandlerTest extends TestCase @$handler->handleError(E_USER_DEPRECATED, 'Foo deprecation', __FILE__, __LINE__, array()); } + /** + * @group no-hhvm + */ public function testHandleException() { try { @@ -342,6 +343,9 @@ class ErrorHandlerTest extends TestCase } } + /** + * @group legacy + */ public function testErrorStacking() { try { @@ -422,6 +426,9 @@ class ErrorHandlerTest extends TestCase $handler->setLoggers(array(E_DEPRECATED => array($mockLogger, LogLevel::WARNING))); } + /** + * @group no-hhvm + */ public function testSettingLoggerWhenExceptionIsBuffered() { $bootLogger = new BufferingLogger(); @@ -441,6 +448,9 @@ class ErrorHandlerTest extends TestCase $handler->handleException($exception); } + /** + * @group no-hhvm + */ public function testHandleFatalError() { try { @@ -499,6 +509,9 @@ class ErrorHandlerTest extends TestCase $this->assertStringStartsWith("Attempted to load class \"Foo\" from the global namespace.\nDid you forget a \"use\" statement", $args[0]->getMessage()); } + /** + * @group no-hhvm + */ public function testHandleFatalErrorOnHHVM() { try { diff --git a/vendor/symfony/debug/Tests/Exception/FlattenExceptionTest.php b/vendor/symfony/debug/Tests/Exception/FlattenExceptionTest.php index e7762bde..8fd1c795 100644 --- a/vendor/symfony/debug/Tests/Exception/FlattenExceptionTest.php +++ b/vendor/symfony/debug/Tests/Exception/FlattenExceptionTest.php @@ -261,6 +261,7 @@ class FlattenExceptionTest extends TestCase public function testRecursionInArguments() { + $a = null; $a = array('foo', array(2, &$a)); $exception = $this->createException($a); diff --git a/vendor/symfony/debug/Tests/Fixtures/AnnotatedClass.php b/vendor/symfony/debug/Tests/Fixtures/AnnotatedClass.php new file mode 100644 index 00000000..dff9517d --- /dev/null +++ b/vendor/symfony/debug/Tests/Fixtures/AnnotatedClass.php @@ -0,0 +1,13 @@ +<?php + +namespace Symfony\Component\Debug\Tests\Fixtures; + +class AnnotatedClass +{ + /** + * @deprecated since version 3.4. + */ + public function deprecatedMethod() + { + } +} diff --git a/vendor/symfony/debug/Tests/Fixtures/InternalClass.php b/vendor/symfony/debug/Tests/Fixtures/InternalClass.php new file mode 100644 index 00000000..119842c2 --- /dev/null +++ b/vendor/symfony/debug/Tests/Fixtures/InternalClass.php @@ -0,0 +1,15 @@ +<?php + +namespace Symfony\Component\Debug\Tests\Fixtures; + +/** + * @internal since version 3.4. + */ +class InternalClass +{ + use InternalTrait2; + + public function usedInInternalClass() + { + } +} diff --git a/vendor/symfony/debug/Tests/Fixtures/InternalInterface.php b/vendor/symfony/debug/Tests/Fixtures/InternalInterface.php new file mode 100644 index 00000000..dd79f501 --- /dev/null +++ b/vendor/symfony/debug/Tests/Fixtures/InternalInterface.php @@ -0,0 +1,10 @@ +<?php + +namespace Symfony\Component\Debug\Tests\Fixtures; + +/** + * @internal + */ +interface InternalInterface +{ +} diff --git a/vendor/symfony/debug/Tests/Fixtures/InternalTrait.php b/vendor/symfony/debug/Tests/Fixtures/InternalTrait.php new file mode 100644 index 00000000..7bb4635c --- /dev/null +++ b/vendor/symfony/debug/Tests/Fixtures/InternalTrait.php @@ -0,0 +1,10 @@ +<?php + +namespace Symfony\Component\Debug\Tests\Fixtures; + +/** + * @internal + */ +trait InternalTrait +{ +} diff --git a/vendor/symfony/debug/Tests/Fixtures/InternalTrait2.php b/vendor/symfony/debug/Tests/Fixtures/InternalTrait2.php new file mode 100644 index 00000000..05f18e83 --- /dev/null +++ b/vendor/symfony/debug/Tests/Fixtures/InternalTrait2.php @@ -0,0 +1,23 @@ +<?php + +namespace Symfony\Component\Debug\Tests\Fixtures; + +/** + * @internal + */ +trait InternalTrait2 +{ + /** + * @internal since version 3.4 + */ + public function internalMethod() + { + } + + /** + * @internal but should not trigger a deprecation + */ + public function usedInInternalClass() + { + } +} diff --git a/vendor/symfony/debug/Tests/phpt/debug_class_loader.phpt b/vendor/symfony/debug/Tests/phpt/debug_class_loader.phpt new file mode 100644 index 00000000..b9d3d728 --- /dev/null +++ b/vendor/symfony/debug/Tests/phpt/debug_class_loader.phpt @@ -0,0 +1,26 @@ +--TEST-- +Test DebugClassLoader with previously loaded parents +--FILE-- +<?php + +namespace Symfony\Component\Debug\Tests\Fixtures; + +use Symfony\Component\Debug\DebugClassLoader; + +$vendor = __DIR__; +while (!file_exists($vendor.'/vendor')) { + $vendor = dirname($vendor); +} +require $vendor.'/vendor/autoload.php'; + +class_exists(FinalMethod::class); + +set_error_handler(function ($type, $msg) { echo $msg, "\n"; }); + +DebugClassLoader::enable(); + +class_exists(ExtendedFinalMethod::class); + +?> +--EXPECTF-- +The "Symfony\Component\Debug\Tests\Fixtures\FinalMethod::finalMethod()" method is considered final since version 3.3. It may change without further notice as of its next major version. You should not extend it from "Symfony\Component\Debug\Tests\Fixtures\ExtendedFinalMethod". diff --git a/vendor/symfony/debug/Tests/phpt/decorate_exception_hander.phpt b/vendor/symfony/debug/Tests/phpt/decorate_exception_hander.phpt new file mode 100644 index 00000000..7ce7b9dc --- /dev/null +++ b/vendor/symfony/debug/Tests/phpt/decorate_exception_hander.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test catching fatal errors when handlers are nested +--FILE-- +<?php + +namespace Symfony\Component\Debug; + +$vendor = __DIR__; +while (!file_exists($vendor.'/vendor')) { + $vendor = dirname($vendor); +} +require $vendor.'/vendor/autoload.php'; + +set_error_handler('var_dump'); +set_exception_handler('var_dump'); + +ErrorHandler::register(null, false); + +if (true) { + class foo extends missing + { + } +} + +?> +--EXPECTF-- +Fatal error: Class 'Symfony\Component\Debug\missing' not found in %s on line %d +object(Symfony\Component\Debug\Exception\ClassNotFoundException)#%d (8) { + ["message":protected]=> + string(131) "Attempted to load class "missing" from namespace "Symfony\Component\Debug". +Did you forget a "use" statement for another namespace?" + ["string":"Exception":private]=> + string(0) "" + ["code":protected]=> + int(0) + ["file":protected]=> + string(%d) "%s" + ["line":protected]=> + int(%d) + ["trace":"Exception":private]=> + array(0) { + } + ["previous":"Exception":private]=> + NULL + ["severity":protected]=> + int(1) +} diff --git a/vendor/symfony/debug/Tests/phpt/exception_rethrown.phpt b/vendor/symfony/debug/Tests/phpt/exception_rethrown.phpt new file mode 100644 index 00000000..9df0a65c --- /dev/null +++ b/vendor/symfony/debug/Tests/phpt/exception_rethrown.phpt @@ -0,0 +1,35 @@ +--TEST-- +Test rethrowing in custom exception handler +--FILE-- +<?php + +namespace Symfony\Component\Debug; + +$vendor = __DIR__; +while (!file_exists($vendor.'/vendor')) { + $vendor = dirname($vendor); +} +require $vendor.'/vendor/autoload.php'; + +if (true) { + class TestLogger extends \Psr\Log\AbstractLogger + { + public function log($level, $message, array $context = array()) + { + echo $message, "\n"; + } + } +} + +set_exception_handler(function ($e) { echo 123; throw $e; }); +ErrorHandler::register()->setDefaultLogger(new TestLogger()); +ini_set('display_errors', 1); + +throw new \Exception('foo'); +?> +--EXPECTF-- +Uncaught Exception: foo +123 +Fatal error: Uncaught %s:25 +Stack trace: +%a diff --git a/vendor/symfony/debug/Tests/phpt/fatal_with_nested_handlers.phpt b/vendor/symfony/debug/Tests/phpt/fatal_with_nested_handlers.phpt new file mode 100644 index 00000000..5c5245c0 --- /dev/null +++ b/vendor/symfony/debug/Tests/phpt/fatal_with_nested_handlers.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test catching fatal errors when handlers are nested +--FILE-- +<?php + +namespace Symfony\Component\Debug; + +$vendor = __DIR__; +while (!file_exists($vendor.'/vendor')) { + $vendor = dirname($vendor); +} +require $vendor.'/vendor/autoload.php'; + +Debug::enable(); +ini_set('display_errors', 0); + +$eHandler = set_error_handler('var_dump'); +$xHandler = set_exception_handler('var_dump'); + +var_dump(array( + $eHandler[0] === $xHandler[0] ? 'Error and exception handlers do match' : 'Error and exception handlers are different', +)); + +$eHandler[0]->setExceptionHandler('print_r'); + +if (true) { + class Broken implements \Serializable + { + } +} + +?> +--EXPECTF-- +array(1) { + [0]=> + string(37) "Error and exception handlers do match" +} +object(Symfony\Component\Debug\Exception\FatalErrorException)#%d (%d) { + ["message":protected]=> + string(199) "Error: Class Symfony\Component\Debug\Broken contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (Serializable::serialize, Serializable::unserialize)" +%a +} diff --git a/vendor/symfony/debug/composer.json b/vendor/symfony/debug/composer.json index 38323dd4..f98a5d07 100644 --- a/vendor/symfony/debug/composer.json +++ b/vendor/symfony/debug/composer.json @@ -23,7 +23,7 @@ "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" }, "require-dev": { - "symfony/http-kernel": "~2.8|~3.0" + "symfony/http-kernel": "~2.8|~3.0|~4.0" }, "autoload": { "psr-4": { "Symfony\\Component\\Debug\\": "" }, @@ -34,7 +34,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } } } diff --git a/vendor/symfony/event-dispatcher/CHANGELOG.md b/vendor/symfony/event-dispatcher/CHANGELOG.md index 736bd849..c6aa5389 100644 --- a/vendor/symfony/event-dispatcher/CHANGELOG.md +++ b/vendor/symfony/event-dispatcher/CHANGELOG.md @@ -1,6 +1,11 @@ CHANGELOG ========= +3.4.0 +----- + + * Implementing `TraceableEventDispatcherInterface` without the `reset()` method has been deprecated. + 3.3.0 ----- diff --git a/vendor/symfony/event-dispatcher/ContainerAwareEventDispatcher.php b/vendor/symfony/event-dispatcher/ContainerAwareEventDispatcher.php index bfbccf9c..81a1ff7c 100644 --- a/vendor/symfony/event-dispatcher/ContainerAwareEventDispatcher.php +++ b/vendor/symfony/event-dispatcher/ContainerAwareEventDispatcher.php @@ -25,30 +25,18 @@ use Symfony\Component\DependencyInjection\ContainerInterface; */ class ContainerAwareEventDispatcher extends EventDispatcher { - /** - * The container from where services are loaded. - * - * @var ContainerInterface - */ private $container; /** * The service IDs of the event listeners and subscribers. - * - * @var array */ private $listenerIds = array(); /** * The services registered as listeners. - * - * @var array */ private $listeners = array(); - /** - * @param ContainerInterface $container A ContainerInterface instance - */ public function __construct(ContainerInterface $container) { $this->container = $container; @@ -58,7 +46,7 @@ class ContainerAwareEventDispatcher extends EventDispatcher $class = get_parent_class($class); } if (__CLASS__ !== $class) { - @trigger_error(sprintf('The %s class is deprecated since version 3.3 and will be removed in 4.0. Use EventDispatcher with closure factories instead.', __CLASS__), E_USER_DEPRECATED); + @trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use EventDispatcher with closure factories instead.', __CLASS__), E_USER_DEPRECATED); } } @@ -76,7 +64,7 @@ class ContainerAwareEventDispatcher extends EventDispatcher */ public function addListenerService($eventName, $callback, $priority = 0) { - @trigger_error(sprintf('The %s class is deprecated since version 3.3 and will be removed in 4.0. Use EventDispatcher with closure factories instead.', __CLASS__), E_USER_DEPRECATED); + @trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use EventDispatcher with closure factories instead.', __CLASS__), E_USER_DEPRECATED); if (!is_array($callback) || 2 !== count($callback)) { throw new \InvalidArgumentException('Expected an array("service", "method") argument'); @@ -90,7 +78,7 @@ class ContainerAwareEventDispatcher extends EventDispatcher $this->lazyLoad($eventName); if (isset($this->listenerIds[$eventName])) { - foreach ($this->listenerIds[$eventName] as $i => list($serviceId, $method, $priority)) { + foreach ($this->listenerIds[$eventName] as $i => list($serviceId, $method)) { $key = $serviceId.'.'.$method; if (isset($this->listeners[$eventName][$key]) && $listener === array($this->listeners[$eventName][$key], $method)) { unset($this->listeners[$eventName][$key]); @@ -158,7 +146,7 @@ class ContainerAwareEventDispatcher extends EventDispatcher */ public function addSubscriberService($serviceId, $class) { - @trigger_error(sprintf('The %s class is deprecated since version 3.3 and will be removed in 4.0. Use EventDispatcher with closure factories instead.', __CLASS__), E_USER_DEPRECATED); + @trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use EventDispatcher with closure factories instead.', __CLASS__), E_USER_DEPRECATED); foreach ($class::getSubscribedEvents() as $eventName => $params) { if (is_string($params)) { @@ -175,7 +163,7 @@ class ContainerAwareEventDispatcher extends EventDispatcher public function getContainer() { - @trigger_error('The '.__METHOD__.'() method is deprecated since version 3.3 as its class will be removed in 4.0. Inject the container or the services you need in your listeners/subscribers instead.', E_USER_DEPRECATED); + @trigger_error('The '.__METHOD__.'() method is deprecated since Symfony 3.3 as its class will be removed in 4.0. Inject the container or the services you need in your listeners/subscribers instead.', E_USER_DEPRECATED); return $this->container; } diff --git a/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php b/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php index 3f1035e1..9b5c689a 100644 --- a/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php +++ b/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php @@ -33,11 +33,6 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface private $dispatcher; private $wrappedListeners; - /** - * @param EventDispatcherInterface $dispatcher An EventDispatcherInterface instance - * @param Stopwatch $stopwatch A Stopwatch instance - * @param LoggerInterface $logger A LoggerInterface instance - */ public function __construct(EventDispatcherInterface $dispatcher, Stopwatch $stopwatch, LoggerInterface $logger = null) { $this->dispatcher = $dispatcher; @@ -212,6 +207,11 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface return $notCalled; } + public function reset() + { + $this->called = array(); + } + /** * Proxies all method calls to the original event dispatcher. * diff --git a/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcherInterface.php b/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcherInterface.php index 5483e815..f0212753 100644 --- a/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcherInterface.php +++ b/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcherInterface.php @@ -15,6 +15,8 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface; /** * @author Fabien Potencier <fabien@symfony.com> + * + * @method reset() Resets the trace. */ interface TraceableEventDispatcherInterface extends EventDispatcherInterface { diff --git a/vendor/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php b/vendor/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php index 887a7ec3..9f9c09c5 100644 --- a/vendor/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php +++ b/vendor/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php @@ -24,21 +24,13 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; */ class RegisterListenersPass implements CompilerPassInterface { - /** - * @var string - */ protected $dispatcherService; - - /** - * @var string - */ protected $listenerTag; - - /** - * @var string - */ protected $subscriberTag; + private $hotPathEvents = array(); + private $hotPathTagName; + /** * @param string $dispatcherService Service name of the event dispatcher in processed container * @param string $listenerTag Tag name used for listener @@ -51,6 +43,14 @@ class RegisterListenersPass implements CompilerPassInterface $this->subscriberTag = $subscriberTag; } + public function setHotPathEvents(array $hotPathEvents, $tagName = 'container.hot_path') + { + $this->hotPathEvents = array_flip($hotPathEvents); + $this->hotPathTagName = $tagName; + + return $this; + } + public function process(ContainerBuilder $container) { if (!$container->hasDefinition($this->dispatcherService) && !$container->hasAlias($this->dispatcherService)) { @@ -76,6 +76,10 @@ class RegisterListenersPass implements CompilerPassInterface } $definition->addMethodCall('addListener', array($event['event'], array(new ServiceClosureArgument(new Reference($id)), $event['method']), $priority)); + + if (isset($this->hotPathEvents[$event['event']])) { + $container->getDefinition($id)->addTag($this->hotPathTagName); + } } } @@ -102,6 +106,10 @@ class RegisterListenersPass implements CompilerPassInterface foreach ($extractingDispatcher->listeners as $args) { $args[1] = array(new ServiceClosureArgument(new Reference($id)), $args[1]); $definition->addMethodCall('addListener', $args); + + if (isset($this->hotPathEvents[$args[0]])) { + $container->getDefinition($id)->addTag('container.hot_path'); + } } $extractingDispatcher->listeners = array(); } diff --git a/vendor/symfony/event-dispatcher/EventDispatcher.php b/vendor/symfony/event-dispatcher/EventDispatcher.php index 4630b01c..bc79a958 100644 --- a/vendor/symfony/event-dispatcher/EventDispatcher.php +++ b/vendor/symfony/event-dispatcher/EventDispatcher.php @@ -209,7 +209,7 @@ class EventDispatcher implements EventDispatcherInterface if ($event->isPropagationStopped()) { break; } - call_user_func($listener, $event, $eventName, $this); + \call_user_func($listener, $event, $eventName, $this); } } @@ -225,7 +225,7 @@ class EventDispatcher implements EventDispatcherInterface foreach ($this->listeners[$eventName] as $priority => $listeners) { foreach ($listeners as $k => $listener) { - if (is_array($listener) && isset($listener[0]) && $listener[0] instanceof \Closure) { + if (\is_array($listener) && isset($listener[0]) && $listener[0] instanceof \Closure) { $listener[0] = $listener[0](); $this->listeners[$eventName][$priority][$k] = $listener; } diff --git a/vendor/symfony/event-dispatcher/EventDispatcherInterface.php b/vendor/symfony/event-dispatcher/EventDispatcherInterface.php index 6e0b11fc..d3d0cb8a 100644 --- a/vendor/symfony/event-dispatcher/EventDispatcherInterface.php +++ b/vendor/symfony/event-dispatcher/EventDispatcherInterface.php @@ -26,7 +26,7 @@ interface EventDispatcherInterface * @param string $eventName The name of the event to dispatch. The name of * the event is the name of the method that is * invoked on listeners. - * @param Event $event the event to pass to the event handlers/listeners + * @param Event $event The event to pass to the event handlers/listeners * If not supplied, an empty Event instance is created * * @return Event @@ -48,8 +48,6 @@ interface EventDispatcherInterface * * The subscriber is asked for all the events he is * interested in and added as a listener for these events. - * - * @param EventSubscriberInterface $subscriber The subscriber */ public function addSubscriber(EventSubscriberInterface $subscriber); @@ -61,11 +59,6 @@ interface EventDispatcherInterface */ public function removeListener($eventName, $listener); - /** - * Removes an event subscriber. - * - * @param EventSubscriberInterface $subscriber The subscriber - */ public function removeSubscriber(EventSubscriberInterface $subscriber); /** diff --git a/vendor/symfony/event-dispatcher/GenericEvent.php b/vendor/symfony/event-dispatcher/GenericEvent.php index a7520a0f..95c99408 100644 --- a/vendor/symfony/event-dispatcher/GenericEvent.php +++ b/vendor/symfony/event-dispatcher/GenericEvent.php @@ -20,24 +20,13 @@ namespace Symfony\Component\EventDispatcher; */ class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate { - /** - * Event subject. - * - * @var mixed usually object or callable - */ protected $subject; - - /** - * Array of arguments. - * - * @var array - */ protected $arguments; /** * Encapsulate an event with $subject and $args. * - * @param mixed $subject The subject of the event, usually an object + * @param mixed $subject The subject of the event, usually an object or a callable * @param array $arguments Arguments to store in the event */ public function __construct($subject = null, array $arguments = array()) diff --git a/vendor/symfony/event-dispatcher/ImmutableEventDispatcher.php b/vendor/symfony/event-dispatcher/ImmutableEventDispatcher.php index 7f2be8d3..b3cf56c5 100644 --- a/vendor/symfony/event-dispatcher/ImmutableEventDispatcher.php +++ b/vendor/symfony/event-dispatcher/ImmutableEventDispatcher.php @@ -18,18 +18,8 @@ namespace Symfony\Component\EventDispatcher; */ class ImmutableEventDispatcher implements EventDispatcherInterface { - /** - * The proxied dispatcher. - * - * @var EventDispatcherInterface - */ private $dispatcher; - /** - * Creates an unmodifiable proxy for an event dispatcher. - * - * @param EventDispatcherInterface $dispatcher The proxied event dispatcher - */ public function __construct(EventDispatcherInterface $dispatcher) { $this->dispatcher = $dispatcher; diff --git a/vendor/symfony/event-dispatcher/LICENSE b/vendor/symfony/event-dispatcher/LICENSE index 17d16a13..21d7fb9e 100644 --- a/vendor/symfony/event-dispatcher/LICENSE +++ b/vendor/symfony/event-dispatcher/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2017 Fabien Potencier +Copyright (c) 2004-2018 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/symfony/event-dispatcher/Tests/ContainerAwareEventDispatcherTest.php b/vendor/symfony/event-dispatcher/Tests/ContainerAwareEventDispatcherTest.php index 18055614..9d5eecc5 100644 --- a/vendor/symfony/event-dispatcher/Tests/ContainerAwareEventDispatcherTest.php +++ b/vendor/symfony/event-dispatcher/Tests/ContainerAwareEventDispatcherTest.php @@ -143,7 +143,7 @@ class ContainerAwareEventDispatcherTest extends AbstractEventDispatcherTest $listeners = $dispatcher->getListeners(); - $this->assertTrue(isset($listeners['onEvent'])); + $this->assertArrayHasKey('onEvent', $listeners); $this->assertCount(1, $dispatcher->getListeners('onEvent')); } diff --git a/vendor/symfony/event-dispatcher/Tests/Debug/TraceableEventDispatcherTest.php b/vendor/symfony/event-dispatcher/Tests/Debug/TraceableEventDispatcherTest.php index a1cf6708..53a3421a 100644 --- a/vendor/symfony/event-dispatcher/Tests/Debug/TraceableEventDispatcherTest.php +++ b/vendor/symfony/event-dispatcher/Tests/Debug/TraceableEventDispatcherTest.php @@ -124,6 +124,21 @@ class TraceableEventDispatcherTest extends TestCase $this->assertEquals(array(), $tdispatcher->getNotCalledListeners()); } + public function testClearCalledListeners() + { + $tdispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch()); + $tdispatcher->addListener('foo', function () {}, 5); + + $tdispatcher->dispatch('foo'); + $tdispatcher->reset(); + + $listeners = $tdispatcher->getNotCalledListeners(); + $this->assertArrayHasKey('stub', $listeners['foo.closure']); + unset($listeners['foo.closure']['stub']); + $this->assertEquals(array(), $tdispatcher->getCalledListeners()); + $this->assertEquals(array('foo.closure' => array('event' => 'foo', 'pretty' => 'closure', 'priority' => 5)), $listeners); + } + public function testGetCalledListenersNested() { $tdispatcher = null; diff --git a/vendor/symfony/event-dispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php b/vendor/symfony/event-dispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php index d46d8c59..dbb1aa5c 100644 --- a/vendor/symfony/event-dispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php +++ b/vendor/symfony/event-dispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php @@ -141,6 +141,18 @@ class RegisterListenersPassTest extends TestCase $this->assertEquals($expectedCalls, $definition->getMethodCalls()); } + public function testHotPathEvents() + { + $container = new ContainerBuilder(); + + $container->register('foo', SubscriberService::class)->addTag('kernel.event_subscriber', array()); + $container->register('event_dispatcher', 'stdClass'); + + (new RegisterListenersPass())->setHotPathEvents(array('event'))->process($container); + + $this->assertTrue($container->getDefinition('foo')->hasTag('container.hot_path')); + } + /** * @expectedException \InvalidArgumentException * @expectedExceptionMessage You have requested a non-existent parameter "subscriber.class" diff --git a/vendor/symfony/event-dispatcher/Tests/GenericEventTest.php b/vendor/symfony/event-dispatcher/Tests/GenericEventTest.php index c84d3ac2..9cf68c98 100644 --- a/vendor/symfony/event-dispatcher/Tests/GenericEventTest.php +++ b/vendor/symfony/event-dispatcher/Tests/GenericEventTest.php @@ -114,8 +114,8 @@ class GenericEventTest extends TestCase public function testOffsetIsset() { - $this->assertTrue(isset($this->event['name'])); - $this->assertFalse(isset($this->event['nameNotExist'])); + $this->assertArrayHasKey('name', $this->event); + $this->assertArrayNotHasKey('nameNotExist', $this->event); } public function testHasArgument() diff --git a/vendor/symfony/event-dispatcher/composer.json b/vendor/symfony/event-dispatcher/composer.json index 994e8ca6..75b881b9 100644 --- a/vendor/symfony/event-dispatcher/composer.json +++ b/vendor/symfony/event-dispatcher/composer.json @@ -19,10 +19,10 @@ "php": "^5.5.9|>=7.0.8" }, "require-dev": { - "symfony/dependency-injection": "~3.3", - "symfony/expression-language": "~2.8|~3.0", - "symfony/config": "~2.8|~3.0", - "symfony/stopwatch": "~2.8|~3.0", + "symfony/dependency-injection": "~3.3|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/config": "~2.8|~3.0|~4.0", + "symfony/stopwatch": "~2.8|~3.0|~4.0", "psr/log": "~1.0" }, "conflict": { @@ -41,7 +41,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } } } diff --git a/vendor/symfony/http-foundation/AcceptHeader.php b/vendor/symfony/http-foundation/AcceptHeader.php index 99be6768..d1740266 100644 --- a/vendor/symfony/http-foundation/AcceptHeader.php +++ b/vendor/symfony/http-foundation/AcceptHeader.php @@ -97,8 +97,6 @@ class AcceptHeader /** * Adds an item. * - * @param AcceptHeaderItem $item - * * @return $this */ public function add(AcceptHeaderItem $item) @@ -153,7 +151,7 @@ class AcceptHeader private function sort() { if (!$this->sorted) { - uasort($this->items, function ($a, $b) { + uasort($this->items, function (AcceptHeaderItem $a, AcceptHeaderItem $b) { $qA = $a->getQuality(); $qB = $b->getQuality(); diff --git a/vendor/symfony/http-foundation/AcceptHeaderItem.php b/vendor/symfony/http-foundation/AcceptHeaderItem.php index e07a48aa..c69dbbba 100644 --- a/vendor/symfony/http-foundation/AcceptHeaderItem.php +++ b/vendor/symfony/http-foundation/AcceptHeaderItem.php @@ -18,24 +18,9 @@ namespace Symfony\Component\HttpFoundation; */ class AcceptHeaderItem { - /** - * @var string - */ private $value; - - /** - * @var float - */ private $quality = 1.0; - - /** - * @var int - */ private $index = 0; - - /** - * @var array - */ private $attributes = array(); /** diff --git a/vendor/symfony/http-foundation/BinaryFileResponse.php b/vendor/symfony/http-foundation/BinaryFileResponse.php index 4394863e..10102230 100644 --- a/vendor/symfony/http-foundation/BinaryFileResponse.php +++ b/vendor/symfony/http-foundation/BinaryFileResponse.php @@ -139,7 +139,7 @@ class BinaryFileResponse extends Response */ public function setAutoEtag() { - $this->setEtag(sha1_file($this->file->getPathname())); + $this->setEtag(base64_encode(hash_file('sha256', $this->file->getPathname(), true))); return $this; } diff --git a/vendor/symfony/http-foundation/CHANGELOG.md b/vendor/symfony/http-foundation/CHANGELOG.md index e1fdf77b..ee5b6cec 100644 --- a/vendor/symfony/http-foundation/CHANGELOG.md +++ b/vendor/symfony/http-foundation/CHANGELOG.md @@ -1,6 +1,16 @@ CHANGELOG ========= +3.4.0 +----- + + * implemented PHP 7.0's `SessionUpdateTimestampHandlerInterface` with a new + `AbstractSessionHandler` base class and a new `StrictSessionHandler` wrapper + * deprecated the `WriteCheckSessionHandler`, `NativeSessionHandler` and `NativeProxy` classes + * deprecated setting session save handlers that do not implement `\SessionHandlerInterface` in `NativeSessionStorage::setSaveHandler()` + * deprecated using `MongoDbSessionHandler` with the legacy mongo extension; use it with the mongodb/mongodb package and ext-mongodb instead + * deprecated `MemcacheSessionHandler`; use `MemcachedSessionHandler` instead + 3.3.0 ----- diff --git a/vendor/symfony/http-foundation/File/MimeType/ExtensionGuesser.php b/vendor/symfony/http-foundation/File/MimeType/ExtensionGuesser.php index 921751f6..263fb321 100644 --- a/vendor/symfony/http-foundation/File/MimeType/ExtensionGuesser.php +++ b/vendor/symfony/http-foundation/File/MimeType/ExtensionGuesser.php @@ -65,8 +65,6 @@ class ExtensionGuesser implements ExtensionGuesserInterface * Registers a new extension guesser. * * When guessing, this guesser is preferred over previously registered ones. - * - * @param ExtensionGuesserInterface $guesser */ public function register(ExtensionGuesserInterface $guesser) { diff --git a/vendor/symfony/http-foundation/File/MimeType/MimeTypeExtensionGuesser.php b/vendor/symfony/http-foundation/File/MimeType/MimeTypeExtensionGuesser.php index e327f834..896c135a 100644 --- a/vendor/symfony/http-foundation/File/MimeType/MimeTypeExtensionGuesser.php +++ b/vendor/symfony/http-foundation/File/MimeType/MimeTypeExtensionGuesser.php @@ -23,8 +23,6 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface * This list has been updated from upstream on 2013-04-23. * * @see http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types - * - * @var array */ protected $defaultExtensions = array( 'application/andrew-inset' => 'ez', diff --git a/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesser.php b/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesser.php index 69c803b4..e3ef45ef 100644 --- a/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesser.php +++ b/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesser.php @@ -93,8 +93,6 @@ class MimeTypeGuesser implements MimeTypeGuesserInterface * Registers a new mime type guesser. * * When guessing, this guesser is preferred over previously registered ones. - * - * @param MimeTypeGuesserInterface $guesser */ public function register(MimeTypeGuesserInterface $guesser) { diff --git a/vendor/symfony/http-foundation/File/UploadedFile.php b/vendor/symfony/http-foundation/File/UploadedFile.php index 9a2d2849..082d8d53 100644 --- a/vendor/symfony/http-foundation/File/UploadedFile.php +++ b/vendor/symfony/http-foundation/File/UploadedFile.php @@ -24,41 +24,10 @@ use Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesser; */ class UploadedFile extends File { - /** - * Whether the test mode is activated. - * - * Local files are used in test mode hence the code should not enforce HTTP uploads. - * - * @var bool - */ private $test = false; - - /** - * The original name of the uploaded file. - * - * @var string - */ private $originalName; - - /** - * The mime type provided by the uploader. - * - * @var string - */ private $mimeType; - - /** - * The file size provided by the uploader. - * - * @var int|null - */ private $size; - - /** - * The UPLOAD_ERR_XXX constant provided by the uploader. - * - * @var int - */ private $error; /** @@ -76,11 +45,12 @@ class UploadedFile extends File * Calling any other method on an non-valid instance will cause an unpredictable result. * * @param string $path The full temporary path to the file - * @param string $originalName The original file name + * @param string $originalName The original file name of the uploaded file * @param string|null $mimeType The type of the file as provided by PHP; null defaults to application/octet-stream - * @param int|null $size The file size + * @param int|null $size The file size provided by the uploader * @param int|null $error The error constant of the upload (one of PHP's UPLOAD_ERR_XXX constants); null defaults to UPLOAD_ERR_OK * @param bool $test Whether the test mode is active + * Local files are used in test mode hence the code should not enforce HTTP uploads * * @throws FileException If file_uploads is disabled * @throws FileNotFoundException If the file does not exist diff --git a/vendor/symfony/http-foundation/FileBag.php b/vendor/symfony/http-foundation/FileBag.php index 722ec2a9..5edd0e62 100644 --- a/vendor/symfony/http-foundation/FileBag.php +++ b/vendor/symfony/http-foundation/FileBag.php @@ -87,7 +87,10 @@ class FileBag extends ParameterBag $file = new UploadedFile($file['tmp_name'], $file['name'], $file['type'], $file['size'], $file['error']); } } else { - $file = array_filter(array_map(array($this, 'convertFileInformation'), $file)); + $file = array_map(array($this, 'convertFileInformation'), $file); + if (array_keys($keys) === $keys) { + $file = array_filter($file); + } } } @@ -106,8 +109,6 @@ class FileBag extends ParameterBag * It's safe to pass an already converted array, in which case this method * just returns the original array unmodified. * - * @param array $data - * * @return array */ protected function fixPhpFilesArray($data) diff --git a/vendor/symfony/http-foundation/HeaderBag.php b/vendor/symfony/http-foundation/HeaderBag.php index e0b51ad1..7aaa52ae 100644 --- a/vendor/symfony/http-foundation/HeaderBag.php +++ b/vendor/symfony/http-foundation/HeaderBag.php @@ -101,11 +101,11 @@ class HeaderBag implements \IteratorAggregate, \Countable /** * Returns a header value by name. * - * @param string $key The header name - * @param mixed $default The default value - * @param bool $first Whether to return the first value or all header values + * @param string $key The header name + * @param string|string[] $default The default value + * @param bool $first Whether to return the first value or all header values * - * @return string|array The first header value if $first is true, an array of values otherwise + * @return string|string[] The first header value or default value if $first is true, an array of values otherwise */ public function get($key, $default = null, $first = true) { @@ -121,7 +121,7 @@ class HeaderBag implements \IteratorAggregate, \Countable } if ($first) { - return count($headers[$key]) ? $headers[$key][0] : $default; + return \count($headers[$key]) ? $headers[$key][0] : $default; } return $headers[$key]; @@ -130,24 +130,32 @@ class HeaderBag implements \IteratorAggregate, \Countable /** * Sets a header by name. * - * @param string $key The key - * @param string|array $values The value or an array of values - * @param bool $replace Whether to replace the actual value or not (true by default) + * @param string $key The key + * @param string|string[] $values The value or an array of values + * @param bool $replace Whether to replace the actual value or not (true by default) */ public function set($key, $values, $replace = true) { $key = str_replace('_', '-', strtolower($key)); - $values = array_values((array) $values); + if (\is_array($values)) { + $values = array_values($values); - if (true === $replace || !isset($this->headers[$key])) { - $this->headers[$key] = $values; + if (true === $replace || !isset($this->headers[$key])) { + $this->headers[$key] = $values; + } else { + $this->headers[$key] = array_merge($this->headers[$key], $values); + } } else { - $this->headers[$key] = array_merge($this->headers[$key], $values); + if (true === $replace || !isset($this->headers[$key])) { + $this->headers[$key] = array($values); + } else { + $this->headers[$key][] = $values; + } } if ('cache-control' === $key) { - $this->cacheControl = $this->parseCacheControl($values[0]); + $this->cacheControl = $this->parseCacheControl(implode(', ', $this->headers[$key])); } } diff --git a/vendor/symfony/http-foundation/IpUtils.php b/vendor/symfony/http-foundation/IpUtils.php index dc6d3ec8..86d135b2 100644 --- a/vendor/symfony/http-foundation/IpUtils.php +++ b/vendor/symfony/http-foundation/IpUtils.php @@ -87,6 +87,10 @@ class IpUtils $netmask = 32; } + if (false === ip2long($address)) { + return self::$checkedIps[$cacheKey] = false; + } + return self::$checkedIps[$cacheKey] = 0 === substr_compare(sprintf('%032b', ip2long($requestIp)), sprintf('%032b', ip2long($address)), 0, $netmask); } @@ -119,6 +123,10 @@ class IpUtils if (false !== strpos($ip, '/')) { list($address, $netmask) = explode('/', $ip, 2); + if ('0' === $netmask) { + return (bool) unpack('n*', @inet_pton($address)); + } + if ($netmask < 1 || $netmask > 128) { return self::$checkedIps[$cacheKey] = false; } diff --git a/vendor/symfony/http-foundation/LICENSE b/vendor/symfony/http-foundation/LICENSE index 17d16a13..21d7fb9e 100644 --- a/vendor/symfony/http-foundation/LICENSE +++ b/vendor/symfony/http-foundation/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2017 Fabien Potencier +Copyright (c) 2004-2018 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/symfony/http-foundation/ParameterBag.php b/vendor/symfony/http-foundation/ParameterBag.php index 3d278914..257ef8bc 100644 --- a/vendor/symfony/http-foundation/ParameterBag.php +++ b/vendor/symfony/http-foundation/ParameterBag.php @@ -20,8 +20,6 @@ class ParameterBag implements \IteratorAggregate, \Countable { /** * Parameter storage. - * - * @var array */ protected $parameters; diff --git a/vendor/symfony/http-foundation/RedirectResponse.php b/vendor/symfony/http-foundation/RedirectResponse.php index cb1c58e8..01681dcd 100644 --- a/vendor/symfony/http-foundation/RedirectResponse.php +++ b/vendor/symfony/http-foundation/RedirectResponse.php @@ -48,7 +48,13 @@ class RedirectResponse extends Response } /** - * {@inheritdoc} + * Factory method for chainability. + * + * @param string $url The url to redirect to + * @param int $status The response status code + * @param array $headers An array of response headers + * + * @return static */ public static function create($url = '', $status = 302, $headers = array()) { diff --git a/vendor/symfony/http-foundation/Request.php b/vendor/symfony/http-foundation/Request.php index 28e78c0a..be55069e 100644 --- a/vendor/symfony/http-foundation/Request.php +++ b/vendor/symfony/http-foundation/Request.php @@ -144,7 +144,7 @@ class Request public $headers; /** - * @var string + * @var string|resource */ protected $content; @@ -221,7 +221,6 @@ class Request protected static $requestFactory; private $isHostValid = true; - private $isClientIpsValid = true; private $isForwardedValid = true; private static $trustedHeaderSet = -1; @@ -330,13 +329,13 @@ class Request * The information contained in the URI always take precedence * over the other information (server and parameters). * - * @param string $uri The URI - * @param string $method The HTTP method - * @param array $parameters The query (GET) or request (POST) parameters - * @param array $cookies The request cookies ($_COOKIE) - * @param array $files The request files ($_FILES) - * @param array $server The server parameters ($_SERVER) - * @param string $content The raw body data + * @param string $uri The URI + * @param string $method The HTTP method + * @param array $parameters The query (GET) or request (POST) parameters + * @param array $cookies The request cookies ($_COOKIE) + * @param array $files The request files ($_FILES) + * @param array $server The server parameters ($_SERVER) + * @param string|resource $content The raw body data * * @return static */ @@ -532,9 +531,21 @@ class Request return trigger_error($e, E_USER_ERROR); } + $cookieHeader = ''; + $cookies = array(); + + foreach ($this->cookies as $k => $v) { + $cookies[] = $k.'='.$v; + } + + if (!empty($cookies)) { + $cookieHeader = 'Cookie: '.implode('; ', $cookies)."\r\n"; + } + return sprintf('%s %s %s', $this->getMethod(), $this->getRequestUri(), $this->server->get('SERVER_PROTOCOL'))."\r\n". - $this->headers."\r\n". + $this->headers. + $cookieHeader."\r\n". $content; } @@ -588,7 +599,7 @@ class Request self::$trustedProxies = $proxies; if (2 > func_num_args()) { - @trigger_error(sprintf('The %s() method expects a bit field of Request::HEADER_* as second argument since version 3.3. Defining it will be required in 4.0. ', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The %s() method expects a bit field of Request::HEADER_* as second argument since Symfony 3.3. Defining it will be required in 4.0. ', __METHOD__), E_USER_DEPRECATED); return; } @@ -668,7 +679,7 @@ class Request */ public static function setTrustedHeaderName($key, $value) { - @trigger_error(sprintf('The "%s()" method is deprecated since version 3.3 and will be removed in 4.0. Use the $trustedHeaderSet argument of the Request::setTrustedProxies() method instead.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the $trustedHeaderSet argument of the Request::setTrustedProxies() method instead.', __METHOD__), E_USER_DEPRECATED); if ('forwarded' === $key) { $key = self::HEADER_FORWARDED; @@ -708,7 +719,7 @@ class Request public static function getTrustedHeaderName($key) { if (2 > func_num_args() || func_get_arg(1)) { - @trigger_error(sprintf('The "%s()" method is deprecated since version 3.3 and will be removed in 4.0. Use the Request::getTrustedHeaderSet() method instead.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the Request::getTrustedHeaderSet() method instead.', __METHOD__), E_USER_DEPRECATED); } if (!array_key_exists($key, self::$trustedHeaders)) { @@ -796,8 +807,8 @@ class Request * * Order of precedence: PATH (routing placeholders or custom attributes), GET, BODY * - * @param string $key the key - * @param mixed $default the default value if the parameter key does not exist + * @param string $key The key + * @param mixed $default The default value if the parameter key does not exist * * @return mixed */ @@ -1549,7 +1560,7 @@ class Request if (!func_num_args() || func_get_arg(0)) { // This deprecation should be turned into a BadMethodCallException in 4.0 (without adding the argument in the signature) // then setting $andCacheable to false should be deprecated in 4.1 - @trigger_error('Checking only for cacheable HTTP methods with Symfony\Component\HttpFoundation\Request::isMethodSafe() is deprecated since version 3.2 and will throw an exception in 4.0. Disable checking only for cacheable methods by calling the method with `false` as first argument or use the Request::isMethodCacheable() instead.', E_USER_DEPRECATED); + @trigger_error('Checking only for cacheable HTTP methods with Symfony\Component\HttpFoundation\Request::isMethodSafe() is deprecated since Symfony 3.2 and will throw an exception in 4.0. Disable checking only for cacheable methods by calling the method with `false` as first argument or use the Request::isMethodCacheable() instead.', E_USER_DEPRECATED); return in_array($this->getMethod(), array('GET', 'HEAD')); } @@ -1579,6 +1590,30 @@ class Request return in_array($this->getMethod(), array('GET', 'HEAD')); } + /** + * Returns the protocol version. + * + * If the application is behind a proxy, the protocol version used in the + * requests between the client and the proxy and between the proxy and the + * server might be different. This returns the former (from the "Via" header) + * if the proxy is trusted (see "setTrustedProxies()"), otherwise it returns + * the latter (from the "SERVER_PROTOCOL" server parameter). + * + * @return string + */ + public function getProtocolVersion() + { + if ($this->isFromTrustedProxy()) { + preg_match('~^(HTTP/)?([1-9]\.[0-9]) ~', $this->headers->get('Via'), $matches); + + if ($matches) { + return 'HTTP/'.$matches[2]; + } + } + + return $this->server->get('SERVER_PROTOCOL'); + } + /** * Returns the request body content. * @@ -1863,6 +1898,9 @@ class Request // Does the baseUrl have anything in common with the request_uri? $requestUri = $this->getRequestUri(); + if ('' !== $requestUri && '/' !== $requestUri[0]) { + $requestUri = '/'.$requestUri; + } if ($baseUrl && false !== $prefix = $this->getUrlencodedPrefix($requestUri, $baseUrl)) { // full $baseUrl matches @@ -1902,12 +1940,12 @@ class Request */ protected function prepareBasePath() { - $filename = basename($this->server->get('SCRIPT_FILENAME')); $baseUrl = $this->getBaseUrl(); if (empty($baseUrl)) { return ''; } + $filename = basename($this->server->get('SCRIPT_FILENAME')); if (basename($baseUrl) === $filename) { $basePath = dirname($baseUrl); } else { @@ -1928,23 +1966,26 @@ class Request */ protected function preparePathInfo() { - $baseUrl = $this->getBaseUrl(); - if (null === ($requestUri = $this->getRequestUri())) { return '/'; } // Remove the query string from REQUEST_URI - if ($pos = strpos($requestUri, '?')) { + if (false !== $pos = strpos($requestUri, '?')) { $requestUri = substr($requestUri, 0, $pos); } + if ('' !== $requestUri && '/' !== $requestUri[0]) { + $requestUri = '/'.$requestUri; + } + + if (null === ($baseUrl = $this->getBaseUrl())) { + return $requestUri; + } $pathInfo = substr($requestUri, strlen($baseUrl)); - if (null !== $baseUrl && (false === $pathInfo || '' === $pathInfo)) { + if (false === $pathInfo || '' === $pathInfo) { // If substr() returns false then PATH_INFO is set to an empty string return '/'; - } elseif (null === $baseUrl) { - return $requestUri; } return (string) $pathInfo; @@ -1961,6 +2002,7 @@ class Request 'js' => array('application/javascript', 'application/x-javascript', 'text/javascript'), 'css' => array('text/css'), 'json' => array('application/json', 'application/x-json'), + 'jsonld' => array('application/ld+json'), 'xml' => array('text/xml', 'application/xml', 'application/x-xml'), 'rdf' => array('application/rdf+xml'), 'atom' => array('application/atom+xml'), diff --git a/vendor/symfony/http-foundation/RequestMatcherInterface.php b/vendor/symfony/http-foundation/RequestMatcherInterface.php index 066e7e8b..c26db3e6 100644 --- a/vendor/symfony/http-foundation/RequestMatcherInterface.php +++ b/vendor/symfony/http-foundation/RequestMatcherInterface.php @@ -21,8 +21,6 @@ interface RequestMatcherInterface /** * Decides whether the rule(s) implemented by the strategy matches the supplied request. * - * @param Request $request The request to check for a match - * * @return bool true if the request matches, false otherwise */ public function matches(Request $request); diff --git a/vendor/symfony/http-foundation/Response.php b/vendor/symfony/http-foundation/Response.php index ced0afa6..cf1325af 100644 --- a/vendor/symfony/http-foundation/Response.php +++ b/vendor/symfony/http-foundation/Response.php @@ -126,6 +126,7 @@ class Response 100 => 'Continue', 101 => 'Switching Protocols', 102 => 'Processing', // RFC2518 + 103 => 'Early Hints', 200 => 'OK', 201 => 'Created', 202 => 'Accepted', @@ -199,11 +200,6 @@ class Response $this->setContent($content); $this->setStatusCode($status); $this->setProtocolVersion('1.0'); - - /* RFC2616 - 14.18 says all Responses need to have a Date */ - if (!$this->headers->has('Date')) { - $this->setDate(\DateTime::createFromFormat('U', time())); - } } /** @@ -259,8 +255,6 @@ class Response * compliant with RFC 2616. Most of the changes are based on * the Request that is "associated" with this Response. * - * @param Request $request A Request instance - * * @return $this */ public function prepare(Request $request) @@ -332,11 +326,6 @@ class Response return $this; } - /* RFC2616 - 14.18 says all Responses need to have a Date */ - if (!$this->headers->has('Date')) { - $this->setDate(\DateTime::createFromFormat('U', time())); - } - // headers foreach ($this->headers->allPreserveCaseWithoutCookies() as $name => $values) { foreach ($values as $value) { @@ -618,6 +607,38 @@ class Response return $this; } + /** + * Marks the response as "immutable". + * + * @param bool $immutable enables or disables the immutable directive + * + * @return $this + * + * @final + */ + public function setImmutable($immutable = true) + { + if ($immutable) { + $this->headers->addCacheControlDirective('immutable'); + } else { + $this->headers->removeCacheControlDirective('immutable'); + } + + return $this; + } + + /** + * Returns true if the response is marked as "immutable". + * + * @return bool returns true if the response is marked as "immutable"; otherwise false + * + * @final + */ + public function isImmutable() + { + return $this->headers->hasCacheControlDirective('immutable'); + } + /** * Returns true if the response must be revalidated by caches. * @@ -646,23 +667,12 @@ class Response */ public function getDate() { - /* - RFC2616 - 14.18 says all Responses need to have a Date. - Make sure we provide one even if it the header - has been removed in the meantime. - */ - if (!$this->headers->has('Date')) { - $this->setDate(\DateTime::createFromFormat('U', time())); - } - return $this->headers->getDate('Date'); } /** * Sets the Date header. * - * @param \DateTime $date A \DateTime instance - * * @return $this * * @final since version 3.2 @@ -942,7 +952,7 @@ class Response /** * Sets the response's cache headers (validation and/or expiration). * - * Available options are: etag, last_modified, max_age, s_maxage, private, and public. + * Available options are: etag, last_modified, max_age, s_maxage, private, public and immutable. * * @param array $options An array of cache options * @@ -954,7 +964,7 @@ class Response */ public function setCache(array $options) { - if ($diff = array_diff(array_keys($options), array('etag', 'last_modified', 'max_age', 's_maxage', 'private', 'public'))) { + if ($diff = array_diff(array_keys($options), array('etag', 'last_modified', 'max_age', 's_maxage', 'private', 'public', 'immutable'))) { throw new \InvalidArgumentException(sprintf('Response does not support the following options: "%s".', implode('", "', array_values($diff)))); } @@ -990,6 +1000,10 @@ class Response } } + if (isset($options['immutable'])) { + $this->setImmutable((bool) $options['immutable']); + } + return $this; } @@ -1075,8 +1089,6 @@ class Response * If the Response is not modified, it sets the status code to 304 and * removes the actual content by calling the setNotModified() method. * - * @param Request $request A Request instance - * * @return bool true if the Response validators match the Request, false otherwise * * @final since version 3.3 diff --git a/vendor/symfony/http-foundation/ResponseHeaderBag.php b/vendor/symfony/http-foundation/ResponseHeaderBag.php index 7b91e4f1..11a85932 100644 --- a/vendor/symfony/http-foundation/ResponseHeaderBag.php +++ b/vendor/symfony/http-foundation/ResponseHeaderBag.php @@ -24,24 +24,10 @@ class ResponseHeaderBag extends HeaderBag const DISPOSITION_ATTACHMENT = 'attachment'; const DISPOSITION_INLINE = 'inline'; - /** - * @var array - */ protected $computedCacheControl = array(); - - /** - * @var array - */ protected $cookies = array(); - - /** - * @var array - */ protected $headerNames = array(); - /** - * @param array $headers An array of HTTP headers - */ public function __construct(array $headers = array()) { parent::__construct($headers); @@ -49,6 +35,11 @@ class ResponseHeaderBag extends HeaderBag if (!isset($this->headers['cache-control'])) { $this->set('Cache-Control', ''); } + + /* RFC2616 - 14.18 says all Responses need to have a Date */ + if (!isset($this->headers['date'])) { + $this->initDate(); + } } /** @@ -88,6 +79,10 @@ class ResponseHeaderBag extends HeaderBag if (!isset($this->headers['cache-control'])) { $this->set('Cache-Control', ''); } + + if (!isset($this->headers['date'])) { + $this->initDate(); + } } /** @@ -127,7 +122,7 @@ class ResponseHeaderBag extends HeaderBag parent::set($key, $values, $replace); // ensure the cache-control header has sensible defaults - if (in_array($uniqueKey, array('cache-control', 'etag', 'last-modified', 'expires'))) { + if (\in_array($uniqueKey, array('cache-control', 'etag', 'last-modified', 'expires'), true)) { $computed = $this->computeCacheControlValue(); $this->headers['cache-control'] = array($computed); $this->headerNames['cache-control'] = 'Cache-Control'; @@ -154,6 +149,10 @@ class ResponseHeaderBag extends HeaderBag if ('cache-control' === $uniqueKey) { $this->computedCacheControl = array(); } + + if ('date' === $uniqueKey) { + $this->initDate(); + } } /** @@ -172,11 +171,6 @@ class ResponseHeaderBag extends HeaderBag return array_key_exists($key, $this->computedCacheControl) ? $this->computedCacheControl[$key] : null; } - /** - * Sets a cookie. - * - * @param Cookie $cookie - */ public function setCookie(Cookie $cookie) { $this->cookies[$cookie->getDomain()][$cookie->getPath()][$cookie->getName()] = $cookie; @@ -336,4 +330,11 @@ class ResponseHeaderBag extends HeaderBag return $header; } + + private function initDate() + { + $now = \DateTime::createFromFormat('U', time()); + $now->setTimezone(new \DateTimeZone('UTC')); + $this->set('Date', $now->format('D, d M Y H:i:s').' GMT'); + } } diff --git a/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php b/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php index 57c29719..ea1fda29 100644 --- a/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php +++ b/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php @@ -17,15 +17,8 @@ namespace Symfony\Component\HttpFoundation\Session\Attribute; class AttributeBag implements AttributeBagInterface, \IteratorAggregate, \Countable { private $name = 'attributes'; - - /** - * @var string - */ private $storageKey; - /** - * @var array - */ protected $attributes = array(); /** diff --git a/vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php b/vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php index e149801a..abbf37ee 100644 --- a/vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php +++ b/vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php @@ -19,11 +19,6 @@ namespace Symfony\Component\HttpFoundation\Session\Attribute; */ class NamespacedAttributeBag extends AttributeBag { - /** - * Namespace character. - * - * @var string - */ private $namespaceCharacter; /** diff --git a/vendor/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php b/vendor/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php index 8110aee0..77521c24 100644 --- a/vendor/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php +++ b/vendor/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php @@ -19,25 +19,13 @@ namespace Symfony\Component\HttpFoundation\Session\Flash; class AutoExpireFlashBag implements FlashBagInterface { private $name = 'flashes'; - - /** - * Flash messages. - * - * @var array - */ private $flashes = array('display' => array(), 'new' => array()); - - /** - * The storage key for flashes in the session. - * - * @var string - */ private $storageKey; /** * @param string $storageKey The key used to store flashes in the session */ - public function __construct($storageKey = '_sf2_flashes') + public function __construct($storageKey = '_symfony_flashes') { $this->storageKey = $storageKey; } @@ -118,7 +106,7 @@ class AutoExpireFlashBag implements FlashBagInterface public function all() { $return = $this->flashes['display']; - $this->flashes = array('new' => array(), 'display' => array()); + $this->flashes['display'] = array(); return $return; } diff --git a/vendor/symfony/http-foundation/Session/Flash/FlashBag.php b/vendor/symfony/http-foundation/Session/Flash/FlashBag.php index a86dc6c1..12fb740c 100644 --- a/vendor/symfony/http-foundation/Session/Flash/FlashBag.php +++ b/vendor/symfony/http-foundation/Session/Flash/FlashBag.php @@ -19,25 +19,13 @@ namespace Symfony\Component\HttpFoundation\Session\Flash; class FlashBag implements FlashBagInterface { private $name = 'flashes'; - - /** - * Flash messages. - * - * @var array - */ private $flashes = array(); - - /** - * The storage key for flashes in the session. - * - * @var string - */ private $storageKey; /** * @param string $storageKey The key used to store flashes in the session */ - public function __construct($storageKey = '_sf2_flashes') + public function __construct($storageKey = '_symfony_flashes') { $this->storageKey = $storageKey; } diff --git a/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php b/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php index 25f3d57b..80e97f17 100644 --- a/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php +++ b/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php @@ -72,8 +72,6 @@ interface FlashBagInterface extends SessionBagInterface /** * Sets all flash messages. - * - * @param array $messages */ public function setAll(array $messages); diff --git a/vendor/symfony/http-foundation/Session/Session.php b/vendor/symfony/http-foundation/Session/Session.php index f063651a..a46cffbb 100644 --- a/vendor/symfony/http-foundation/Session/Session.php +++ b/vendor/symfony/http-foundation/Session/Session.php @@ -24,22 +24,12 @@ use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage; */ class Session implements SessionInterface, \IteratorAggregate, \Countable { - /** - * Storage driver. - * - * @var SessionStorageInterface - */ protected $storage; - /** - * @var string - */ private $flashName; - - /** - * @var string - */ private $attributeName; + private $data = array(); + private $hasBeenStarted; /** * @param SessionStorageInterface $storage A SessionStorageInterface instance @@ -120,7 +110,7 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable */ public function clear() { - $this->storage->getBag($this->attributeName)->clear(); + $this->getAttributeBag()->clear(); } /** @@ -151,6 +141,32 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable return count($this->getAttributeBag()->all()); } + /** + * @return bool + * + * @internal + */ + public function hasBeenStarted() + { + return $this->hasBeenStarted; + } + + /** + * @return bool + * + * @internal + */ + public function isEmpty() + { + foreach ($this->data as &$data) { + if (!empty($data)) { + return false; + } + } + + return true; + } + /** * {@inheritdoc} */ @@ -222,7 +238,7 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable */ public function registerBag(SessionBagInterface $bag) { - $this->storage->registerBag($bag); + $this->storage->registerBag(new SessionBagProxy($bag, $this->data, $this->hasBeenStarted)); } /** @@ -230,7 +246,7 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable */ public function getBag($name) { - return $this->storage->getBag($name); + return $this->storage->getBag($name)->getBag(); } /** @@ -252,6 +268,6 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable */ private function getAttributeBag() { - return $this->storage->getBag($this->attributeName); + return $this->getBag($this->attributeName); } } diff --git a/vendor/symfony/http-foundation/Session/SessionBagInterface.php b/vendor/symfony/http-foundation/Session/SessionBagInterface.php index aca18aac..8e37d06d 100644 --- a/vendor/symfony/http-foundation/Session/SessionBagInterface.php +++ b/vendor/symfony/http-foundation/Session/SessionBagInterface.php @@ -27,8 +27,6 @@ interface SessionBagInterface /** * Initializes the Bag. - * - * @param array $array */ public function initialize(array &$array); diff --git a/vendor/symfony/http-foundation/Session/SessionBagProxy.php b/vendor/symfony/http-foundation/Session/SessionBagProxy.php new file mode 100644 index 00000000..307836d5 --- /dev/null +++ b/vendor/symfony/http-foundation/Session/SessionBagProxy.php @@ -0,0 +1,82 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpFoundation\Session; + +/** + * @author Nicolas Grekas <p@tchwork.com> + * + * @internal + */ +final class SessionBagProxy implements SessionBagInterface +{ + private $bag; + private $data; + private $hasBeenStarted; + + public function __construct(SessionBagInterface $bag, array &$data, &$hasBeenStarted) + { + $this->bag = $bag; + $this->data = &$data; + $this->hasBeenStarted = &$hasBeenStarted; + } + + /** + * @return SessionBagInterface + */ + public function getBag() + { + return $this->bag; + } + + /** + * @return bool + */ + public function isEmpty() + { + return empty($this->data[$this->bag->getStorageKey()]); + } + + /** + * {@inheritdoc} + */ + public function getName() + { + return $this->bag->getName(); + } + + /** + * {@inheritdoc} + */ + public function initialize(array &$array) + { + $this->hasBeenStarted = true; + $this->data[$this->bag->getStorageKey()] = &$array; + + $this->bag->initialize($array); + } + + /** + * {@inheritdoc} + */ + public function getStorageKey() + { + return $this->bag->getStorageKey(); + } + + /** + * {@inheritdoc} + */ + public function clear() + { + return $this->bag->clear(); + } +} diff --git a/vendor/symfony/http-foundation/Session/SessionInterface.php b/vendor/symfony/http-foundation/Session/SessionInterface.php index 172c9b45..95fca857 100644 --- a/vendor/symfony/http-foundation/Session/SessionInterface.php +++ b/vendor/symfony/http-foundation/Session/SessionInterface.php @@ -159,8 +159,6 @@ interface SessionInterface /** * Registers a SessionBagInterface with the session. - * - * @param SessionBagInterface $bag */ public function registerBag(SessionBagInterface $bag); diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php new file mode 100644 index 00000000..6ae13558 --- /dev/null +++ b/vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php @@ -0,0 +1,168 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; + +/** + * This abstract session handler provides a generic implementation + * of the PHP 7.0 SessionUpdateTimestampHandlerInterface, + * enabling strict and lazy session handling. + * + * @author Nicolas Grekas <p@tchwork.com> + */ +abstract class AbstractSessionHandler implements \SessionHandlerInterface, \SessionUpdateTimestampHandlerInterface +{ + private $sessionName; + private $prefetchId; + private $prefetchData; + private $newSessionId; + private $igbinaryEmptyData; + + /** + * {@inheritdoc} + */ + public function open($savePath, $sessionName) + { + $this->sessionName = $sessionName; + if (!headers_sent() && !ini_get('session.cache_limiter') && '0' !== ini_get('session.cache_limiter')) { + header(sprintf('Cache-Control: max-age=%d, private, must-revalidate', 60 * (int) ini_get('session.cache_expire'))); + } + + return true; + } + + /** + * @param string $sessionId + * + * @return string + */ + abstract protected function doRead($sessionId); + + /** + * @param string $sessionId + * @param string $data + * + * @return bool + */ + abstract protected function doWrite($sessionId, $data); + + /** + * @param string $sessionId + * + * @return bool + */ + abstract protected function doDestroy($sessionId); + + /** + * {@inheritdoc} + */ + public function validateId($sessionId) + { + $this->prefetchData = $this->read($sessionId); + $this->prefetchId = $sessionId; + + return '' !== $this->prefetchData; + } + + /** + * {@inheritdoc} + */ + public function read($sessionId) + { + if (null !== $this->prefetchId) { + $prefetchId = $this->prefetchId; + $prefetchData = $this->prefetchData; + $this->prefetchId = $this->prefetchData = null; + + if ($prefetchId === $sessionId || '' === $prefetchData) { + $this->newSessionId = '' === $prefetchData ? $sessionId : null; + + return $prefetchData; + } + } + + $data = $this->doRead($sessionId); + $this->newSessionId = '' === $data ? $sessionId : null; + if (\PHP_VERSION_ID < 70000) { + $this->prefetchData = $data; + } + + return $data; + } + + /** + * {@inheritdoc} + */ + public function write($sessionId, $data) + { + if (\PHP_VERSION_ID < 70000 && $this->prefetchData) { + $readData = $this->prefetchData; + $this->prefetchData = null; + + if ($readData === $data) { + return $this->updateTimestamp($sessionId, $data); + } + } + if (null === $this->igbinaryEmptyData) { + // see https://github.com/igbinary/igbinary/issues/146 + $this->igbinaryEmptyData = \function_exists('igbinary_serialize') ? igbinary_serialize(array()) : ''; + } + if ('' === $data || $this->igbinaryEmptyData === $data) { + return $this->destroy($sessionId); + } + $this->newSessionId = null; + + return $this->doWrite($sessionId, $data); + } + + /** + * {@inheritdoc} + */ + public function destroy($sessionId) + { + if (\PHP_VERSION_ID < 70000) { + $this->prefetchData = null; + } + if (!headers_sent() && ini_get('session.use_cookies')) { + if (!$this->sessionName) { + throw new \LogicException(sprintf('Session name cannot be empty, did you forget to call "parent::open()" in "%s"?.', get_class($this))); + } + $sessionCookie = sprintf(' %s=', urlencode($this->sessionName)); + $sessionCookieWithId = sprintf('%s%s;', $sessionCookie, urlencode($sessionId)); + $sessionCookieFound = false; + $otherCookies = array(); + foreach (headers_list() as $h) { + if (0 !== stripos($h, 'Set-Cookie:')) { + continue; + } + if (11 === strpos($h, $sessionCookie, 11)) { + $sessionCookieFound = true; + + if (11 !== strpos($h, $sessionCookieWithId, 11)) { + $otherCookies[] = $h; + } + } else { + $otherCookies[] = $h; + } + } + if ($sessionCookieFound) { + header_remove('Set-Cookie'); + foreach ($otherCookies as $h) { + header($h, false); + } + } else { + setcookie($this->sessionName, '', 0, ini_get('session.cookie_path'), ini_get('session.cookie_domain'), ini_get('session.cookie_secure'), ini_get('session.cookie_httponly')); + } + } + + return $this->newSessionId === $sessionId || $this->doDestroy($sessionId); + } +} diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/MemcacheSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/MemcacheSessionHandler.php index d31aa766..90726beb 100644 --- a/vendor/symfony/http-foundation/Session/Storage/Handler/MemcacheSessionHandler.php +++ b/vendor/symfony/http-foundation/Session/Storage/Handler/MemcacheSessionHandler.php @@ -11,14 +11,15 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; +@trigger_error(sprintf('The class %s is deprecated since Symfony 3.4 and will be removed in 4.0. Use Symfony\Component\HttpFoundation\Session\Storage\Handler\MemcachedSessionHandler instead.', MemcacheSessionHandler::class), E_USER_DEPRECATED); + /** * @author Drak <drak@zikula.org> + * + * @deprecated since version 3.4, to be removed in 4.0. Use Symfony\Component\HttpFoundation\Session\Storage\Handler\MemcachedSessionHandler instead. */ class MemcacheSessionHandler implements \SessionHandlerInterface { - /** - * @var \Memcache Memcache driver - */ private $memcache; /** @@ -32,6 +33,8 @@ class MemcacheSessionHandler implements \SessionHandlerInterface private $prefix; /** + * Constructor. + * * List of available options: * * prefix: The prefix to use for the memcache keys in order to avoid collision * * expiretime: The time to live in seconds diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php index 3bbde542..9f4ef702 100644 --- a/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php +++ b/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php @@ -19,11 +19,8 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; * * @author Drak <drak@zikula.org> */ -class MemcachedSessionHandler implements \SessionHandlerInterface +class MemcachedSessionHandler extends AbstractSessionHandler { - /** - * @var \Memcached Memcached driver - */ private $memcached; /** @@ -37,9 +34,11 @@ class MemcachedSessionHandler implements \SessionHandlerInterface private $prefix; /** + * Constructor. + * * List of available options: * * prefix: The prefix to use for the memcached keys in order to avoid collision - * * expiretime: The time to live in seconds + * * expiretime: The time to live in seconds. * * @param \Memcached $memcached A \Memcached instance * @param array $options An associative array of Memcached options @@ -63,7 +62,7 @@ class MemcachedSessionHandler implements \SessionHandlerInterface /** * {@inheritdoc} */ - public function open($savePath, $sessionName) + public function close() { return true; } @@ -71,23 +70,23 @@ class MemcachedSessionHandler implements \SessionHandlerInterface /** * {@inheritdoc} */ - public function close() + protected function doRead($sessionId) { - return true; + return $this->memcached->get($this->prefix.$sessionId) ?: ''; } /** * {@inheritdoc} */ - public function read($sessionId) + public function updateTimestamp($sessionId, $data) { - return $this->memcached->get($this->prefix.$sessionId) ?: ''; + return $this->memcached->touch($this->prefix.$sessionId, time() + $this->ttl); } /** * {@inheritdoc} */ - public function write($sessionId, $data) + protected function doWrite($sessionId, $data) { return $this->memcached->set($this->prefix.$sessionId, $data, time() + $this->ttl); } @@ -95,7 +94,7 @@ class MemcachedSessionHandler implements \SessionHandlerInterface /** * {@inheritdoc} */ - public function destroy($sessionId) + protected function doDestroy($sessionId) { $result = $this->memcached->delete($this->prefix.$sessionId); diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php index f140939d..7d3fa218 100644 --- a/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php +++ b/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php @@ -12,13 +12,15 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; /** + * Session handler using the mongodb/mongodb package and MongoDB driver extension. + * * @author Markus Bachmann <markus.bachmann@bachi.biz> + * + * @see https://packagist.org/packages/mongodb/mongodb + * @see http://php.net/manual/en/set.mongodb.php */ -class MongoDbSessionHandler implements \SessionHandlerInterface +class MongoDbSessionHandler extends AbstractSessionHandler { - /** - * @var \Mongo|\MongoClient|\MongoDB\Client - */ private $mongo; /** @@ -32,13 +34,15 @@ class MongoDbSessionHandler implements \SessionHandlerInterface private $options; /** + * Constructor. + * * List of available options: * * database: The name of the database [required] * * collection: The name of the collection [required] * * id_field: The field name for storing the session id [default: _id] * * data_field: The field name for storing the session data [default: data] * * time_field: The field name for storing the timestamp [default: time] - * * expiry_field: The field name for storing the expiry-timestamp [default: expires_at] + * * expiry_field: The field name for storing the expiry-timestamp [default: expires_at]. * * It is strongly recommended to put an index on the `expiry_field` for * garbage-collection. Alternatively it's possible to automatically expire @@ -57,14 +61,18 @@ class MongoDbSessionHandler implements \SessionHandlerInterface * If you use such an index, you can drop `gc_probability` to 0 since * no garbage-collection is required. * - * @param \Mongo|\MongoClient|\MongoDB\Client $mongo A MongoDB\Client, MongoClient or Mongo instance - * @param array $options An associative array of field options + * @param \MongoDB\Client $mongo A MongoDB\Client instance + * @param array $options An associative array of field options * * @throws \InvalidArgumentException When MongoClient or Mongo instance not provided * @throws \InvalidArgumentException When "database" or "collection" not provided */ public function __construct($mongo, array $options) { + if ($mongo instanceof \MongoClient || $mongo instanceof \Mongo) { + @trigger_error(sprintf('Using %s with the legacy mongo extension is deprecated as of 3.4 and will be removed in 4.0. Use it with the mongodb/mongodb package and ext-mongodb instead.', __CLASS__), E_USER_DEPRECATED); + } + if (!($mongo instanceof \MongoDB\Client || $mongo instanceof \MongoClient || $mongo instanceof \Mongo)) { throw new \InvalidArgumentException('MongoClient or Mongo instance required'); } @@ -83,14 +91,6 @@ class MongoDbSessionHandler implements \SessionHandlerInterface ), $options); } - /** - * {@inheritdoc} - */ - public function open($savePath, $sessionName) - { - return true; - } - /** * {@inheritdoc} */ @@ -102,7 +102,7 @@ class MongoDbSessionHandler implements \SessionHandlerInterface /** * {@inheritdoc} */ - public function destroy($sessionId) + protected function doDestroy($sessionId) { $methodName = $this->mongo instanceof \MongoDB\Client ? 'deleteOne' : 'remove'; @@ -130,7 +130,7 @@ class MongoDbSessionHandler implements \SessionHandlerInterface /** * {@inheritdoc} */ - public function write($sessionId, $data) + protected function doWrite($sessionId, $data) { $expiry = $this->createDateTime(time() + (int) ini_get('session.gc_maxlifetime')); @@ -162,7 +162,34 @@ class MongoDbSessionHandler implements \SessionHandlerInterface /** * {@inheritdoc} */ - public function read($sessionId) + public function updateTimestamp($sessionId, $data) + { + $expiry = $this->createDateTime(time() + (int) ini_get('session.gc_maxlifetime')); + + if ($this->mongo instanceof \MongoDB\Client) { + $methodName = 'updateOne'; + $options = array(); + } else { + $methodName = 'update'; + $options = array('multiple' => false); + } + + $this->getCollection()->$methodName( + array($this->options['id_field'] => $sessionId), + array('$set' => array( + $this->options['time_field'] => $this->createDateTime(), + $this->options['expiry_field'] => $expiry, + )), + $options + ); + + return true; + } + + /** + * {@inheritdoc} + */ + protected function doRead($sessionId) { $dbData = $this->getCollection()->findOne(array( $this->options['id_field'] => $sessionId, diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/NativeFileSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/NativeFileSessionHandler.php index d6ad9374..4e9704bd 100644 --- a/vendor/symfony/http-foundation/Session/Storage/Handler/NativeFileSessionHandler.php +++ b/vendor/symfony/http-foundation/Session/Storage/Handler/NativeFileSessionHandler.php @@ -26,6 +26,7 @@ class NativeFileSessionHandler extends NativeSessionHandler * @see http://php.net/session.configuration.php#ini.session.save-path for further details. * * @throws \InvalidArgumentException On invalid $savePath + * @throws \RuntimeException When failing to create the save directory */ public function __construct($savePath = null) { diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/NativeSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/NativeSessionHandler.php index 4ae410f9..9be4528a 100644 --- a/vendor/symfony/http-foundation/Session/Storage/Handler/NativeSessionHandler.php +++ b/vendor/symfony/http-foundation/Session/Storage/Handler/NativeSessionHandler.php @@ -12,10 +12,13 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; /** - * Adds SessionHandler functionality if available. - * + * @deprecated since version 3.4, to be removed in 4.0. Use \SessionHandler instead. * @see http://php.net/sessionhandler */ class NativeSessionHandler extends \SessionHandler { + public function __construct() + { + @trigger_error('The '.__NAMESPACE__.'\NativeSessionHandler class is deprecated since Symfony 3.4 and will be removed in 4.0. Use the \SessionHandler class instead.', E_USER_DEPRECATED); + } } diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/NullSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/NullSessionHandler.php index 1516d431..8d193155 100644 --- a/vendor/symfony/http-foundation/Session/Storage/Handler/NullSessionHandler.php +++ b/vendor/symfony/http-foundation/Session/Storage/Handler/NullSessionHandler.php @@ -12,18 +12,16 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; /** - * NullSessionHandler. - * * Can be used in unit testing or in a situations where persisted sessions are not desired. * * @author Drak <drak@zikula.org> */ -class NullSessionHandler implements \SessionHandlerInterface +class NullSessionHandler extends AbstractSessionHandler { /** * {@inheritdoc} */ - public function open($savePath, $sessionName) + public function close() { return true; } @@ -31,7 +29,7 @@ class NullSessionHandler implements \SessionHandlerInterface /** * {@inheritdoc} */ - public function close() + public function validateId($sessionId) { return true; } @@ -39,7 +37,7 @@ class NullSessionHandler implements \SessionHandlerInterface /** * {@inheritdoc} */ - public function read($sessionId) + protected function doRead($sessionId) { return ''; } @@ -47,7 +45,15 @@ class NullSessionHandler implements \SessionHandlerInterface /** * {@inheritdoc} */ - public function write($sessionId, $data) + public function updateTimestamp($sessionId, $data) + { + return true; + } + + /** + * {@inheritdoc} + */ + protected function doWrite($sessionId, $data) { return true; } @@ -55,7 +61,7 @@ class NullSessionHandler implements \SessionHandlerInterface /** * {@inheritdoc} */ - public function destroy($sessionId) + protected function doDestroy($sessionId) { return true; } diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php index 5cdac639..2e1692b6 100644 --- a/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php +++ b/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php @@ -38,7 +38,7 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; * @author Michael Williams <michael.williams@funsational.com> * @author Tobias Schultze <http://tobion.de> */ -class PdoSessionHandler implements \SessionHandlerInterface +class PdoSessionHandler extends AbstractSessionHandler { /** * No locking is done. This means sessions are prone to loss of data due to @@ -260,11 +260,13 @@ class PdoSessionHandler implements \SessionHandlerInterface */ public function open($savePath, $sessionName) { + $this->sessionExpired = false; + if (null === $this->pdo) { $this->connect($this->dsn ?: $savePath); } - return true; + return parent::open($savePath, $sessionName); } /** @@ -273,7 +275,7 @@ class PdoSessionHandler implements \SessionHandlerInterface public function read($sessionId) { try { - return $this->doRead($sessionId); + return parent::read($sessionId); } catch (\PDOException $e) { $this->rollback(); @@ -296,7 +298,7 @@ class PdoSessionHandler implements \SessionHandlerInterface /** * {@inheritdoc} */ - public function destroy($sessionId) + protected function doDestroy($sessionId) { // delete the record associated with this id $sql = "DELETE FROM $this->table WHERE $this->idCol = :id"; @@ -317,7 +319,7 @@ class PdoSessionHandler implements \SessionHandlerInterface /** * {@inheritdoc} */ - public function write($sessionId, $data) + protected function doWrite($sessionId, $data) { $maxlifetime = (int) ini_get('session.gc_maxlifetime'); @@ -330,13 +332,7 @@ class PdoSessionHandler implements \SessionHandlerInterface return true; } - $updateStmt = $this->pdo->prepare( - "UPDATE $this->table SET $this->dataCol = :data, $this->lifetimeCol = :lifetime, $this->timeCol = :time WHERE $this->idCol = :id" - ); - $updateStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); - $updateStmt->bindParam(':data', $data, \PDO::PARAM_LOB); - $updateStmt->bindParam(':lifetime', $maxlifetime, \PDO::PARAM_INT); - $updateStmt->bindValue(':time', time(), \PDO::PARAM_INT); + $updateStmt = $this->getUpdateStatement($sessionId, $data, $maxlifetime); $updateStmt->execute(); // When MERGE is not supported, like in Postgres < 9.5, we have to use this approach that can result in @@ -346,13 +342,7 @@ class PdoSessionHandler implements \SessionHandlerInterface // false positives due to longer gap locking. if (!$updateStmt->rowCount()) { try { - $insertStmt = $this->pdo->prepare( - "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :lifetime, :time)" - ); - $insertStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); - $insertStmt->bindParam(':data', $data, \PDO::PARAM_LOB); - $insertStmt->bindParam(':lifetime', $maxlifetime, \PDO::PARAM_INT); - $insertStmt->bindValue(':time', time(), \PDO::PARAM_INT); + $insertStmt = $this->getInsertStatement($sessionId, $data, $maxlifetime); $insertStmt->execute(); } catch (\PDOException $e) { // Handle integrity violation SQLSTATE 23000 (or a subclass like 23505 in Postgres) for duplicate keys @@ -372,6 +362,30 @@ class PdoSessionHandler implements \SessionHandlerInterface return true; } + /** + * {@inheritdoc} + */ + public function updateTimestamp($sessionId, $data) + { + $maxlifetime = (int) ini_get('session.gc_maxlifetime'); + + try { + $updateStmt = $this->pdo->prepare( + "UPDATE $this->table SET $this->lifetimeCol = :lifetime, $this->timeCol = :time WHERE $this->idCol = :id" + ); + $updateStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); + $updateStmt->bindParam(':lifetime', $maxlifetime, \PDO::PARAM_INT); + $updateStmt->bindValue(':time', time(), \PDO::PARAM_INT); + $updateStmt->execute(); + } catch (\PDOException $e) { + $this->rollback(); + + throw $e; + } + + return true; + } + /** * {@inheritdoc} */ @@ -387,7 +401,11 @@ class PdoSessionHandler implements \SessionHandlerInterface $this->gcCalled = false; // delete the session records that have expired - $sql = "DELETE FROM $this->table WHERE $this->lifetimeCol + $this->timeCol < :time"; + if ('mysql' === $this->driver) { + $sql = "DELETE FROM $this->table WHERE $this->lifetimeCol + $this->timeCol < :time"; + } else { + $sql = "DELETE FROM $this->table WHERE $this->lifetimeCol < :time - $this->timeCol"; + } $stmt = $this->pdo->prepare($sql); $stmt->bindValue(':time', time(), \PDO::PARAM_INT); @@ -491,10 +509,8 @@ class PdoSessionHandler implements \SessionHandlerInterface * * @return string The session data */ - private function doRead($sessionId) + protected function doRead($sessionId) { - $this->sessionExpired = false; - if (self::LOCK_ADVISORY === $this->lockMode) { $this->unlockStatements[] = $this->doAdvisoryLock($sessionId); } @@ -517,17 +533,13 @@ class PdoSessionHandler implements \SessionHandlerInterface return is_resource($sessionRows[0][0]) ? stream_get_contents($sessionRows[0][0]) : $sessionRows[0][0]; } - if (self::LOCK_TRANSACTIONAL === $this->lockMode && 'sqlite' !== $this->driver) { + if (!ini_get('session.use_strict_mode') && self::LOCK_TRANSACTIONAL === $this->lockMode && 'sqlite' !== $this->driver) { + // In strict mode, session fixation is not possible: new sessions always start with a unique + // random id, so that concurrency is not possible and this code path can be skipped. // Exclusive-reading of non-existent rows does not block, so we need to do an insert to block // until other connections to the session are committed. try { - $insertStmt = $this->pdo->prepare( - "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :lifetime, :time)" - ); - $insertStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); - $insertStmt->bindValue(':data', '', \PDO::PARAM_LOB); - $insertStmt->bindValue(':lifetime', 0, \PDO::PARAM_INT); - $insertStmt->bindValue(':time', time(), \PDO::PARAM_INT); + $insertStmt = $this->getInsertStatement($sessionId, '', 0); $insertStmt->execute(); } catch (\PDOException $e) { // Catch duplicate key error because other connection created the session already. @@ -662,6 +674,72 @@ class PdoSessionHandler implements \SessionHandlerInterface return "SELECT $this->dataCol, $this->lifetimeCol, $this->timeCol FROM $this->table WHERE $this->idCol = :id"; } + /** + * Returns an insert statement supported by the database for writing session data. + * + * @param string $sessionId Session ID + * @param string $sessionData Encoded session data + * @param int $maxlifetime session.gc_maxlifetime + * + * @return \PDOStatement The insert statement + */ + private function getInsertStatement($sessionId, $sessionData, $maxlifetime) + { + switch ($this->driver) { + case 'oci': + $data = fopen('php://memory', 'r+'); + fwrite($data, $sessionData); + rewind($data); + $sql = "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, EMPTY_BLOB(), :lifetime, :time) RETURNING $this->dataCol into :data"; + break; + default: + $data = $sessionData; + $sql = "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :lifetime, :time)"; + break; + } + + $stmt = $this->pdo->prepare($sql); + $stmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); + $stmt->bindParam(':data', $data, \PDO::PARAM_LOB); + $stmt->bindParam(':lifetime', $maxlifetime, \PDO::PARAM_INT); + $stmt->bindValue(':time', time(), \PDO::PARAM_INT); + + return $stmt; + } + + /** + * Returns an update statement supported by the database for writing session data. + * + * @param string $sessionId Session ID + * @param string $sessionData Encoded session data + * @param int $maxlifetime session.gc_maxlifetime + * + * @return \PDOStatement The update statement + */ + private function getUpdateStatement($sessionId, $sessionData, $maxlifetime) + { + switch ($this->driver) { + case 'oci': + $data = fopen('php://memory', 'r+'); + fwrite($data, $sessionData); + rewind($data); + $sql = "UPDATE $this->table SET $this->dataCol = EMPTY_BLOB(), $this->lifetimeCol = :lifetime, $this->timeCol = :time WHERE $this->idCol = :id RETURNING $this->dataCol into :data"; + break; + default: + $data = $sessionData; + $sql = "UPDATE $this->table SET $this->dataCol = :data, $this->lifetimeCol = :lifetime, $this->timeCol = :time WHERE $this->idCol = :id"; + break; + } + + $stmt = $this->pdo->prepare($sql); + $stmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); + $stmt->bindParam(':data', $data, \PDO::PARAM_LOB); + $stmt->bindParam(':lifetime', $maxlifetime, \PDO::PARAM_INT); + $stmt->bindValue(':time', time(), \PDO::PARAM_INT); + + return $stmt; + } + /** * Returns a merge/upsert (i.e. insert or update) statement when supported by the database for writing session data. * @@ -673,18 +751,11 @@ class PdoSessionHandler implements \SessionHandlerInterface */ private function getMergeStatement($sessionId, $data, $maxlifetime) { - $mergeSql = null; switch (true) { case 'mysql' === $this->driver: $mergeSql = "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :lifetime, :time) ". "ON DUPLICATE KEY UPDATE $this->dataCol = VALUES($this->dataCol), $this->lifetimeCol = VALUES($this->lifetimeCol), $this->timeCol = VALUES($this->timeCol)"; break; - case 'oci' === $this->driver: - // DUAL is Oracle specific dummy table - $mergeSql = "MERGE INTO $this->table USING DUAL ON ($this->idCol = ?) ". - "WHEN NOT MATCHED THEN INSERT ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (?, ?, ?, ?) ". - "WHEN MATCHED THEN UPDATE SET $this->dataCol = ?, $this->lifetimeCol = ?, $this->timeCol = ?"; - break; case 'sqlsrv' === $this->driver && version_compare($this->pdo->getAttribute(\PDO::ATTR_SERVER_VERSION), '10', '>='): // MERGE is only available since SQL Server 2008 and must be terminated by semicolon // It also requires HOLDLOCK according to http://weblogs.sqlteam.com/dang/archive/2009/01/31/UPSERT-Race-Condition-With-MERGE.aspx @@ -699,29 +770,30 @@ class PdoSessionHandler implements \SessionHandlerInterface $mergeSql = "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :lifetime, :time) ". "ON CONFLICT ($this->idCol) DO UPDATE SET ($this->dataCol, $this->lifetimeCol, $this->timeCol) = (EXCLUDED.$this->dataCol, EXCLUDED.$this->lifetimeCol, EXCLUDED.$this->timeCol)"; break; + default: + // MERGE is not supported with LOBs: http://www.oracle.com/technetwork/articles/fuecks-lobs-095315.html + return null; } - if (null !== $mergeSql) { - $mergeStmt = $this->pdo->prepare($mergeSql); - - if ('sqlsrv' === $this->driver || 'oci' === $this->driver) { - $mergeStmt->bindParam(1, $sessionId, \PDO::PARAM_STR); - $mergeStmt->bindParam(2, $sessionId, \PDO::PARAM_STR); - $mergeStmt->bindParam(3, $data, \PDO::PARAM_LOB); - $mergeStmt->bindParam(4, $maxlifetime, \PDO::PARAM_INT); - $mergeStmt->bindValue(5, time(), \PDO::PARAM_INT); - $mergeStmt->bindParam(6, $data, \PDO::PARAM_LOB); - $mergeStmt->bindParam(7, $maxlifetime, \PDO::PARAM_INT); - $mergeStmt->bindValue(8, time(), \PDO::PARAM_INT); - } else { - $mergeStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); - $mergeStmt->bindParam(':data', $data, \PDO::PARAM_LOB); - $mergeStmt->bindParam(':lifetime', $maxlifetime, \PDO::PARAM_INT); - $mergeStmt->bindValue(':time', time(), \PDO::PARAM_INT); - } - - return $mergeStmt; + $mergeStmt = $this->pdo->prepare($mergeSql); + + if ('sqlsrv' === $this->driver) { + $mergeStmt->bindParam(1, $sessionId, \PDO::PARAM_STR); + $mergeStmt->bindParam(2, $sessionId, \PDO::PARAM_STR); + $mergeStmt->bindParam(3, $data, \PDO::PARAM_LOB); + $mergeStmt->bindParam(4, $maxlifetime, \PDO::PARAM_INT); + $mergeStmt->bindValue(5, time(), \PDO::PARAM_INT); + $mergeStmt->bindParam(6, $data, \PDO::PARAM_LOB); + $mergeStmt->bindParam(7, $maxlifetime, \PDO::PARAM_INT); + $mergeStmt->bindValue(8, time(), \PDO::PARAM_INT); + } else { + $mergeStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); + $mergeStmt->bindParam(':data', $data, \PDO::PARAM_LOB); + $mergeStmt->bindParam(':lifetime', $maxlifetime, \PDO::PARAM_INT); + $mergeStmt->bindValue(':time', time(), \PDO::PARAM_INT); } + + return $mergeStmt; } /** diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php new file mode 100644 index 00000000..22811929 --- /dev/null +++ b/vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php @@ -0,0 +1,103 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; + +/** + * Adds basic `SessionUpdateTimestampHandlerInterface` behaviors to another `SessionHandlerInterface`. + * + * @author Nicolas Grekas <p@tchwork.com> + */ +class StrictSessionHandler extends AbstractSessionHandler +{ + private $handler; + private $doDestroy; + + public function __construct(\SessionHandlerInterface $handler) + { + if ($handler instanceof \SessionUpdateTimestampHandlerInterface) { + throw new \LogicException(sprintf('"%s" is already an instance of "SessionUpdateTimestampHandlerInterface", you cannot wrap it with "%s".', get_class($handler), self::class)); + } + + $this->handler = $handler; + } + + /** + * {@inheritdoc} + */ + public function open($savePath, $sessionName) + { + parent::open($savePath, $sessionName); + + return $this->handler->open($savePath, $sessionName); + } + + /** + * {@inheritdoc} + */ + protected function doRead($sessionId) + { + return $this->handler->read($sessionId); + } + + /** + * {@inheritdoc} + */ + public function updateTimestamp($sessionId, $data) + { + return $this->write($sessionId, $data); + } + + /** + * {@inheritdoc} + */ + protected function doWrite($sessionId, $data) + { + return $this->handler->write($sessionId, $data); + } + + /** + * {@inheritdoc} + */ + public function destroy($sessionId) + { + $this->doDestroy = true; + $destroyed = parent::destroy($sessionId); + + return $this->doDestroy ? $this->doDestroy($sessionId) : $destroyed; + } + + /** + * {@inheritdoc} + */ + protected function doDestroy($sessionId) + { + $this->doDestroy = false; + + return $this->handler->destroy($sessionId); + } + + /** + * {@inheritdoc} + */ + public function close() + { + return $this->handler->close(); + } + + /** + * {@inheritdoc} + */ + public function gc($maxlifetime) + { + return $this->handler->gc($maxlifetime); + } +} diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/WriteCheckSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/WriteCheckSessionHandler.php index d49c36ca..1541ec4e 100644 --- a/vendor/symfony/http-foundation/Session/Storage/Handler/WriteCheckSessionHandler.php +++ b/vendor/symfony/http-foundation/Session/Storage/Handler/WriteCheckSessionHandler.php @@ -11,16 +11,17 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; +@trigger_error(sprintf('The %s class is deprecated since Symfony 3.4 and will be removed in 4.0. Implement `SessionUpdateTimestampHandlerInterface` or extend `AbstractSessionHandler` instead.', WriteCheckSessionHandler::class), E_USER_DEPRECATED); + /** * Wraps another SessionHandlerInterface to only write the session when it has been modified. * * @author Adrien Brault <adrien.brault@gmail.com> + * + * @deprecated since version 3.4, to be removed in 4.0. Implement `SessionUpdateTimestampHandlerInterface` or extend `AbstractSessionHandler` instead. */ class WriteCheckSessionHandler implements \SessionHandlerInterface { - /** - * @var \SessionHandlerInterface - */ private $wrappedSessionHandler; /** diff --git a/vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php b/vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php index 0349a433..027f4eff 100644 --- a/vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php +++ b/vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php @@ -72,11 +72,6 @@ class MockArraySessionStorage implements SessionStorageInterface $this->setMetadataBag($metaBag); } - /** - * Sets the session data. - * - * @param array $array - */ public function setSessionData(array $array) { $this->data = $array; @@ -213,11 +208,6 @@ class MockArraySessionStorage implements SessionStorageInterface return $this->started; } - /** - * Sets the MetadataBag. - * - * @param MetadataBag $bag - */ public function setMetadataBag(MetadataBag $bag = null) { if (null === $bag) { diff --git a/vendor/symfony/http-foundation/Session/Storage/MockFileSessionStorage.php b/vendor/symfony/http-foundation/Session/Storage/MockFileSessionStorage.php index 8c1bf73c..14f42700 100644 --- a/vendor/symfony/http-foundation/Session/Storage/MockFileSessionStorage.php +++ b/vendor/symfony/http-foundation/Session/Storage/MockFileSessionStorage.php @@ -24,9 +24,6 @@ namespace Symfony\Component\HttpFoundation\Session\Storage; */ class MockFileSessionStorage extends MockArraySessionStorage { - /** - * @var string - */ private $savePath; /** @@ -94,7 +91,26 @@ class MockFileSessionStorage extends MockArraySessionStorage throw new \RuntimeException('Trying to save a session that was not started yet or was already closed'); } - file_put_contents($this->getFilePath(), serialize($this->data)); + $data = $this->data; + + foreach ($this->bags as $bag) { + if (empty($data[$key = $bag->getStorageKey()])) { + unset($data[$key]); + } + } + if (array($key = $this->metadataBag->getStorageKey()) === array_keys($data)) { + unset($data[$key]); + } + + try { + if ($data) { + file_put_contents($this->getFilePath(), serialize($data)); + } else { + $this->destroy(); + } + } finally { + $this->data = $data; + } // this is needed for Silex, where the session object is re-used across requests // in functional tests. In Symfony, the container is rebooted, so we don't have diff --git a/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php b/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php index 8f4ebefa..0dfad9ac 100644 --- a/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php +++ b/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php @@ -11,9 +11,8 @@ namespace Symfony\Component\HttpFoundation\Session\Storage; -use Symfony\Component\Debug\Exception\ContextErrorException; use Symfony\Component\HttpFoundation\Session\SessionBagInterface; -use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler; +use Symfony\Component\HttpFoundation\Session\Storage\Handler\StrictSessionHandler; use Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy; use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy; @@ -25,11 +24,9 @@ use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy; class NativeSessionStorage implements SessionStorageInterface { /** - * Array of SessionBagInterface. - * * @var SessionBagInterface[] */ - protected $bags; + protected $bags = array(); /** * @var bool @@ -42,7 +39,7 @@ class NativeSessionStorage implements SessionStorageInterface protected $closed = false; /** - * @var AbstractProxy + * @var AbstractProxy|\SessionHandlerInterface */ protected $saveHandler; @@ -64,6 +61,7 @@ class NativeSessionStorage implements SessionStorageInterface * PHP starts to execute user-land code. Setting during runtime has no effect). * * cache_limiter, "" (use "0" to prevent headers from being sent entirely). + * cache_expire, "0" * cookie_domain, "" * cookie_httponly, "" * cookie_lifetime, "0" @@ -76,6 +74,7 @@ class NativeSessionStorage implements SessionStorageInterface * gc_probability, "1" * hash_bits_per_character, "4" * hash_function, "0" + * lazy_write, "1" * name, "PHPSESSID" * referer_check, "" * serialize_handler, "php" @@ -95,14 +94,18 @@ class NativeSessionStorage implements SessionStorageInterface * trans_sid_hosts, $_SERVER['HTTP_HOST'] * trans_sid_tags, "a=href,area=href,frame=src,form=" * - * @param array $options Session configuration options - * @param AbstractProxy|NativeSessionHandler|\SessionHandlerInterface|null $handler - * @param MetadataBag $metaBag MetadataBag + * @param array $options Session configuration options + * @param \SessionHandlerInterface|null $handler + * @param MetadataBag $metaBag MetadataBag */ public function __construct(array $options = array(), $handler = null, MetadataBag $metaBag = null) { - session_cache_limiter(''); // disable by default because it's managed by HeaderBag (if used) - ini_set('session.use_cookies', 1); + $options += array( + 'cache_limiter' => '', + 'cache_expire' => 0, + 'use_cookies' => 1, + 'lazy_write' => 1, + ); session_register_shutdown(); @@ -114,7 +117,7 @@ class NativeSessionStorage implements SessionStorageInterface /** * Gets the save handler instance. * - * @return AbstractProxy + * @return AbstractProxy|\SessionHandlerInterface */ public function getSaveHandler() { @@ -190,6 +193,10 @@ class NativeSessionStorage implements SessionStorageInterface return false; } + if (headers_sent()) { + return false; + } + if (null !== $lifetime) { ini_set('session.cookie_lifetime', $lifetime); } @@ -212,15 +219,31 @@ class NativeSessionStorage implements SessionStorageInterface */ public function save() { + $session = $_SESSION; + + foreach ($this->bags as $bag) { + if (empty($_SESSION[$key = $bag->getStorageKey()])) { + unset($_SESSION[$key]); + } + } + if (array($key = $this->metadataBag->getStorageKey()) === array_keys($_SESSION)) { + unset($_SESSION[$key]); + } + // Register custom error handler to catch a possible failure warning during session write - set_error_handler(function ($errno, $errstr, $errfile, $errline, $errcontext) { - throw new ContextErrorException($errstr, $errno, E_WARNING, $errfile, $errline, $errcontext); + set_error_handler(function ($errno, $errstr, $errfile, $errline) { + throw new \ErrorException($errstr, $errno, E_WARNING, $errfile, $errline); }, E_WARNING); try { + $e = null; session_write_close(); + } catch (\ErrorException $e) { + } finally { restore_error_handler(); - } catch (ContextErrorException $e) { + $_SESSION = $session; + } + if (null !== $e) { // The default PHP error message is not very helpful, as it does not give any information on the current save handler. // Therefore, we catch this error and trigger a warning with a better error message $handler = $this->getSaveHandler(); @@ -228,7 +251,6 @@ class NativeSessionStorage implements SessionStorageInterface $handler = $handler->getHandler(); } - restore_error_handler(); trigger_error(sprintf('session_write_close(): Failed to write session data with %s handler', get_class($handler)), E_USER_WARNING); } @@ -274,7 +296,7 @@ class NativeSessionStorage implements SessionStorageInterface throw new \InvalidArgumentException(sprintf('The SessionBagInterface %s is not registered.', $name)); } - if ($this->saveHandler->isActive() && !$this->started) { + if (!$this->started && $this->saveHandler->isActive()) { $this->loadSession(); } elseif (!$this->started) { $this->start(); @@ -283,11 +305,6 @@ class NativeSessionStorage implements SessionStorageInterface return $this->bags[$name]; } - /** - * Sets the MetadataBag. - * - * @param MetadataBag $metaBag - */ public function setMetadataBag(MetadataBag $metaBag = null) { if (null === $metaBag) { @@ -327,12 +344,16 @@ class NativeSessionStorage implements SessionStorageInterface */ public function setOptions(array $options) { + if (headers_sent() || \PHP_SESSION_ACTIVE === session_status()) { + return; + } + $validOptions = array_flip(array( - 'cache_limiter', 'cookie_domain', 'cookie_httponly', + 'cache_limiter', 'cache_expire', 'cookie_domain', 'cookie_httponly', 'cookie_lifetime', 'cookie_path', 'cookie_secure', 'entropy_file', 'entropy_length', 'gc_divisor', 'gc_maxlifetime', 'gc_probability', 'hash_bits_per_character', - 'hash_function', 'name', 'referer_check', + 'hash_function', 'lazy_write', 'name', 'referer_check', 'serialize_handler', 'use_strict_mode', 'use_cookies', 'use_only_cookies', 'use_trans_sid', 'upload_progress.enabled', 'upload_progress.cleanup', 'upload_progress.prefix', 'upload_progress.name', @@ -356,7 +377,7 @@ class NativeSessionStorage implements SessionStorageInterface * ini_set('session.save_handler', 'files'); * ini_set('session.save_path', '/tmp'); * - * or pass in a NativeSessionHandler instance which configures session.save_handler in the + * or pass in a \SessionHandler instance which configures session.save_handler in the * constructor, for a template see NativeFileSessionHandler or use handlers in * composer package drak/native-session * @@ -365,28 +386,33 @@ class NativeSessionStorage implements SessionStorageInterface * @see http://php.net/sessionhandler * @see http://github.com/drak/NativeSession * - * @param AbstractProxy|NativeSessionHandler|\SessionHandlerInterface|null $saveHandler + * @param \SessionHandlerInterface|null $saveHandler * * @throws \InvalidArgumentException */ public function setSaveHandler($saveHandler = null) { if (!$saveHandler instanceof AbstractProxy && - !$saveHandler instanceof NativeSessionHandler && !$saveHandler instanceof \SessionHandlerInterface && null !== $saveHandler) { - throw new \InvalidArgumentException('Must be instance of AbstractProxy or NativeSessionHandler; implement \SessionHandlerInterface; or be null.'); + throw new \InvalidArgumentException('Must be instance of AbstractProxy; implement \SessionHandlerInterface; or be null.'); } // Wrap $saveHandler in proxy and prevent double wrapping of proxy if (!$saveHandler instanceof AbstractProxy && $saveHandler instanceof \SessionHandlerInterface) { $saveHandler = new SessionHandlerProxy($saveHandler); } elseif (!$saveHandler instanceof AbstractProxy) { - $saveHandler = new SessionHandlerProxy(new \SessionHandler()); + $saveHandler = new SessionHandlerProxy(new StrictSessionHandler(new \SessionHandler())); } $this->saveHandler = $saveHandler; - if ($this->saveHandler instanceof \SessionHandlerInterface) { + if (headers_sent() || \PHP_SESSION_ACTIVE === session_status()) { + return; + } + + if ($this->saveHandler instanceof SessionHandlerProxy) { + session_set_save_handler($this->saveHandler->getHandler(), false); + } elseif ($this->saveHandler instanceof \SessionHandlerInterface) { session_set_save_handler($this->saveHandler, false); } } @@ -398,8 +424,6 @@ class NativeSessionStorage implements SessionStorageInterface * are set to (either PHP's internal, or a custom save handler set with session_set_save_handler()). * PHP takes the return value from the read() handler, unserializes it * and populates $_SESSION with the result automatically. - * - * @param array|null $session */ protected function loadSession(array &$session = null) { diff --git a/vendor/symfony/http-foundation/Session/Storage/PhpBridgeSessionStorage.php b/vendor/symfony/http-foundation/Session/Storage/PhpBridgeSessionStorage.php index 9420d086..662ed501 100644 --- a/vendor/symfony/http-foundation/Session/Storage/PhpBridgeSessionStorage.php +++ b/vendor/symfony/http-foundation/Session/Storage/PhpBridgeSessionStorage.php @@ -11,9 +11,6 @@ namespace Symfony\Component\HttpFoundation\Session\Storage; -use Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy; -use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler; - /** * Allows session to be started by PHP and managed by Symfony. * @@ -22,8 +19,8 @@ use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandle class PhpBridgeSessionStorage extends NativeSessionStorage { /** - * @param AbstractProxy|NativeSessionHandler|\SessionHandlerInterface|null $handler - * @param MetadataBag $metaBag MetadataBag + * @param \SessionHandlerInterface|null $handler + * @param MetadataBag $metaBag MetadataBag */ public function __construct($handler = null, MetadataBag $metaBag = null) { diff --git a/vendor/symfony/http-foundation/Session/Storage/Proxy/AbstractProxy.php b/vendor/symfony/http-foundation/Session/Storage/Proxy/AbstractProxy.php index a7478656..09c92483 100644 --- a/vendor/symfony/http-foundation/Session/Storage/Proxy/AbstractProxy.php +++ b/vendor/symfony/http-foundation/Session/Storage/Proxy/AbstractProxy.php @@ -12,8 +12,6 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Proxy; /** - * AbstractProxy. - * * @author Drak <drak@zikula.org> */ abstract class AbstractProxy diff --git a/vendor/symfony/http-foundation/Session/Storage/Proxy/NativeProxy.php b/vendor/symfony/http-foundation/Session/Storage/Proxy/NativeProxy.php index 21ed1ada..082eed14 100644 --- a/vendor/symfony/http-foundation/Session/Storage/Proxy/NativeProxy.php +++ b/vendor/symfony/http-foundation/Session/Storage/Proxy/NativeProxy.php @@ -11,8 +11,12 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Proxy; +@trigger_error('The '.__NAMESPACE__.'\NativeProxy class is deprecated since Symfony 3.4 and will be removed in 4.0. Use your session handler implementation directly.', E_USER_DEPRECATED); + /** - * This proxy is built-in session handlers in PHP 5.3.x + * This proxy is built-in session handlers in PHP 5.3.x. + * + * @deprecated since version 3.4, to be removed in 4.0. Use your session handler implementation directly. * * @author Drak <drak@zikula.org> */ diff --git a/vendor/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php b/vendor/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php index be39f6ba..53c1209a 100644 --- a/vendor/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php +++ b/vendor/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php @@ -16,14 +16,8 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Proxy; */ class SessionHandlerProxy extends AbstractProxy implements \SessionHandlerInterface { - /** - * @var \SessionHandlerInterface - */ protected $handler; - /** - * @param \SessionHandlerInterface $handler - */ public function __construct(\SessionHandlerInterface $handler) { $this->handler = $handler; diff --git a/vendor/symfony/http-foundation/Session/Storage/SessionStorageInterface.php b/vendor/symfony/http-foundation/Session/Storage/SessionStorageInterface.php index 097583d5..66e8b33d 100644 --- a/vendor/symfony/http-foundation/Session/Storage/SessionStorageInterface.php +++ b/vendor/symfony/http-foundation/Session/Storage/SessionStorageInterface.php @@ -127,8 +127,6 @@ interface SessionStorageInterface /** * Registers a SessionBagInterface for use. - * - * @param SessionBagInterface $bag */ public function registerBag(SessionBagInterface $bag); diff --git a/vendor/symfony/http-foundation/StreamedResponse.php b/vendor/symfony/http-foundation/StreamedResponse.php index 3cbbfc5f..92868d33 100644 --- a/vendor/symfony/http-foundation/StreamedResponse.php +++ b/vendor/symfony/http-foundation/StreamedResponse.php @@ -64,37 +64,45 @@ class StreamedResponse extends Response * Sets the PHP callback associated with this Response. * * @param callable $callback A valid PHP callback + * + * @return $this */ public function setCallback(callable $callback) { $this->callback = $callback; + + return $this; } /** * {@inheritdoc} * * This method only sends the headers once. + * + * @return $this */ public function sendHeaders() { if ($this->headersSent) { - return; + return $this; } $this->headersSent = true; - parent::sendHeaders(); + return parent::sendHeaders(); } /** * {@inheritdoc} * * This method only sends the content once. + * + * @return $this */ public function sendContent() { if ($this->streamed) { - return; + return $this; } $this->streamed = true; @@ -104,18 +112,24 @@ class StreamedResponse extends Response } call_user_func($this->callback); + + return $this; } /** * {@inheritdoc} * * @throws \LogicException when the content is not null + * + * @return $this */ public function setContent($content) { if (null !== $content) { throw new \LogicException('The content cannot be set on a StreamedResponse instance.'); } + + return $this; } /** diff --git a/vendor/symfony/http-foundation/Tests/FileBagTest.php b/vendor/symfony/http-foundation/Tests/FileBagTest.php index 7d2902d3..b1bbba0d 100644 --- a/vendor/symfony/http-foundation/Tests/FileBagTest.php +++ b/vendor/symfony/http-foundation/Tests/FileBagTest.php @@ -62,7 +62,7 @@ class FileBagTest extends TestCase public function testShouldRemoveEmptyUploadedFilesForMultiUpload() { - $bag = new FileBag(array('file' => array( + $bag = new FileBag(array('files' => array( 'name' => array(''), 'type' => array(''), 'tmp_name' => array(''), @@ -70,7 +70,20 @@ class FileBagTest extends TestCase 'size' => array(0), ))); - $this->assertSame(array(), $bag->get('file')); + $this->assertSame(array(), $bag->get('files')); + } + + public function testShouldNotRemoveEmptyUploadedFilesForAssociativeArray() + { + $bag = new FileBag(array('files' => array( + 'name' => array('file1' => ''), + 'type' => array('file1' => ''), + 'tmp_name' => array('file1' => ''), + 'error' => array('file1' => UPLOAD_ERR_NO_FILE), + 'size' => array('file1' => 0), + ))); + + $this->assertSame(array('file1' => null), $bag->get('files')); } public function testShouldConvertUploadedFilesWithPhpBug() diff --git a/vendor/symfony/http-foundation/Tests/HeaderBagTest.php b/vendor/symfony/http-foundation/Tests/HeaderBagTest.php index 1acf5930..6d19ceb0 100644 --- a/vendor/symfony/http-foundation/Tests/HeaderBagTest.php +++ b/vendor/symfony/http-foundation/Tests/HeaderBagTest.php @@ -200,6 +200,6 @@ class HeaderBagTest extends TestCase $headers = array('foo' => 'bar', 'HELLO' => 'WORLD'); $headerBag = new HeaderBag($headers); - $this->assertEquals(count($headers), count($headerBag)); + $this->assertCount(count($headers), $headerBag); } } diff --git a/vendor/symfony/http-foundation/Tests/IpUtilsTest.php b/vendor/symfony/http-foundation/Tests/IpUtilsTest.php index 297ee3d8..7a93f994 100644 --- a/vendor/symfony/http-foundation/Tests/IpUtilsTest.php +++ b/vendor/symfony/http-foundation/Tests/IpUtilsTest.php @@ -62,6 +62,8 @@ class IpUtilsTest extends TestCase array(false, '2a01:198:603:0:396e:4789:8e99:890f', '::1'), array(true, '0:0:0:0:0:0:0:1', '::1'), array(false, '0:0:603:0:396e:4789:8e99:0001', '::1'), + array(true, '0:0:603:0:396e:4789:8e99:0001', '::/0'), + array(true, '0:0:603:0:396e:4789:8e99:0001', '2a01:198:603:0::/0'), array(true, '2a01:198:603:0:396e:4789:8e99:890f', array('::1', '2a01:198:603:0::/65')), array(true, '2a01:198:603:0:396e:4789:8e99:890f', array('2a01:198:603:0::/65', '::1')), array(false, '2a01:198:603:0:396e:4789:8e99:890f', array('::1', '1a01:198:603:0::/65')), @@ -82,4 +84,21 @@ class IpUtilsTest extends TestCase IpUtils::checkIp('2a01:198:603:0:396e:4789:8e99:890f', '2a01:198:603:0::/65'); } + + /** + * @dataProvider invalidIpAddressData + */ + public function testInvalidIpAddressesDoNotMatch($requestIp, $proxyIp) + { + $this->assertFalse(IpUtils::checkIp4($requestIp, $proxyIp)); + } + + public function invalidIpAddressData() + { + return array( + 'invalid proxy wildcard' => array('192.168.20.13', '*'), + 'invalid proxy missing netmask' => array('192.168.20.13', '0.0.0.0'), + 'invalid request IP with invalid proxy wildcard' => array('0.0.0.0', '*'), + ); + } } diff --git a/vendor/symfony/http-foundation/Tests/ParameterBagTest.php b/vendor/symfony/http-foundation/Tests/ParameterBagTest.php index 5311a0d8..ab908d8d 100644 --- a/vendor/symfony/http-foundation/Tests/ParameterBagTest.php +++ b/vendor/symfony/http-foundation/Tests/ParameterBagTest.php @@ -179,7 +179,7 @@ class ParameterBagTest extends TestCase $parameters = array('foo' => 'bar', 'hello' => 'world'); $bag = new ParameterBag($parameters); - $this->assertEquals(count($parameters), count($bag)); + $this->assertCount(count($parameters), $bag); } public function testGetBoolean() diff --git a/vendor/symfony/http-foundation/Tests/RequestTest.php b/vendor/symfony/http-foundation/Tests/RequestTest.php index b36fbb7e..72add953 100644 --- a/vendor/symfony/http-foundation/Tests/RequestTest.php +++ b/vendor/symfony/http-foundation/Tests/RequestTest.php @@ -52,18 +52,18 @@ class RequestTest extends TestCase public function testGetUser() { - $request = Request::create('http://user_test:password_test@test.com/'); + $request = Request::create('http://user:password@test.com'); $user = $request->getUser(); - $this->assertEquals('user_test', $user); + $this->assertEquals('user', $user); } public function testGetPassword() { - $request = Request::create('http://user_test:password_test@test.com/'); + $request = Request::create('http://user:password@test.com'); $password = $request->getPassword(); - $this->assertEquals('password_test', $password); + $this->assertEquals('password', $password); } public function testIsNoCache() @@ -372,6 +372,7 @@ class RequestTest extends TestCase array('js', array('application/javascript', 'application/x-javascript', 'text/javascript')), array('css', array('text/css')), array('json', array('application/json', 'application/x-json')), + array('jsonld', array('application/ld+json')), array('xml', array('text/xml', 'application/xml', 'application/x-xml')), array('rdf', array('application/rdf+xml')), array('atom', array('application/atom+xml')), @@ -968,6 +969,26 @@ class RequestTest extends TestCase $request->getClientIps(); } + /** + * @dataProvider getClientIpsWithConflictingHeadersProvider + */ + public function testGetClientIpsOnlyXHttpForwardedForTrusted($httpForwarded, $httpXForwardedFor) + { + $request = new Request(); + + $server = array( + 'REMOTE_ADDR' => '88.88.88.88', + 'HTTP_FORWARDED' => $httpForwarded, + 'HTTP_X_FORWARDED_FOR' => $httpXForwardedFor, + ); + + Request::setTrustedProxies(array('88.88.88.88'), Request::HEADER_X_FORWARDED_FOR); + + $request->initialize(array(), array(), array(), array(), array(), $server); + + $this->assertSame(array_reverse(explode(',', $httpXForwardedFor)), $request->getClientIps()); + } + public function getClientIpsWithConflictingHeadersProvider() { // $httpForwarded $httpXForwardedFor @@ -1286,6 +1307,12 @@ class RequestTest extends TestCase $request->initialize(array(), array(), array(), array(), array(), $server); $this->assertEquals('/path%20test/info', $request->getPathInfo()); + + $server = array(); + $server['REQUEST_URI'] = '?a=b'; + $request->initialize(array(), array(), array(), array(), array(), $server); + + $this->assertEquals('/', $request->getPathInfo()); } public function testGetParameterPrecedence() @@ -1496,8 +1523,18 @@ class RequestTest extends TestCase $request = new Request(); $request->headers->set('Accept-language', 'zh, en-us; q=0.8, en; q=0.6'); + $request->cookies->set('Foo', 'Bar'); + + $asString = (string) $request; + + $this->assertContains('Accept-Language: zh, en-us; q=0.8, en; q=0.6', $asString); + $this->assertContains('Cookie: Foo=Bar', $asString); + + $request->cookies->set('Another', 'Cookie'); - $this->assertContains('Accept-Language: zh, en-us; q=0.8, en; q=0.6', $request->__toString()); + $asString = (string) $request; + + $this->assertContains('Cookie: Foo=Bar; Another=Cookie', $asString); } public function testIsMethod() @@ -1729,7 +1766,7 @@ class RequestTest extends TestCase /** * @group legacy - * @expectedDeprecation The "Symfony\Component\HttpFoundation\Request::setTrustedHeaderName()" method is deprecated since version 3.3 and will be removed in 4.0. Use the $trustedHeaderSet argument of the Request::setTrustedProxies() method instead. + * @expectedDeprecation The "Symfony\Component\HttpFoundation\Request::setTrustedHeaderName()" method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the $trustedHeaderSet argument of the Request::setTrustedProxies() method instead. */ public function testLegacyTrustedProxies() { @@ -2099,7 +2136,7 @@ class RequestTest extends TestCase /** * @group legacy - * @expectedDeprecation Checking only for cacheable HTTP methods with Symfony\Component\HttpFoundation\Request::isMethodSafe() is deprecated since version 3.2 and will throw an exception in 4.0. Disable checking only for cacheable methods by calling the method with `false` as first argument or use the Request::isMethodCacheable() instead. + * @expectedDeprecation Checking only for cacheable HTTP methods with Symfony\Component\HttpFoundation\Request::isMethodSafe() is deprecated since Symfony 3.2 and will throw an exception in 4.0. Disable checking only for cacheable methods by calling the method with `false` as first argument or use the Request::isMethodCacheable() instead. */ public function testMethodSafeChecksCacheable() { @@ -2188,6 +2225,91 @@ class RequestTest extends TestCase Request::setTrustedHeaderName(Request::HEADER_CLIENT_PORT, 'X_FORWARDED_PORT'); Request::setTrustedHeaderName(Request::HEADER_CLIENT_PROTO, 'X_FORWARDED_PROTO'); } + + /** + * @dataProvider protocolVersionProvider + */ + public function testProtocolVersion($serverProtocol, $trustedProxy, $via, $expected) + { + if ($trustedProxy) { + Request::setTrustedProxies(array('1.1.1.1'), -1); + } + + $request = new Request(); + $request->server->set('SERVER_PROTOCOL', $serverProtocol); + $request->server->set('REMOTE_ADDR', '1.1.1.1'); + $request->headers->set('Via', $via); + + $this->assertSame($expected, $request->getProtocolVersion()); + } + + public function protocolVersionProvider() + { + return array( + 'untrusted without via' => array('HTTP/2.0', false, '', 'HTTP/2.0'), + 'untrusted with via' => array('HTTP/2.0', false, '1.0 fred, 1.1 nowhere.com (Apache/1.1)', 'HTTP/2.0'), + 'trusted without via' => array('HTTP/2.0', true, '', 'HTTP/2.0'), + 'trusted with via' => array('HTTP/2.0', true, '1.0 fred, 1.1 nowhere.com (Apache/1.1)', 'HTTP/1.0'), + 'trusted with via and protocol name' => array('HTTP/2.0', true, 'HTTP/1.0 fred, HTTP/1.1 nowhere.com (Apache/1.1)', 'HTTP/1.0'), + 'trusted with broken via' => array('HTTP/2.0', true, 'HTTP/1^0 foo', 'HTTP/2.0'), + 'trusted with partially-broken via' => array('HTTP/2.0', true, '1.0 fred, foo', 'HTTP/1.0'), + ); + } + + public function nonstandardRequestsData() + { + return array( + array('', '', '/', 'http://host:8080/', ''), + array('/', '', '/', 'http://host:8080/', ''), + + array('hello/app.php/x', '', '/x', 'http://host:8080/hello/app.php/x', '/hello', '/hello/app.php'), + array('/hello/app.php/x', '', '/x', 'http://host:8080/hello/app.php/x', '/hello', '/hello/app.php'), + + array('', 'a=b', '/', 'http://host:8080/?a=b'), + array('?a=b', 'a=b', '/', 'http://host:8080/?a=b'), + array('/?a=b', 'a=b', '/', 'http://host:8080/?a=b'), + + array('x', 'a=b', '/x', 'http://host:8080/x?a=b'), + array('x?a=b', 'a=b', '/x', 'http://host:8080/x?a=b'), + array('/x?a=b', 'a=b', '/x', 'http://host:8080/x?a=b'), + + array('hello/x', '', '/x', 'http://host:8080/hello/x', '/hello'), + array('/hello/x', '', '/x', 'http://host:8080/hello/x', '/hello'), + + array('hello/app.php/x', 'a=b', '/x', 'http://host:8080/hello/app.php/x?a=b', '/hello', '/hello/app.php'), + array('hello/app.php/x?a=b', 'a=b', '/x', 'http://host:8080/hello/app.php/x?a=b', '/hello', '/hello/app.php'), + array('/hello/app.php/x?a=b', 'a=b', '/x', 'http://host:8080/hello/app.php/x?a=b', '/hello', '/hello/app.php'), + ); + } + + /** + * @dataProvider nonstandardRequestsData + */ + public function testNonstandardRequests($requestUri, $queryString, $expectedPathInfo, $expectedUri, $expectedBasePath = '', $expectedBaseUrl = null) + { + if (null === $expectedBaseUrl) { + $expectedBaseUrl = $expectedBasePath; + } + + $server = array( + 'HTTP_HOST' => 'host:8080', + 'SERVER_PORT' => '8080', + 'QUERY_STRING' => $queryString, + 'PHP_SELF' => '/hello/app.php', + 'SCRIPT_FILENAME' => '/some/path/app.php', + 'REQUEST_URI' => $requestUri, + ); + + $request = new Request(array(), array(), array(), array(), array(), $server); + + $this->assertEquals($expectedPathInfo, $request->getPathInfo()); + $this->assertEquals($expectedUri, $request->getUri()); + $this->assertEquals($queryString, $request->getQueryString()); + $this->assertEquals(8080, $request->getPort()); + $this->assertEquals('host:8080', $request->getHttpHost()); + $this->assertEquals($expectedBaseUrl, $request->getBaseUrl()); + $this->assertEquals($expectedBasePath, $request->getBasePath()); + } } class RequestContentProxy extends Request diff --git a/vendor/symfony/http-foundation/Tests/ResponseHeaderBagTest.php b/vendor/symfony/http-foundation/Tests/ResponseHeaderBagTest.php index 41365672..ce855359 100644 --- a/vendor/symfony/http-foundation/Tests/ResponseHeaderBagTest.php +++ b/vendor/symfony/http-foundation/Tests/ResponseHeaderBagTest.php @@ -20,48 +20,24 @@ use Symfony\Component\HttpFoundation\Cookie; */ class ResponseHeaderBagTest extends TestCase { - /** - * @dataProvider provideAllPreserveCase - */ - public function testAllPreserveCase($headers, $expected) + public function testAllPreserveCase() { - $bag = new ResponseHeaderBag($headers); + $headers = array( + 'fOo' => 'BAR', + 'ETag' => 'xyzzy', + 'Content-MD5' => 'Q2hlY2sgSW50ZWdyaXR5IQ==', + 'P3P' => 'CP="CAO PSA OUR"', + 'WWW-Authenticate' => 'Basic realm="WallyWorld"', + 'X-UA-Compatible' => 'IE=edge,chrome=1', + 'X-XSS-Protection' => '1; mode=block', + ); - $this->assertEquals($expected, $bag->allPreserveCase(), '->allPreserveCase() gets all input keys in original case'); - } + $bag = new ResponseHeaderBag($headers); + $allPreservedCase = $bag->allPreserveCase(); - public function provideAllPreserveCase() - { - return array( - array( - array('fOo' => 'BAR'), - array('fOo' => array('BAR'), 'Cache-Control' => array('no-cache, private')), - ), - array( - array('ETag' => 'xyzzy'), - array('ETag' => array('xyzzy'), 'Cache-Control' => array('private, must-revalidate')), - ), - array( - array('Content-MD5' => 'Q2hlY2sgSW50ZWdyaXR5IQ=='), - array('Content-MD5' => array('Q2hlY2sgSW50ZWdyaXR5IQ=='), 'Cache-Control' => array('no-cache, private')), - ), - array( - array('P3P' => 'CP="CAO PSA OUR"'), - array('P3P' => array('CP="CAO PSA OUR"'), 'Cache-Control' => array('no-cache, private')), - ), - array( - array('WWW-Authenticate' => 'Basic realm="WallyWorld"'), - array('WWW-Authenticate' => array('Basic realm="WallyWorld"'), 'Cache-Control' => array('no-cache, private')), - ), - array( - array('X-UA-Compatible' => 'IE=edge,chrome=1'), - array('X-UA-Compatible' => array('IE=edge,chrome=1'), 'Cache-Control' => array('no-cache, private')), - ), - array( - array('X-XSS-Protection' => '1; mode=block'), - array('X-XSS-Protection' => array('1; mode=block'), 'Cache-Control' => array('no-cache, private')), - ), - ); + foreach (array_keys($headers) as $headerName) { + $this->assertArrayHasKey($headerName, $allPreservedCase, '->allPreserveCase() gets all input keys in original case'); + } } public function testCacheControlHeader() @@ -110,6 +86,17 @@ class ResponseHeaderBagTest extends TestCase $bag = new ResponseHeaderBag(); $bag->set('Last-Modified', 'abcde'); $this->assertEquals('private, must-revalidate', $bag->get('Cache-Control')); + + $bag = new ResponseHeaderBag(); + $bag->set('Cache-Control', array('public', 'must-revalidate')); + $this->assertCount(1, $bag->get('Cache-Control', null, false)); + $this->assertEquals('must-revalidate, public', $bag->get('Cache-Control')); + + $bag = new ResponseHeaderBag(); + $bag->set('Cache-Control', 'public'); + $bag->set('Cache-Control', 'must-revalidate', false); + $this->assertCount(1, $bag->get('Cache-Control', null, false)); + $this->assertEquals('must-revalidate, public', $bag->get('Cache-Control')); } public function testCacheControlClone() @@ -188,10 +175,10 @@ class ResponseHeaderBagTest extends TestCase $cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY); - $this->assertTrue(isset($cookies['foo.bar']['/path/foo']['foo'])); - $this->assertTrue(isset($cookies['foo.bar']['/path/bar']['foo'])); - $this->assertTrue(isset($cookies['bar.foo']['/path/bar']['foo'])); - $this->assertTrue(isset($cookies['']['/']['foo'])); + $this->assertArrayHasKey('foo', $cookies['foo.bar']['/path/foo']); + $this->assertArrayHasKey('foo', $cookies['foo.bar']['/path/bar']); + $this->assertArrayHasKey('foo', $cookies['bar.foo']['/path/bar']); + $this->assertArrayHasKey('foo', $cookies['']['/']); } public function testRemoveCookie() @@ -204,19 +191,19 @@ class ResponseHeaderBagTest extends TestCase $this->assertTrue($bag->has('set-cookie')); $cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY); - $this->assertTrue(isset($cookies['foo.bar']['/path/foo'])); + $this->assertArrayHasKey('/path/foo', $cookies['foo.bar']); $bag->removeCookie('foo', '/path/foo', 'foo.bar'); $this->assertTrue($bag->has('set-cookie')); $cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY); - $this->assertFalse(isset($cookies['foo.bar']['/path/foo'])); + $this->assertArrayNotHasKey('/path/foo', $cookies['foo.bar']); $bag->removeCookie('bar', '/path/bar', 'foo.bar'); $this->assertFalse($bag->has('set-cookie')); $cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY); - $this->assertFalse(isset($cookies['foo.bar'])); + $this->assertArrayNotHasKey('foo.bar', $cookies); } public function testRemoveCookieWithNullRemove() @@ -226,11 +213,11 @@ class ResponseHeaderBagTest extends TestCase $bag->setCookie(new Cookie('bar', 'foo', 0)); $cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY); - $this->assertTrue(isset($cookies['']['/'])); + $this->assertArrayHasKey('/', $cookies['']); $bag->removeCookie('foo', null); $cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY); - $this->assertFalse(isset($cookies['']['/']['foo'])); + $this->assertArrayNotHasKey('foo', $cookies['']['/']); $bag->removeCookie('bar', null); $cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY); @@ -332,6 +319,43 @@ class ResponseHeaderBagTest extends TestCase ); } + public function testDateHeaderAddedOnCreation() + { + $now = time(); + + $bag = new ResponseHeaderBag(); + $this->assertTrue($bag->has('Date')); + + $this->assertEquals($now, $bag->getDate('Date')->getTimestamp()); + } + + public function testDateHeaderCanBeSetOnCreation() + { + $someDate = 'Thu, 23 Mar 2017 09:15:12 GMT'; + $bag = new ResponseHeaderBag(array('Date' => $someDate)); + + $this->assertEquals($someDate, $bag->get('Date')); + } + + public function testDateHeaderWillBeRecreatedWhenRemoved() + { + $someDate = 'Thu, 23 Mar 2017 09:15:12 GMT'; + $bag = new ResponseHeaderBag(array('Date' => $someDate)); + $bag->remove('Date'); + + // a (new) Date header is still present + $this->assertTrue($bag->has('Date')); + $this->assertNotEquals($someDate, $bag->get('Date')); + } + + public function testDateHeaderWillBeRecreatedWhenHeadersAreReplaced() + { + $bag = new ResponseHeaderBag(); + $bag->replace(array()); + + $this->assertTrue($bag->has('Date')); + } + private function assertSetCookieHeader($expected, ResponseHeaderBag $actual) { $this->assertRegExp('#^Set-Cookie:\s+'.preg_quote($expected, '#').'$#m', str_replace("\r\n", "\n", (string) $actual)); diff --git a/vendor/symfony/http-foundation/Tests/ResponseTest.php b/vendor/symfony/http-foundation/Tests/ResponseTest.php index 62b8c652..350d972a 100644 --- a/vendor/symfony/http-foundation/Tests/ResponseTest.php +++ b/vendor/symfony/http-foundation/Tests/ResponseTest.php @@ -610,6 +610,12 @@ class ResponseTest extends ResponseTestCase $response->setCache(array('private' => false)); $this->assertTrue($response->headers->hasCacheControlDirective('public')); $this->assertFalse($response->headers->hasCacheControlDirective('private')); + + $response->setCache(array('immutable' => true)); + $this->assertTrue($response->headers->hasCacheControlDirective('immutable')); + + $response->setCache(array('immutable' => false)); + $this->assertFalse($response->headers->hasCacheControlDirective('immutable')); } public function testSendContent() @@ -631,6 +637,22 @@ class ResponseTest extends ResponseTestCase $this->assertFalse($response->headers->hasCacheControlDirective('private')); } + public function testSetImmutable() + { + $response = new Response(); + $response->setImmutable(); + + $this->assertTrue($response->headers->hasCacheControlDirective('immutable')); + } + + public function testIsImmutable() + { + $response = new Response(); + $response->setImmutable(); + + $this->assertTrue($response->isImmutable()); + } + public function testSetExpires() { $response = new Response(); @@ -924,7 +946,7 @@ class ResponseTest extends ResponseTestCase $ianaCodesReasonPhrases = array(); - $xpath = new \DomXPath($ianaHttpStatusCodes); + $xpath = new \DOMXPath($ianaHttpStatusCodes); $xpath->registerNamespace('ns', 'http://www.iana.org/assignments'); $records = $xpath->query('//ns:record'); diff --git a/vendor/symfony/http-foundation/Tests/ServerBagTest.php b/vendor/symfony/http-foundation/Tests/ServerBagTest.php index c1d9d12a..f8becec5 100644 --- a/vendor/symfony/http-foundation/Tests/ServerBagTest.php +++ b/vendor/symfony/http-foundation/Tests/ServerBagTest.php @@ -74,8 +74,8 @@ class ServerBagTest extends TestCase // Username and passwords should not be set as the header is bogus $headers = $bag->getHeaders(); - $this->assertFalse(isset($headers['PHP_AUTH_USER'])); - $this->assertFalse(isset($headers['PHP_AUTH_PW'])); + $this->assertArrayNotHasKey('PHP_AUTH_USER', $headers); + $this->assertArrayNotHasKey('PHP_AUTH_PW', $headers); } public function testHttpBasicAuthWithPhpCgiRedirect() @@ -118,8 +118,8 @@ class ServerBagTest extends TestCase // Username and passwords should not be set as the header is bogus $headers = $bag->getHeaders(); - $this->assertFalse(isset($headers['PHP_AUTH_USER'])); - $this->assertFalse(isset($headers['PHP_AUTH_PW'])); + $this->assertArrayNotHasKey('PHP_AUTH_USER', $headers); + $this->assertArrayNotHasKey('PHP_AUTH_PW', $headers); } public function testHttpDigestAuthWithPhpCgiRedirect() diff --git a/vendor/symfony/http-foundation/Tests/Session/Attribute/AttributeBagTest.php b/vendor/symfony/http-foundation/Tests/Session/Attribute/AttributeBagTest.php index 8c148b58..724a0b98 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Attribute/AttributeBagTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Attribute/AttributeBagTest.php @@ -21,10 +21,7 @@ use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag; */ class AttributeBagTest extends TestCase { - /** - * @var array - */ - private $array; + private $array = array(); /** * @var AttributeBag @@ -184,6 +181,6 @@ class AttributeBagTest extends TestCase public function testCount() { - $this->assertEquals(count($this->array), count($this->bag)); + $this->assertCount(count($this->array), $this->bag); } } diff --git a/vendor/symfony/http-foundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php b/vendor/symfony/http-foundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php index d9d9eb7f..f074ce1b 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php @@ -21,10 +21,7 @@ use Symfony\Component\HttpFoundation\Session\Attribute\NamespacedAttributeBag; */ class NamespacedAttributeBagTest extends TestCase { - /** - * @var array - */ - private $array; + private $array = array(); /** * @var NamespacedAttributeBag diff --git a/vendor/symfony/http-foundation/Tests/Session/Flash/AutoExpireFlashBagTest.php b/vendor/symfony/http-foundation/Tests/Session/Flash/AutoExpireFlashBagTest.php index 4eb200af..fa8626ab 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Flash/AutoExpireFlashBagTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Flash/AutoExpireFlashBagTest.php @@ -26,9 +26,6 @@ class AutoExpireFlashBagTest extends TestCase */ private $bag; - /** - * @var array - */ protected $array = array(); protected function setUp() @@ -62,7 +59,7 @@ class AutoExpireFlashBagTest extends TestCase public function testGetStorageKey() { - $this->assertEquals('_sf2_flashes', $this->bag->getStorageKey()); + $this->assertEquals('_symfony_flashes', $this->bag->getStorageKey()); $attributeBag = new FlashBag('test'); $this->assertEquals('test', $attributeBag->getStorageKey()); } @@ -153,4 +150,12 @@ class AutoExpireFlashBagTest extends TestCase { $this->assertEquals(array('notice' => array('A previous flash message')), $this->bag->clear()); } + + public function testDoNotRemoveTheNewFlashesWhenDisplayingTheExistingOnes() + { + $this->bag->add('success', 'Something'); + $this->bag->all(); + + $this->assertEquals(array('new' => array('success' => array('Something')), 'display' => array()), $this->array); + } } diff --git a/vendor/symfony/http-foundation/Tests/Session/Flash/FlashBagTest.php b/vendor/symfony/http-foundation/Tests/Session/Flash/FlashBagTest.php index f0aa6a61..c4e75b1b 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Flash/FlashBagTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Flash/FlashBagTest.php @@ -26,9 +26,6 @@ class FlashBagTest extends TestCase */ private $bag; - /** - * @var array - */ protected $array = array(); protected function setUp() @@ -57,7 +54,7 @@ class FlashBagTest extends TestCase public function testGetStorageKey() { - $this->assertEquals('_sf2_flashes', $this->bag->getStorageKey()); + $this->assertEquals('_symfony_flashes', $this->bag->getStorageKey()); $attributeBag = new FlashBag('test'); $this->assertEquals('test', $attributeBag->getStorageKey()); } diff --git a/vendor/symfony/http-foundation/Tests/Session/SessionTest.php b/vendor/symfony/http-foundation/Tests/Session/SessionTest.php index fa93507a..41720e4b 100644 --- a/vendor/symfony/http-foundation/Tests/Session/SessionTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/SessionTest.php @@ -221,4 +221,22 @@ class SessionTest extends TestCase { $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\MetadataBag', $this->session->getMetadataBag()); } + + public function testIsEmpty() + { + $this->assertTrue($this->session->isEmpty()); + + $this->session->set('hello', 'world'); + $this->assertFalse($this->session->isEmpty()); + + $this->session->remove('hello'); + $this->assertTrue($this->session->isEmpty()); + + $flash = $this->session->getFlashBag(); + $flash->set('hello', 'world'); + $this->assertFalse($this->session->isEmpty()); + + $flash->get('hello'); + $this->assertTrue($this->session->isEmpty()); + } } diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/AbstractSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/AbstractSessionHandlerTest.php new file mode 100644 index 00000000..3ac081e3 --- /dev/null +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/AbstractSessionHandlerTest.php @@ -0,0 +1,61 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler; + +use PHPUnit\Framework\TestCase; + +/** + * @requires PHP 7.0 + */ +class AbstractSessionHandlerTest extends TestCase +{ + private static $server; + + public static function setUpBeforeClass() + { + $spec = array( + 1 => array('file', '/dev/null', 'w'), + 2 => array('file', '/dev/null', 'w'), + ); + if (!self::$server = @proc_open('exec php -S localhost:8053', $spec, $pipes, __DIR__.'/Fixtures')) { + self::markTestSkipped('PHP server unable to start.'); + } + sleep(1); + } + + public static function tearDownAfterClass() + { + if (self::$server) { + proc_terminate(self::$server); + proc_close(self::$server); + } + } + + /** + * @dataProvider provideSession + */ + public function testSession($fixture) + { + $context = array('http' => array('header' => "Cookie: sid=123abc\r\n")); + $context = stream_context_create($context); + $result = file_get_contents(sprintf('http://localhost:8053/%s.php', $fixture), false, $context); + + $this->assertStringEqualsFile(__DIR__.sprintf('/Fixtures/%s.expected', $fixture), $result); + } + + public function provideSession() + { + foreach (glob(__DIR__.'/Fixtures/*.php') as $file) { + yield array(pathinfo($file, PATHINFO_FILENAME)); + } + } +} diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/common.inc b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/common.inc new file mode 100644 index 00000000..7a064c7f --- /dev/null +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/common.inc @@ -0,0 +1,151 @@ +<?php + +use Symfony\Component\HttpFoundation\Session\Storage\Handler\AbstractSessionHandler; + +$parent = __DIR__; +while (!@file_exists($parent.'/vendor/autoload.php')) { + if (!@file_exists($parent)) { + // open_basedir restriction in effect + break; + } + if ($parent === dirname($parent)) { + echo "vendor/autoload.php not found\n"; + exit(1); + } + + $parent = dirname($parent); +} + +require $parent.'/vendor/autoload.php'; + +error_reporting(-1); +ini_set('html_errors', 0); +ini_set('display_errors', 1); +ini_set('session.gc_probability', 0); +ini_set('session.serialize_handler', 'php'); +ini_set('session.cookie_lifetime', 0); +ini_set('session.cookie_domain', ''); +ini_set('session.cookie_secure', ''); +ini_set('session.cookie_httponly', ''); +ini_set('session.use_cookies', 1); +ini_set('session.use_only_cookies', 1); +ini_set('session.cache_expire', 180); +ini_set('session.cookie_path', '/'); +ini_set('session.cookie_domain', ''); +ini_set('session.cookie_secure', 1); +ini_set('session.cookie_httponly', 1); +ini_set('session.use_strict_mode', 1); +ini_set('session.lazy_write', 1); +ini_set('session.name', 'sid'); +ini_set('session.save_path', __DIR__); +ini_set('session.cache_limiter', ''); + +header_remove('X-Powered-By'); +header('Content-Type: text/plain; charset=utf-8'); + +register_shutdown_function(function () { + echo "\n"; + session_write_close(); + print_r(headers_list()); + echo "shutdown\n"; +}); +ob_start(); + +class TestSessionHandler extends AbstractSessionHandler +{ + private $data; + + public function __construct($data = '') + { + $this->data = $data; + } + + public function open($path, $name) + { + echo __FUNCTION__, "\n"; + + return parent::open($path, $name); + } + + public function validateId($sessionId) + { + echo __FUNCTION__, "\n"; + + return parent::validateId($sessionId); + } + + /** + * {@inheritdoc} + */ + public function read($sessionId) + { + echo __FUNCTION__, "\n"; + + return parent::read($sessionId); + } + + /** + * {@inheritdoc} + */ + public function updateTimestamp($sessionId, $data) + { + echo __FUNCTION__, "\n"; + + return true; + } + + /** + * {@inheritdoc} + */ + public function write($sessionId, $data) + { + echo __FUNCTION__, "\n"; + + return parent::write($sessionId, $data); + } + + /** + * {@inheritdoc} + */ + public function destroy($sessionId) + { + echo __FUNCTION__, "\n"; + + return parent::destroy($sessionId); + } + + public function close() + { + echo __FUNCTION__, "\n"; + + return true; + } + + public function gc($maxLifetime) + { + echo __FUNCTION__, "\n"; + + return true; + } + + protected function doRead($sessionId) + { + echo __FUNCTION__.': ', $this->data, "\n"; + + return $this->data; + } + + protected function doWrite($sessionId, $data) + { + echo __FUNCTION__.': ', $data, "\n"; + + return true; + } + + protected function doDestroy($sessionId) + { + echo __FUNCTION__, "\n"; + + return true; + } +} diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/empty_destroys.expected b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/empty_destroys.expected new file mode 100644 index 00000000..82037147 --- /dev/null +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/empty_destroys.expected @@ -0,0 +1,17 @@ +open +validateId +read +doRead: abc|i:123; +read + +write +destroy +doDestroy +close +Array +( + [0] => Content-Type: text/plain; charset=utf-8 + [1] => Cache-Control: max-age=10800, private, must-revalidate + [2] => Set-Cookie: sid=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/; secure; HttpOnly +) +shutdown diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/empty_destroys.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/empty_destroys.php new file mode 100644 index 00000000..3cfc1250 --- /dev/null +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/empty_destroys.php @@ -0,0 +1,8 @@ +<?php + +require __DIR__.'/common.inc'; + +session_set_save_handler(new TestSessionHandler('abc|i:123;'), false); +session_start(); + +unset($_SESSION['abc']); diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/read_only.expected b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/read_only.expected new file mode 100644 index 00000000..587adaf1 --- /dev/null +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/read_only.expected @@ -0,0 +1,14 @@ +open +validateId +read +doRead: abc|i:123; +read +123 +updateTimestamp +close +Array +( + [0] => Content-Type: text/plain; charset=utf-8 + [1] => Cache-Control: max-age=10800, private, must-revalidate +) +shutdown diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/read_only.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/read_only.php new file mode 100644 index 00000000..3e62fb9e --- /dev/null +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/read_only.php @@ -0,0 +1,8 @@ +<?php + +require __DIR__.'/common.inc'; + +session_set_save_handler(new TestSessionHandler('abc|i:123;'), false); +session_start(); + +echo $_SESSION['abc']; diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/regenerate.expected b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/regenerate.expected new file mode 100644 index 00000000..baa5f2f6 --- /dev/null +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/regenerate.expected @@ -0,0 +1,24 @@ +open +validateId +read +doRead: abc|i:123; +read +destroy +doDestroy +close +open +validateId +read +doRead: abc|i:123; +read + +write +doWrite: abc|i:123; +close +Array +( + [0] => Content-Type: text/plain; charset=utf-8 + [1] => Cache-Control: max-age=10800, private, must-revalidate + [2] => Set-Cookie: sid=random_session_id; path=/; secure; HttpOnly +) +shutdown diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/regenerate.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/regenerate.php new file mode 100644 index 00000000..a0f635c8 --- /dev/null +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/regenerate.php @@ -0,0 +1,10 @@ +<?php + +require __DIR__.'/common.inc'; + +session_set_save_handler(new TestSessionHandler('abc|i:123;'), false); +session_start(); + +session_regenerate_id(true); + +ob_start(function ($buffer) { return str_replace(session_id(), 'random_session_id', $buffer); }); diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/storage.expected b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/storage.expected new file mode 100644 index 00000000..4533a10a --- /dev/null +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/storage.expected @@ -0,0 +1,20 @@ +open +validateId +read +doRead: +read +Array +( + [0] => bar +) +$_SESSION is not empty +write +destroy +close +$_SESSION is not empty +Array +( + [0] => Content-Type: text/plain; charset=utf-8 + [1] => Cache-Control: max-age=0, private, must-revalidate +) +shutdown diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/storage.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/storage.php new file mode 100644 index 00000000..96dca3c2 --- /dev/null +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/storage.php @@ -0,0 +1,24 @@ +<?php + +require __DIR__.'/common.inc'; + +use Symfony\Component\HttpFoundation\Session\Flash\FlashBag; +use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage; + +$storage = new NativeSessionStorage(); +$storage->setSaveHandler(new TestSessionHandler()); +$flash = new FlashBag(); +$storage->registerBag($flash); +$storage->start(); + +$flash->add('foo', 'bar'); + +print_r($flash->get('foo')); +echo empty($_SESSION) ? '$_SESSION is empty' : '$_SESSION is not empty'; +echo "\n"; + +$storage->save(); + +echo empty($_SESSION) ? '$_SESSION is empty' : '$_SESSION is not empty'; + +ob_start(function ($buffer) { return str_replace(session_id(), 'random_session_id', $buffer); }); diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_cookie.expected b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_cookie.expected new file mode 100644 index 00000000..33da0a5b --- /dev/null +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_cookie.expected @@ -0,0 +1,15 @@ +open +validateId +read +doRead: abc|i:123; +read + +updateTimestamp +close +Array +( + [0] => Content-Type: text/plain; charset=utf-8 + [1] => Cache-Control: max-age=10800, private, must-revalidate + [2] => Set-Cookie: abc=def +) +shutdown diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_cookie.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_cookie.php new file mode 100644 index 00000000..ffb5b20a --- /dev/null +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_cookie.php @@ -0,0 +1,8 @@ +<?php + +require __DIR__.'/common.inc'; + +session_set_save_handler(new TestSessionHandler('abc|i:123;'), false); +session_start(); + +setcookie('abc', 'def'); diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_cookie_and_session.expected b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_cookie_and_session.expected new file mode 100644 index 00000000..5de2d9e3 --- /dev/null +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_cookie_and_session.expected @@ -0,0 +1,24 @@ +open +validateId +read +doRead: abc|i:123; +read +updateTimestamp +close +open +validateId +read +doRead: abc|i:123; +read + +write +destroy +doDestroy +close +Array +( + [0] => Content-Type: text/plain; charset=utf-8 + [1] => Cache-Control: max-age=10800, private, must-revalidate + [2] => Set-Cookie: abc=def +) +shutdown diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_cookie_and_session.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_cookie_and_session.php new file mode 100644 index 00000000..ec511932 --- /dev/null +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_cookie_and_session.php @@ -0,0 +1,13 @@ +<?php + +require __DIR__.'/common.inc'; + +setcookie('abc', 'def'); + +session_set_save_handler(new TestSessionHandler('abc|i:123;'), false); +session_start(); +session_write_close(); +session_start(); + +$_SESSION['abc'] = 234; +unset($_SESSION['abc']); diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php index 06193c8b..dda43c80 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php @@ -17,11 +17,13 @@ use Symfony\Component\HttpFoundation\Session\Storage\Handler\MemcacheSessionHand /** * @requires extension memcache * @group time-sensitive + * @group legacy */ class MemcacheSessionHandlerTest extends TestCase { const PREFIX = 'prefix_'; const TTL = 1000; + /** * @var MemcacheSessionHandler */ diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php index b5fee8eb..da051096 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php @@ -17,6 +17,7 @@ use Symfony\Component\HttpFoundation\Session\Storage\Handler\MongoDbSessionHandl /** * @author Markus Bachmann <markus.bachmann@bachi.biz> * @group time-sensitive + * @group legacy */ class MongoDbSessionHandlerTest extends TestCase { diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NativeSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NativeSessionHandlerTest.php index 5486b2d6..1a68d575 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NativeSessionHandlerTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NativeSessionHandlerTest.php @@ -21,9 +21,13 @@ use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandle * * @runTestsInSeparateProcesses * @preserveGlobalState disabled + * @group legacy */ class NativeSessionHandlerTest extends TestCase { + /** + * @expectedDeprecation The Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler class is deprecated since Symfony 3.4 and will be removed in 4.0. Use the \SessionHandler class instead. + */ public function testConstruct() { $handler = new NativeSessionHandler(); diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php index a47120f1..a0d7529f 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php @@ -160,6 +160,9 @@ class PdoSessionHandlerTest extends TestCase if (defined('HHVM_VERSION')) { $this->markTestSkipped('PHPUnit_MockObject cannot mock the PDOStatement class on HHVM. See https://github.com/sebastianbergmann/phpunit-mock-objects/pull/289'); } + if (ini_get('session.use_strict_mode')) { + $this->markTestSkipped('Strict mode needs no locking for new sessions.'); + } $pdo = new MockPdo('pgsql'); $selectStmt = $this->getMockBuilder('PDOStatement')->getMock(); @@ -269,6 +272,9 @@ class PdoSessionHandlerTest extends TestCase $this->assertSame('', $data, 'Destroyed session returns empty string'); } + /** + * @runInSeparateProcess + */ public function testSessionGC() { $previousLifeTime = ini_set('session.gc_maxlifetime', 1000); diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/StrictSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/StrictSessionHandlerTest.php new file mode 100644 index 00000000..b02c41ae --- /dev/null +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/StrictSessionHandlerTest.php @@ -0,0 +1,189 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\HttpFoundation\Session\Storage\Handler\AbstractSessionHandler; +use Symfony\Component\HttpFoundation\Session\Storage\Handler\StrictSessionHandler; + +class StrictSessionHandlerTest extends TestCase +{ + public function testOpen() + { + $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock(); + $handler->expects($this->once())->method('open') + ->with('path', 'name')->willReturn(true); + $proxy = new StrictSessionHandler($handler); + + $this->assertInstanceOf('SessionUpdateTimestampHandlerInterface', $proxy); + $this->assertInstanceOf(AbstractSessionHandler::class, $proxy); + $this->assertTrue($proxy->open('path', 'name')); + } + + public function testCloseSession() + { + $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock(); + $handler->expects($this->once())->method('close') + ->willReturn(true); + $proxy = new StrictSessionHandler($handler); + + $this->assertTrue($proxy->close()); + } + + public function testValidateIdOK() + { + $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock(); + $handler->expects($this->once())->method('read') + ->with('id')->willReturn('data'); + $proxy = new StrictSessionHandler($handler); + + $this->assertTrue($proxy->validateId('id')); + } + + public function testValidateIdKO() + { + $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock(); + $handler->expects($this->once())->method('read') + ->with('id')->willReturn(''); + $proxy = new StrictSessionHandler($handler); + + $this->assertFalse($proxy->validateId('id')); + } + + public function testRead() + { + $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock(); + $handler->expects($this->once())->method('read') + ->with('id')->willReturn('data'); + $proxy = new StrictSessionHandler($handler); + + $this->assertSame('data', $proxy->read('id')); + } + + public function testReadWithValidateIdOK() + { + $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock(); + $handler->expects($this->once())->method('read') + ->with('id')->willReturn('data'); + $proxy = new StrictSessionHandler($handler); + + $this->assertTrue($proxy->validateId('id')); + $this->assertSame('data', $proxy->read('id')); + } + + public function testReadWithValidateIdMismatch() + { + $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock(); + $handler->expects($this->exactly(2))->method('read') + ->withConsecutive(array('id1'), array('id2')) + ->will($this->onConsecutiveCalls('data1', 'data2')); + $proxy = new StrictSessionHandler($handler); + + $this->assertTrue($proxy->validateId('id1')); + $this->assertSame('data2', $proxy->read('id2')); + } + + public function testUpdateTimestamp() + { + $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock(); + $handler->expects($this->once())->method('write') + ->with('id', 'data')->willReturn(true); + $proxy = new StrictSessionHandler($handler); + + $this->assertTrue($proxy->updateTimestamp('id', 'data')); + } + + public function testWrite() + { + $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock(); + $handler->expects($this->once())->method('write') + ->with('id', 'data')->willReturn(true); + $proxy = new StrictSessionHandler($handler); + + $this->assertTrue($proxy->write('id', 'data')); + } + + public function testWriteEmptyNewSession() + { + $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock(); + $handler->expects($this->once())->method('read') + ->with('id')->willReturn(''); + $handler->expects($this->never())->method('write'); + $handler->expects($this->once())->method('destroy')->willReturn(true); + $proxy = new StrictSessionHandler($handler); + + $this->assertFalse($proxy->validateId('id')); + $this->assertSame('', $proxy->read('id')); + $this->assertTrue($proxy->write('id', '')); + } + + public function testWriteEmptyExistingSession() + { + $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock(); + $handler->expects($this->once())->method('read') + ->with('id')->willReturn('data'); + $handler->expects($this->never())->method('write'); + $handler->expects($this->once())->method('destroy')->willReturn(true); + $proxy = new StrictSessionHandler($handler); + + $this->assertSame('data', $proxy->read('id')); + $this->assertTrue($proxy->write('id', '')); + } + + public function testDestroy() + { + $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock(); + $handler->expects($this->once())->method('destroy') + ->with('id')->willReturn(true); + $proxy = new StrictSessionHandler($handler); + + $this->assertTrue($proxy->destroy('id')); + } + + public function testDestroyNewSession() + { + $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock(); + $handler->expects($this->once())->method('read') + ->with('id')->willReturn(''); + $handler->expects($this->once())->method('destroy')->willReturn(true); + $proxy = new StrictSessionHandler($handler); + + $this->assertSame('', $proxy->read('id')); + $this->assertTrue($proxy->destroy('id')); + } + + public function testDestroyNonEmptyNewSession() + { + $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock(); + $handler->expects($this->once())->method('read') + ->with('id')->willReturn(''); + $handler->expects($this->once())->method('write') + ->with('id', 'data')->willReturn(true); + $handler->expects($this->once())->method('destroy') + ->with('id')->willReturn(true); + $proxy = new StrictSessionHandler($handler); + + $this->assertSame('', $proxy->read('id')); + $this->assertTrue($proxy->write('id', 'data')); + $this->assertTrue($proxy->destroy('id')); + } + + public function testGc() + { + $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock(); + $handler->expects($this->once())->method('gc') + ->with(123)->willReturn(true); + $proxy = new StrictSessionHandler($handler); + + $this->assertTrue($proxy->gc(123)); + } +} diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/WriteCheckSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/WriteCheckSessionHandlerTest.php index 5e41a474..898a7d11 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/WriteCheckSessionHandlerTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/WriteCheckSessionHandlerTest.php @@ -16,6 +16,8 @@ use Symfony\Component\HttpFoundation\Session\Storage\Handler\WriteCheckSessionHa /** * @author Adrien Brault <adrien.brault@gmail.com> + * + * @group legacy */ class WriteCheckSessionHandlerTest extends TestCase { diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/MetadataBagTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/MetadataBagTest.php index 159e6211..69cf6163 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/MetadataBagTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/MetadataBagTest.php @@ -26,9 +26,6 @@ class MetadataBagTest extends TestCase */ protected $bag; - /** - * @var array - */ protected $array = array(); protected function setUp() diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/NativeSessionStorageTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/NativeSessionStorageTest.php index 818c63a9..8fb8b422 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/NativeSessionStorageTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/NativeSessionStorageTest.php @@ -14,7 +14,7 @@ namespace Symfony\Component\HttpFoundation\Tests\Session\Storage; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag; use Symfony\Component\HttpFoundation\Session\Flash\FlashBag; -use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler; +use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler; use Symfony\Component\HttpFoundation\Session\Storage\Handler\NullSessionHandler; use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage; use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy; @@ -54,8 +54,6 @@ class NativeSessionStorageTest extends TestCase } /** - * @param array $options - * * @return NativeSessionStorage */ protected function getStorage(array $options = array()) @@ -201,9 +199,9 @@ class NativeSessionStorageTest extends TestCase $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler()); $storage->setSaveHandler(null); $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler()); - $storage->setSaveHandler(new SessionHandlerProxy(new NativeSessionHandler())); + $storage->setSaveHandler(new SessionHandlerProxy(new NativeFileSessionHandler())); $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler()); - $storage->setSaveHandler(new NativeSessionHandler()); + $storage->setSaveHandler(new NativeFileSessionHandler()); $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler()); $storage->setSaveHandler(new SessionHandlerProxy(new NullSessionHandler())); $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler()); @@ -229,7 +227,7 @@ class NativeSessionStorageTest extends TestCase $this->assertFalse($storage->isStarted()); $key = $storage->getMetadataBag()->getStorageKey(); - $this->assertFalse(isset($_SESSION[$key])); + $this->assertArrayNotHasKey($key, $_SESSION); $storage->start(); } @@ -244,4 +242,36 @@ class NativeSessionStorageTest extends TestCase $this->assertSame($id, $storage->getId(), 'Same session ID after restarting'); $this->assertSame(7, $storage->getBag('attributes')->get('lucky'), 'Data still available'); } + + public function testCanCreateNativeSessionStorageWhenSessionAlreadyStarted() + { + session_start(); + $this->getStorage(); + + // Assert no exception has been thrown by `getStorage()` + $this->addToAssertionCount(1); + } + + public function testSetSessionOptionsOnceSessionStartedIsIgnored() + { + session_start(); + $this->getStorage(array( + 'name' => 'something-else', + )); + + // Assert no exception has been thrown by `getStorage()` + $this->addToAssertionCount(1); + } + + public function testGetBagsOnceSessionStartedIsIgnored() + { + session_start(); + $bag = new AttributeBag(); + $bag->setName('flashes'); + + $storage = $this->getStorage(); + $storage->registerBag($bag); + + $this->assertEquals($storage->getBag('flashes'), $bag); + } } diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php index b8b98386..958dc0bc 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php @@ -75,9 +75,9 @@ class PhpBridgeSessionStorageTest extends TestCase $this->assertFalse($storage->isStarted()); $key = $storage->getMetadataBag()->getStorageKey(); - $this->assertFalse(isset($_SESSION[$key])); + $this->assertArrayNotHasKey($key, $_SESSION); $storage->start(); - $this->assertTrue(isset($_SESSION[$key])); + $this->assertArrayHasKey($key, $_SESSION); } public function testClear() diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php index ef1da130..cbb291f1 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php @@ -13,39 +13,7 @@ namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Proxy; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy; - -// Note until PHPUnit_Mock_Objects 1.2 is released you cannot mock abstracts due to -// https://github.com/sebastianbergmann/phpunit-mock-objects/issues/73 -class ConcreteProxy extends AbstractProxy -{ -} - -class ConcreteSessionHandlerInterfaceProxy extends AbstractProxy implements \SessionHandlerInterface -{ - public function open($savePath, $sessionName) - { - } - - public function close() - { - } - - public function read($id) - { - } - - public function write($id, $data) - { - } - - public function destroy($id) - { - } - - public function gc($maxlifetime) - { - } -} +use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy; /** * Test class for AbstractProxy. @@ -61,7 +29,7 @@ class AbstractProxyTest extends TestCase protected function setUp() { - $this->proxy = new ConcreteProxy(); + $this->proxy = $this->getMockForAbstractClass(AbstractProxy::class); } protected function tearDown() @@ -77,7 +45,7 @@ class AbstractProxyTest extends TestCase public function testIsSessionHandlerInterface() { $this->assertFalse($this->proxy->isSessionHandlerInterface()); - $sh = new ConcreteSessionHandlerInterfaceProxy(); + $sh = new SessionHandlerProxy(new \SessionHandler()); $this->assertTrue($sh->isSessionHandlerInterface()); } diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/NativeProxyTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/NativeProxyTest.php index 8ec30534..ed4fee6b 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/NativeProxyTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/NativeProxyTest.php @@ -17,6 +17,8 @@ use Symfony\Component\HttpFoundation\Session\Storage\Proxy\NativeProxy; /** * Test class for NativeProxy. * + * @group legacy + * * @author Drak <drak@zikula.org> */ class NativeProxyTest extends TestCase diff --git a/vendor/symfony/http-foundation/Tests/StreamedResponseTest.php b/vendor/symfony/http-foundation/Tests/StreamedResponseTest.php index 1e35eb88..c2ded996 100644 --- a/vendor/symfony/http-foundation/Tests/StreamedResponseTest.php +++ b/vendor/symfony/http-foundation/Tests/StreamedResponseTest.php @@ -112,4 +112,15 @@ class StreamedResponseTest extends TestCase $this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response); $this->assertEquals(204, $response->getStatusCode()); } + + public function testReturnThis() + { + $response = new StreamedResponse(function () {}); + $this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response->sendContent()); + $this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response->sendContent()); + + $response = new StreamedResponse(function () {}); + $this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response->sendHeaders()); + $this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response->sendHeaders()); + } } diff --git a/vendor/symfony/http-foundation/composer.json b/vendor/symfony/http-foundation/composer.json index a964975e..f6c6f2e6 100644 --- a/vendor/symfony/http-foundation/composer.json +++ b/vendor/symfony/http-foundation/composer.json @@ -17,10 +17,11 @@ ], "require": { "php": "^5.5.9|>=7.0.8", - "symfony/polyfill-mbstring": "~1.1" + "symfony/polyfill-mbstring": "~1.1", + "symfony/polyfill-php70": "~1.6" }, "require-dev": { - "symfony/expression-language": "~2.8|~3.0" + "symfony/expression-language": "~2.8|~3.0|~4.0" }, "autoload": { "psr-4": { "Symfony\\Component\\HttpFoundation\\": "" }, @@ -31,7 +32,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } } } diff --git a/vendor/symfony/http-kernel/Bundle/Bundle.php b/vendor/symfony/http-kernel/Bundle/Bundle.php index 0b0ea088..cfa576c3 100644 --- a/vendor/symfony/http-kernel/Bundle/Bundle.php +++ b/vendor/symfony/http-kernel/Bundle/Bundle.php @@ -54,8 +54,6 @@ abstract class Bundle implements BundleInterface * * This method can be overridden to register compilation passes, * other extensions, ... - * - * @param ContainerBuilder $container A ContainerBuilder instance */ public function build(ContainerBuilder $container) { @@ -159,8 +157,6 @@ abstract class Bundle implements BundleInterface * * * Commands are in the 'Command' sub-directory * * Commands extend Symfony\Component\Console\Command\Command - * - * @param Application $application An Application instance */ public function registerCommands(Application $application) { @@ -191,6 +187,8 @@ abstract class Bundle implements BundleInterface } $r = new \ReflectionClass($class); if ($r->isSubclassOf('Symfony\\Component\\Console\\Command\\Command') && !$r->isAbstract() && !$r->getConstructor()->getNumberOfRequiredParameters()) { + @trigger_error(sprintf('Auto-registration of the command "%s" is deprecated since Symfony 3.4 and won\'t be supported in 4.0. Use PSR-4 based service discovery instead.', $class), E_USER_DEPRECATED); + $application->add($r->newInstance()); } } diff --git a/vendor/symfony/http-kernel/Bundle/BundleInterface.php b/vendor/symfony/http-kernel/Bundle/BundleInterface.php index 25eea1d7..14a7f6f4 100644 --- a/vendor/symfony/http-kernel/Bundle/BundleInterface.php +++ b/vendor/symfony/http-kernel/Bundle/BundleInterface.php @@ -36,8 +36,6 @@ interface BundleInterface extends ContainerAwareInterface * Builds the bundle. * * It is only ever called once when the cache is empty. - * - * @param ContainerBuilder $container A ContainerBuilder instance */ public function build(ContainerBuilder $container); @@ -56,6 +54,8 @@ interface BundleInterface extends ContainerAwareInterface * bundle. * * @return string The Bundle name it overrides or null if no parent + * + * @deprecated This method is deprecated as of 3.4 and will be removed in 4.0. */ public function getParent(); diff --git a/vendor/symfony/http-kernel/CHANGELOG.md b/vendor/symfony/http-kernel/CHANGELOG.md index 061f61d1..fb29f769 100644 --- a/vendor/symfony/http-kernel/CHANGELOG.md +++ b/vendor/symfony/http-kernel/CHANGELOG.md @@ -1,6 +1,23 @@ CHANGELOG ========= +3.4.0 +----- + + * added a minimalist PSR-3 `Logger` class that writes in `stderr` + * made kernels implementing `CompilerPassInterface` able to process the container + * deprecated bundle inheritance + * added `RebootableInterface` and implemented it in `Kernel` + * deprecated commands auto registration + * deprecated `EnvParametersResource` + * added `Symfony\Component\HttpKernel\Client::catchExceptions()` + * deprecated the `ChainCacheClearer::add()` method + * deprecated the `CacheaWarmerAggregate::add()` and `setWarmers()` methods + * made `CacheWarmerAggregate` and `ChainCacheClearer` classes final + * added the possibility to reset the profiler to its initial state + * deprecated data collectors without a `reset()` method + * deprecated implementing `DebugLoggerInterface` without a `clear()` method + 3.3.0 ----- diff --git a/vendor/symfony/http-kernel/CacheClearer/ChainCacheClearer.php b/vendor/symfony/http-kernel/CacheClearer/ChainCacheClearer.php index c749c7c0..8ee4275b 100644 --- a/vendor/symfony/http-kernel/CacheClearer/ChainCacheClearer.php +++ b/vendor/symfony/http-kernel/CacheClearer/ChainCacheClearer.php @@ -15,12 +15,11 @@ namespace Symfony\Component\HttpKernel\CacheClearer; * ChainCacheClearer. * * @author Dustin Dobervich <ddobervich@gmail.com> + * + * @final since version 3.4 */ class ChainCacheClearer implements CacheClearerInterface { - /** - * @var array - */ protected $clearers; /** @@ -28,7 +27,7 @@ class ChainCacheClearer implements CacheClearerInterface * * @param array $clearers The initial clearers */ - public function __construct(array $clearers = array()) + public function __construct($clearers = array()) { $this->clearers = $clearers; } @@ -46,10 +45,12 @@ class ChainCacheClearer implements CacheClearerInterface /** * Adds a cache clearer to the aggregate. * - * @param CacheClearerInterface $clearer + * @deprecated since version 3.4, to be removed in 4.0, inject the list of clearers as a constructor argument instead. */ public function add(CacheClearerInterface $clearer) { + @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0, inject the list of clearers as a constructor argument instead.', __METHOD__), E_USER_DEPRECATED); + $this->clearers[] = $clearer; } } diff --git a/vendor/symfony/http-kernel/CacheClearer/Psr6CacheClearer.php b/vendor/symfony/http-kernel/CacheClearer/Psr6CacheClearer.php index 2336b18a..d413d2c9 100644 --- a/vendor/symfony/http-kernel/CacheClearer/Psr6CacheClearer.php +++ b/vendor/symfony/http-kernel/CacheClearer/Psr6CacheClearer.php @@ -27,7 +27,7 @@ class Psr6CacheClearer implements CacheClearerInterface public function addPool(CacheItemPoolInterface $pool) { - @trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0. Pass an array of pools indexed by name to the constructor instead.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Pass an array of pools indexed by name to the constructor instead.', __METHOD__), E_USER_DEPRECATED); $this->pools[] = $pool; } diff --git a/vendor/symfony/http-kernel/CacheWarmer/CacheWarmerAggregate.php b/vendor/symfony/http-kernel/CacheWarmer/CacheWarmerAggregate.php index e5f4e4fa..ca3911ed 100644 --- a/vendor/symfony/http-kernel/CacheWarmer/CacheWarmerAggregate.php +++ b/vendor/symfony/http-kernel/CacheWarmer/CacheWarmerAggregate.php @@ -15,17 +15,21 @@ namespace Symfony\Component\HttpKernel\CacheWarmer; * Aggregates several cache warmers into a single one. * * @author Fabien Potencier <fabien@symfony.com> + * + * @final since version 3.4 */ class CacheWarmerAggregate implements CacheWarmerInterface { protected $warmers = array(); protected $optionalsEnabled = false; + private $triggerDeprecation = false; - public function __construct(array $warmers = array()) + public function __construct($warmers = array()) { foreach ($warmers as $warmer) { $this->add($warmer); } + $this->triggerDeprecation = true; } public function enableOptionalWarmers() @@ -59,16 +63,28 @@ class CacheWarmerAggregate implements CacheWarmerInterface return false; } + /** + * @deprecated since version 3.4, to be removed in 4.0, inject the list of clearers as a constructor argument instead. + */ public function setWarmers(array $warmers) { + @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0, inject the list of clearers as a constructor argument instead.', __METHOD__), E_USER_DEPRECATED); + $this->warmers = array(); foreach ($warmers as $warmer) { $this->add($warmer); } } + /** + * @deprecated since version 3.4, to be removed in 4.0, inject the list of clearers as a constructor argument instead. + */ public function add(CacheWarmerInterface $warmer) { + if ($this->triggerDeprecation) { + @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0, inject the list of clearers as a constructor argument instead.', __METHOD__), E_USER_DEPRECATED); + } + $this->warmers[] = $warmer; } } diff --git a/vendor/symfony/http-kernel/Client.php b/vendor/symfony/http-kernel/Client.php index c10b2434..7979722d 100644 --- a/vendor/symfony/http-kernel/Client.php +++ b/vendor/symfony/http-kernel/Client.php @@ -25,12 +25,13 @@ use Symfony\Component\HttpFoundation\Response; * * @author Fabien Potencier <fabien@symfony.com> * - * @method Request|null getRequest() A Request instance + * @method Request|null getRequest() A Request instance * @method Response|null getResponse() A Response instance */ class Client extends BaseClient { protected $kernel; + private $catchExceptions = true; /** * @param HttpKernelInterface $kernel An HttpKernel instance @@ -48,15 +49,23 @@ class Client extends BaseClient } /** - * Makes a request. + * Sets whether to catch exceptions when the kernel is handling a request. * - * @param Request $request A Request instance + * @param bool $catchExceptions Whether to catch exceptions + */ + public function catchExceptions($catchExceptions) + { + $this->catchExceptions = $catchExceptions; + } + + /** + * Makes a request. * * @return Response A Response instance */ protected function doRequest($request) { - $response = $this->kernel->handle($request); + $response = $this->kernel->handle($request, HttpKernelInterface::MASTER_REQUEST, $this->catchExceptions); if ($this->kernel instanceof TerminableInterface) { $this->kernel->terminate($request, $response); @@ -68,8 +77,6 @@ class Client extends BaseClient /** * Returns the script to execute when the request must be insulated. * - * @param Request $request A Request instance - * * @return string */ protected function getScript($request) @@ -123,8 +130,6 @@ EOF; /** * Converts the BrowserKit request to a HttpKernel request. * - * @param DomRequest $request A DomRequest instance - * * @return Request A Request instance */ protected function filterRequest(DomRequest $request) @@ -149,8 +154,6 @@ EOF; * * @see UploadedFile * - * @param array $files An array of files - * * @return array An array with all uploaded files marked as already moved */ protected function filterFiles(array $files) @@ -188,8 +191,6 @@ EOF; /** * Converts the HttpKernel response to a BrowserKit response. * - * @param Response $response A Response instance - * * @return DomResponse A DomResponse instance */ protected function filterResponse($response) diff --git a/vendor/symfony/http-kernel/Config/EnvParametersResource.php b/vendor/symfony/http-kernel/Config/EnvParametersResource.php index e7f48718..f8d2a72b 100644 --- a/vendor/symfony/http-kernel/Config/EnvParametersResource.php +++ b/vendor/symfony/http-kernel/Config/EnvParametersResource.php @@ -17,6 +17,8 @@ use Symfony\Component\Config\Resource\SelfCheckingResourceInterface; * EnvParametersResource represents resources stored in prefixed environment variables. * * @author Chris Wilkinson <chriswilkinson84@gmail.com> + * + * @deprecated since version 3.4, to be removed in 4.0 */ class EnvParametersResource implements SelfCheckingResourceInterface, \Serializable { diff --git a/vendor/symfony/http-kernel/Controller/ArgumentResolver/ServiceValueResolver.php b/vendor/symfony/http-kernel/Controller/ArgumentResolver/ServiceValueResolver.php index b1da6a9a..c55564c0 100644 --- a/vendor/symfony/http-kernel/Controller/ArgumentResolver/ServiceValueResolver.php +++ b/vendor/symfony/http-kernel/Controller/ArgumentResolver/ServiceValueResolver.php @@ -35,7 +35,13 @@ final class ServiceValueResolver implements ArgumentValueResolverInterface */ public function supports(Request $request, ArgumentMetadata $argument) { - return is_string($controller = $request->attributes->get('_controller')) && $this->container->has($controller) && $this->container->get($controller)->has($argument->getName()); + $controller = $request->attributes->get('_controller'); + + if (\is_array($controller) && \is_callable($controller, true) && \is_string($controller[0])) { + $controller = $controller[0].'::'.$controller[1]; + } + + return \is_string($controller) && $this->container->has($controller) && $this->container->get($controller)->has($argument->getName()); } /** @@ -43,6 +49,10 @@ final class ServiceValueResolver implements ArgumentValueResolverInterface */ public function resolve(Request $request, ArgumentMetadata $argument) { - yield $this->container->get($request->attributes->get('_controller'))->get($argument->getName()); + if (\is_array($controller = $request->attributes->get('_controller'))) { + $controller = $controller[0].'::'.$controller[1]; + } + + yield $this->container->get($controller)->get($argument->getName()); } } diff --git a/vendor/symfony/http-kernel/Controller/ContainerControllerResolver.php b/vendor/symfony/http-kernel/Controller/ContainerControllerResolver.php index fbcecad2..186583d7 100644 --- a/vendor/symfony/http-kernel/Controller/ContainerControllerResolver.php +++ b/vendor/symfony/http-kernel/Controller/ContainerControllerResolver.php @@ -13,6 +13,7 @@ namespace Symfony\Component\HttpKernel\Controller; use Psr\Container\ContainerInterface; use Psr\Log\LoggerInterface; +use Symfony\Component\DependencyInjection\Container; use Symfony\Component\HttpFoundation\Request; /** @@ -62,19 +63,28 @@ class ContainerControllerResolver extends ControllerResolver return parent::createController($controller); } + $method = null; if (1 == substr_count($controller, ':')) { // controller in the "service:method" notation - list($service, $method) = explode(':', $controller, 2); + list($controller, $method) = explode(':', $controller, 2); + } + + if (!$this->container->has($controller)) { + $this->throwExceptionIfControllerWasRemoved($controller); + + throw new \LogicException(sprintf('Controller not found: service "%s" does not exist.', $controller)); + } - return array($this->container->get($service), $method); + $service = $this->container->get($controller); + if (null !== $method) { + return array($service, $method); } - if ($this->container->has($controller) && method_exists($service = $this->container->get($controller), '__invoke')) { - // invokable controller in the "service" notation - return $service; + if (!method_exists($service, '__invoke')) { + throw new \LogicException(sprintf('Controller "%s" cannot be called without a method name. Did you forget an "__invoke" method?', $controller)); } - throw new \LogicException(sprintf('Unable to parse the controller name "%s".', $controller)); + return $service; } /** @@ -86,6 +96,26 @@ class ContainerControllerResolver extends ControllerResolver return $this->container->get($class); } - return parent::instantiateController($class); + try { + return parent::instantiateController($class); + } catch (\ArgumentCountError $e) { + } catch (\ErrorException $e) { + } catch (\TypeError $e) { + } + + $this->throwExceptionIfControllerWasRemoved($class, $e); + + throw $e; + } + + /** + * @param string $controller + * @param \Exception|\Throwable|null $previous + */ + private function throwExceptionIfControllerWasRemoved($controller, $previous = null) + { + if ($this->container instanceof Container && isset($this->container->getRemovedIds()[$controller])) { + throw new \LogicException(sprintf('Controller "%s" cannot be fetched from the container because it is private. Did you forget to tag the service with "controller.service_arguments"?', $controller), 0, $previous); + } } } diff --git a/vendor/symfony/http-kernel/Controller/ControllerResolver.php b/vendor/symfony/http-kernel/Controller/ControllerResolver.php index 7d93cc56..b9d9f9fa 100644 --- a/vendor/symfony/http-kernel/Controller/ControllerResolver.php +++ b/vendor/symfony/http-kernel/Controller/ControllerResolver.php @@ -41,9 +41,6 @@ class ControllerResolver implements ArgumentResolverInterface, ControllerResolve */ private $supportsScalarTypes; - /** - * @param LoggerInterface $logger A LoggerInterface instance - */ public function __construct(LoggerInterface $logger = null) { $this->logger = $logger; @@ -219,7 +216,7 @@ class ControllerResolver implements ArgumentResolverInterface, ControllerResolve } if (2 !== count($callable)) { - return sprintf('Invalid format for controller, expected array(controller, method) or controller::method.'); + return 'Invalid format for controller, expected array(controller, method) or controller::method.'; } list($controller, $method) = $callable; diff --git a/vendor/symfony/http-kernel/Controller/ControllerResolverInterface.php b/vendor/symfony/http-kernel/Controller/ControllerResolverInterface.php index 0dd7cce9..afe9fb73 100644 --- a/vendor/symfony/http-kernel/Controller/ControllerResolverInterface.php +++ b/vendor/symfony/http-kernel/Controller/ControllerResolverInterface.php @@ -34,8 +34,6 @@ interface ControllerResolverInterface * The resolver must only throw an exception when it should be able to load * controller but cannot because of some errors made by the developer. * - * @param Request $request A Request instance - * * @return callable|false A PHP callable representing the Controller, * or false if this resolver is not able to determine the controller * diff --git a/vendor/symfony/http-kernel/Controller/TraceableControllerResolver.php b/vendor/symfony/http-kernel/Controller/TraceableControllerResolver.php index e7471b45..75010771 100644 --- a/vendor/symfony/http-kernel/Controller/TraceableControllerResolver.php +++ b/vendor/symfony/http-kernel/Controller/TraceableControllerResolver.php @@ -23,11 +23,6 @@ class TraceableControllerResolver implements ControllerResolverInterface, Argume private $stopwatch; private $argumentResolver; - /** - * @param ControllerResolverInterface $resolver A ControllerResolverInterface instance - * @param Stopwatch $stopwatch A Stopwatch instance - * @param ArgumentResolverInterface $argumentResolver Only required for BC - */ public function __construct(ControllerResolverInterface $resolver, Stopwatch $stopwatch, ArgumentResolverInterface $argumentResolver = null) { $this->resolver = $resolver; diff --git a/vendor/symfony/http-kernel/DataCollector/AjaxDataCollector.php b/vendor/symfony/http-kernel/DataCollector/AjaxDataCollector.php index b8405d59..370a874f 100644 --- a/vendor/symfony/http-kernel/DataCollector/AjaxDataCollector.php +++ b/vendor/symfony/http-kernel/DataCollector/AjaxDataCollector.php @@ -26,6 +26,11 @@ class AjaxDataCollector extends DataCollector // all collecting is done client side } + public function reset() + { + // all collecting is done client side + } + public function getName() { return 'ajax'; diff --git a/vendor/symfony/http-kernel/DataCollector/ConfigDataCollector.php b/vendor/symfony/http-kernel/DataCollector/ConfigDataCollector.php index 96534219..5675f073 100644 --- a/vendor/symfony/http-kernel/DataCollector/ConfigDataCollector.php +++ b/vendor/symfony/http-kernel/DataCollector/ConfigDataCollector.php @@ -43,8 +43,6 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte /** * Sets the Kernel associated with this Request. - * - * @param KernelInterface $kernel A KernelInterface instance */ public function setKernel(KernelInterface $kernel = null) { @@ -95,6 +93,14 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte } } + /** + * {@inheritdoc} + */ + public function reset() + { + $this->data = array(); + } + public function lateCollect() { $this->data = $this->cloneVar($this->data); diff --git a/vendor/symfony/http-kernel/DataCollector/DataCollector.php b/vendor/symfony/http-kernel/DataCollector/DataCollector.php index 845c2c13..30887ab9 100644 --- a/vendor/symfony/http-kernel/DataCollector/DataCollector.php +++ b/vendor/symfony/http-kernel/DataCollector/DataCollector.php @@ -71,7 +71,7 @@ abstract class DataCollector implements DataCollectorInterface, \Serializable $this->cloner->setMaxItems(-1); $this->cloner->addCasters($this->getCasters()); } else { - @trigger_error(sprintf('Using the %s() method without the VarDumper component is deprecated since version 3.2 and won\'t be supported in 4.0. Install symfony/var-dumper version 3.2 or above.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('Using the %s() method without the VarDumper component is deprecated since Symfony 3.2 and won\'t be supported in 4.0. Install symfony/var-dumper version 3.2 or above.', __METHOD__), E_USER_DEPRECATED); $this->cloner = false; } } @@ -97,7 +97,7 @@ abstract class DataCollector implements DataCollectorInterface, \Serializable */ protected function varToString($var) { - @trigger_error(sprintf('The %s() method is deprecated since version 3.2 and will be removed in 4.0. Use cloneVar() instead.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.2 and will be removed in 4.0. Use cloneVar() instead.', __METHOD__), E_USER_DEPRECATED); if (null === $this->valueExporter) { $this->valueExporter = new ValueExporter(); diff --git a/vendor/symfony/http-kernel/DataCollector/DataCollectorInterface.php b/vendor/symfony/http-kernel/DataCollector/DataCollectorInterface.php index 2820ad5b..2470089b 100644 --- a/vendor/symfony/http-kernel/DataCollector/DataCollectorInterface.php +++ b/vendor/symfony/http-kernel/DataCollector/DataCollectorInterface.php @@ -18,15 +18,13 @@ use Symfony\Component\HttpFoundation\Response; * DataCollectorInterface. * * @author Fabien Potencier <fabien@symfony.com> + * + * @method reset() Resets this data collector to its initial state. */ interface DataCollectorInterface { /** * Collects data for the given Request and Response. - * - * @param Request $request A Request instance - * @param Response $response A Response instance - * @param \Exception $exception An Exception instance */ public function collect(Request $request, Response $response, \Exception $exception = null); diff --git a/vendor/symfony/http-kernel/DataCollector/DumpDataCollector.php b/vendor/symfony/http-kernel/DataCollector/DumpDataCollector.php index b50386cb..d0ca671e 100644 --- a/vendor/symfony/http-kernel/DataCollector/DumpDataCollector.php +++ b/vendor/symfony/http-kernel/DataCollector/DumpDataCollector.php @@ -164,6 +164,18 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface } } + public function reset() + { + if ($this->stopwatch) { + $this->stopwatch->reset(); + } + $this->data = array(); + $this->dataCount = 0; + $this->isCollected = false; + $this->clonesCount = 0; + $this->clonesIndex = 0; + } + public function serialize() { if ($this->clonesCount !== $this->clonesIndex) { diff --git a/vendor/symfony/http-kernel/DataCollector/EventDataCollector.php b/vendor/symfony/http-kernel/DataCollector/EventDataCollector.php index 3d75f322..0a095ab6 100644 --- a/vendor/symfony/http-kernel/DataCollector/EventDataCollector.php +++ b/vendor/symfony/http-kernel/DataCollector/EventDataCollector.php @@ -27,6 +27,9 @@ class EventDataCollector extends DataCollector implements LateDataCollectorInter public function __construct(EventDispatcherInterface $dispatcher = null) { + if ($dispatcher instanceof TraceableEventDispatcherInterface && !method_exists($dispatcher, 'reset')) { + @trigger_error(sprintf('Implementing "%s" without the "reset()" method is deprecated since Symfony 3.4 and will be unsupported in 4.0 for class "%s".', TraceableEventDispatcherInterface::class, \get_class($dispatcher)), E_USER_DEPRECATED); + } $this->dispatcher = $dispatcher; } @@ -41,6 +44,19 @@ class EventDataCollector extends DataCollector implements LateDataCollectorInter ); } + public function reset() + { + $this->data = array(); + + if ($this->dispatcher instanceof TraceableEventDispatcherInterface) { + if (!method_exists($this->dispatcher, 'reset')) { + return; // @deprecated + } + + $this->dispatcher->reset(); + } + } + public function lateCollect() { if ($this->dispatcher instanceof TraceableEventDispatcherInterface) { diff --git a/vendor/symfony/http-kernel/DataCollector/ExceptionDataCollector.php b/vendor/symfony/http-kernel/DataCollector/ExceptionDataCollector.php index 9fe82644..7a25f149 100644 --- a/vendor/symfony/http-kernel/DataCollector/ExceptionDataCollector.php +++ b/vendor/symfony/http-kernel/DataCollector/ExceptionDataCollector.php @@ -34,6 +34,14 @@ class ExceptionDataCollector extends DataCollector } } + /** + * {@inheritdoc} + */ + public function reset() + { + $this->data = array(); + } + /** * Checks if the exception is not null. * diff --git a/vendor/symfony/http-kernel/DataCollector/LoggerDataCollector.php b/vendor/symfony/http-kernel/DataCollector/LoggerDataCollector.php index 92fd0da7..03bfa5d8 100644 --- a/vendor/symfony/http-kernel/DataCollector/LoggerDataCollector.php +++ b/vendor/symfony/http-kernel/DataCollector/LoggerDataCollector.php @@ -29,6 +29,10 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte public function __construct($logger = null, $containerPathPrefix = null) { if (null !== $logger && $logger instanceof DebugLoggerInterface) { + if (!method_exists($logger, 'clear')) { + @trigger_error(sprintf('Implementing "%s" without the "clear()" method is deprecated since Symfony 3.4 and will be unsupported in 4.0 for class "%s".', DebugLoggerInterface::class, \get_class($logger)), E_USER_DEPRECATED); + } + $this->logger = $logger; } @@ -43,6 +47,17 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte // everything is done as late as possible } + /** + * {@inheritdoc} + */ + public function reset() + { + if ($this->logger && method_exists($this->logger, 'clear')) { + $this->logger->clear(); + } + $this->data = array(); + } + /** * {@inheritdoc} */ @@ -149,6 +164,7 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte private function sanitizeLogs($logs) { $sanitizedLogs = array(); + $silencedLogs = array(); foreach ($logs as $log) { if (!$this->isSilencedOrDeprecationErrorLog($log)) { diff --git a/vendor/symfony/http-kernel/DataCollector/MemoryDataCollector.php b/vendor/symfony/http-kernel/DataCollector/MemoryDataCollector.php index b7f61f46..8d8cc1a0 100644 --- a/vendor/symfony/http-kernel/DataCollector/MemoryDataCollector.php +++ b/vendor/symfony/http-kernel/DataCollector/MemoryDataCollector.php @@ -23,10 +23,7 @@ class MemoryDataCollector extends DataCollector implements LateDataCollectorInte { public function __construct() { - $this->data = array( - 'memory' => 0, - 'memory_limit' => $this->convertToBytes(ini_get('memory_limit')), - ); + $this->reset(); } /** @@ -37,6 +34,17 @@ class MemoryDataCollector extends DataCollector implements LateDataCollectorInte $this->updateMemoryUsage(); } + /** + * {@inheritdoc} + */ + public function reset() + { + $this->data = array( + 'memory' => 0, + 'memory_limit' => $this->convertToBytes(ini_get('memory_limit')), + ); + } + /** * {@inheritdoc} */ diff --git a/vendor/symfony/http-kernel/DataCollector/RequestDataCollector.php b/vendor/symfony/http-kernel/DataCollector/RequestDataCollector.php index 7049844f..54d17d28 100644 --- a/vendor/symfony/http-kernel/DataCollector/RequestDataCollector.php +++ b/vendor/symfony/http-kernel/DataCollector/RequestDataCollector.php @@ -11,6 +11,7 @@ namespace Symfony\Component\HttpKernel\DataCollector; +use Symfony\Component\HttpFoundation\Cookie; use Symfony\Component\HttpFoundation\ParameterBag; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -20,13 +21,10 @@ use Symfony\Component\HttpKernel\Event\FilterControllerEvent; use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** - * RequestDataCollector. - * * @author Fabien Potencier <fabien@symfony.com> */ class RequestDataCollector extends DataCollector implements EventSubscriberInterface, LateDataCollectorInterface { - /** @var \SplObjectStorage */ protected $controllers; public function __construct() @@ -131,21 +129,24 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter unset($this->controllers[$request]); } - if (null !== $session && $session->isStarted()) { - if ($request->attributes->has('_redirected')) { - $this->data['redirect'] = $session->remove('sf_redirect'); - } + if ($request->attributes->has('_redirected') && $redirectCookie = $request->cookies->get('sf_redirect')) { + $this->data['redirect'] = json_decode($redirectCookie, true); - if ($response->isRedirect()) { - $session->set('sf_redirect', array( + $response->headers->clearCookie('sf_redirect'); + } + + if ($response->isRedirect()) { + $response->headers->setCookie(new Cookie( + 'sf_redirect', + json_encode(array( 'token' => $response->headers->get('x-debug-token'), 'route' => $request->attributes->get('_route', 'n/a'), 'method' => $request->getMethod(), 'controller' => $this->parseController($request->attributes->get('_controller')), 'status_code' => $statusCode, 'status_text' => Response::$statusTexts[(int) $statusCode], - )); - } + )) + )); } $this->data['identifier'] = $this->data['route'] ?: (is_array($this->data['controller']) ? $this->data['controller']['class'].'::'.$this->data['controller']['method'].'()' : $this->data['controller']); @@ -156,6 +157,12 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter $this->data = $this->cloneVar($this->data); } + public function reset() + { + $this->data = array(); + $this->controllers = new \SplObjectStorage(); + } + public function getMethod() { return $this->data['method']; @@ -309,11 +316,11 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter public function onKernelResponse(FilterResponseEvent $event) { - if (!$event->isMasterRequest() || !$event->getRequest()->hasSession() || !$event->getRequest()->getSession()->isStarted()) { + if (!$event->isMasterRequest()) { return; } - if ($event->getRequest()->getSession()->has('sf_redirect')) { + if ($event->getRequest()->cookies->has('sf_redirect')) { $event->getRequest()->attributes->set('_redirected', true); } } diff --git a/vendor/symfony/http-kernel/DataCollector/RouterDataCollector.php b/vendor/symfony/http-kernel/DataCollector/RouterDataCollector.php index 76d96234..afd34f8a 100644 --- a/vendor/symfony/http-kernel/DataCollector/RouterDataCollector.php +++ b/vendor/symfony/http-kernel/DataCollector/RouterDataCollector.php @@ -23,17 +23,14 @@ use Symfony\Component\HttpKernel\Event\FilterControllerEvent; */ class RouterDataCollector extends DataCollector { + /** + * @var \SplObjectStorage + */ protected $controllers; public function __construct() { - $this->controllers = new \SplObjectStorage(); - - $this->data = array( - 'redirect' => false, - 'url' => null, - 'route' => null, - ); + $this->reset(); } /** @@ -53,6 +50,17 @@ class RouterDataCollector extends DataCollector unset($this->controllers[$request]); } + public function reset() + { + $this->controllers = new \SplObjectStorage(); + + $this->data = array( + 'redirect' => false, + 'url' => null, + 'route' => null, + ); + } + protected function guessRoute(Request $request, $controller) { return 'n/a'; @@ -60,8 +68,6 @@ class RouterDataCollector extends DataCollector /** * Remembers the controller associated to each request. - * - * @param FilterControllerEvent $event The filter controller event */ public function onKernelController(FilterControllerEvent $event) { diff --git a/vendor/symfony/http-kernel/DataCollector/TimeDataCollector.php b/vendor/symfony/http-kernel/DataCollector/TimeDataCollector.php index 2d39156e..e489d775 100644 --- a/vendor/symfony/http-kernel/DataCollector/TimeDataCollector.php +++ b/vendor/symfony/http-kernel/DataCollector/TimeDataCollector.php @@ -14,6 +14,7 @@ namespace Symfony\Component\HttpKernel\DataCollector; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\KernelInterface; +use Symfony\Component\Stopwatch\Stopwatch; /** * TimeDataCollector. @@ -25,7 +26,7 @@ class TimeDataCollector extends DataCollector implements LateDataCollectorInterf protected $kernel; protected $stopwatch; - public function __construct(KernelInterface $kernel = null, $stopwatch = null) + public function __construct(KernelInterface $kernel = null, Stopwatch $stopwatch = null) { $this->kernel = $kernel; $this->stopwatch = $stopwatch; @@ -49,6 +50,18 @@ class TimeDataCollector extends DataCollector implements LateDataCollectorInterf ); } + /** + * {@inheritdoc} + */ + public function reset() + { + $this->data = array(); + + if (null !== $this->stopwatch) { + $this->stopwatch->reset(); + } + } + /** * {@inheritdoc} */ diff --git a/vendor/symfony/http-kernel/DataCollector/Util/ValueExporter.php b/vendor/symfony/http-kernel/DataCollector/Util/ValueExporter.php index f1e48311..a71c00db 100644 --- a/vendor/symfony/http-kernel/DataCollector/Util/ValueExporter.php +++ b/vendor/symfony/http-kernel/DataCollector/Util/ValueExporter.php @@ -11,7 +11,7 @@ namespace Symfony\Component\HttpKernel\DataCollector\Util; -@trigger_error('The '.__NAMESPACE__.'\ValueExporter class is deprecated since version 3.2 and will be removed in 4.0. Use the VarDumper component instead.', E_USER_DEPRECATED); +@trigger_error('The '.__NAMESPACE__.'\ValueExporter class is deprecated since Symfony 3.2 and will be removed in 4.0. Use the VarDumper component instead.', E_USER_DEPRECATED); /** * @author Bernhard Schussek <bschussek@gmail.com> @@ -24,8 +24,8 @@ class ValueExporter * Converts a PHP value to a string. * * @param mixed $value The PHP value - * @param int $depth only for internal usage - * @param bool $deep only for internal usage + * @param int $depth Only for internal usage + * @param bool $deep Only for internal usage * * @return string The string representation of the given value */ diff --git a/vendor/symfony/http-kernel/DependencyInjection/AddClassesToCachePass.php b/vendor/symfony/http-kernel/DependencyInjection/AddClassesToCachePass.php index 4ffa1751..8ae78e0d 100644 --- a/vendor/symfony/http-kernel/DependencyInjection/AddClassesToCachePass.php +++ b/vendor/symfony/http-kernel/DependencyInjection/AddClassesToCachePass.php @@ -11,7 +11,7 @@ namespace Symfony\Component\HttpKernel\DependencyInjection; -@trigger_error('The '.__NAMESPACE__.'\AddClassesToCachePass class is deprecated since version 3.3 and will be removed in 4.0.', E_USER_DEPRECATED); +@trigger_error('The '.__NAMESPACE__.'\AddClassesToCachePass class is deprecated since Symfony 3.3 and will be removed in 4.0.', E_USER_DEPRECATED); /** * Sets the classes to compile in the cache for the container. diff --git a/vendor/symfony/http-kernel/DependencyInjection/ConfigurableExtension.php b/vendor/symfony/http-kernel/DependencyInjection/ConfigurableExtension.php index c7eca306..072c35f1 100644 --- a/vendor/symfony/http-kernel/DependencyInjection/ConfigurableExtension.php +++ b/vendor/symfony/http-kernel/DependencyInjection/ConfigurableExtension.php @@ -37,9 +37,6 @@ abstract class ConfigurableExtension extends Extension /** * Configures the passed container according to the merged configuration. - * - * @param array $mergedConfig - * @param ContainerBuilder $container */ abstract protected function loadInternal(array $mergedConfig, ContainerBuilder $container); } diff --git a/vendor/symfony/http-kernel/DependencyInjection/Extension.php b/vendor/symfony/http-kernel/DependencyInjection/Extension.php index f6449f4e..a382c15d 100644 --- a/vendor/symfony/http-kernel/DependencyInjection/Extension.php +++ b/vendor/symfony/http-kernel/DependencyInjection/Extension.php @@ -33,7 +33,7 @@ abstract class Extension extends BaseExtension public function getClassesToCompile() { if (\PHP_VERSION_ID >= 70000) { - @trigger_error(__METHOD__.'() is deprecated since version 3.3, to be removed in 4.0.', E_USER_DEPRECATED); + @trigger_error(__METHOD__.'() is deprecated since Symfony 3.3, to be removed in 4.0.', E_USER_DEPRECATED); } return $this->classes; @@ -59,7 +59,7 @@ abstract class Extension extends BaseExtension public function addClassesToCompile(array $classes) { if (\PHP_VERSION_ID >= 70000) { - @trigger_error(__METHOD__.'() is deprecated since version 3.3, to be removed in 4.0.', E_USER_DEPRECATED); + @trigger_error(__METHOD__.'() is deprecated since Symfony 3.3, to be removed in 4.0.', E_USER_DEPRECATED); } $this->classes = array_merge($this->classes, $classes); diff --git a/vendor/symfony/http-kernel/DependencyInjection/LazyLoadingFragmentHandler.php b/vendor/symfony/http-kernel/DependencyInjection/LazyLoadingFragmentHandler.php index 314217ac..00b05959 100644 --- a/vendor/symfony/http-kernel/DependencyInjection/LazyLoadingFragmentHandler.php +++ b/vendor/symfony/http-kernel/DependencyInjection/LazyLoadingFragmentHandler.php @@ -51,7 +51,7 @@ class LazyLoadingFragmentHandler extends FragmentHandler */ public function addRendererService($name, $renderer) { - @trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED); $this->rendererIds[$name] = $renderer; } diff --git a/vendor/symfony/http-kernel/DependencyInjection/LoggerPass.php b/vendor/symfony/http-kernel/DependencyInjection/LoggerPass.php new file mode 100644 index 00000000..2ad7f322 --- /dev/null +++ b/vendor/symfony/http-kernel/DependencyInjection/LoggerPass.php @@ -0,0 +1,41 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpKernel\DependencyInjection; + +use Psr\Log\LoggerInterface; +use Symfony\Component\HttpKernel\Log\Logger; +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; + +/** + * Registers the default logger if necessary. + * + * @author Kévin Dunglas <dunglas@gmail.com> + */ +class LoggerPass implements CompilerPassInterface +{ + /** + * {@inheritdoc} + */ + public function process(ContainerBuilder $container) + { + $container->setAlias(LoggerInterface::class, 'logger') + ->setPublic(false); + + if ($container->has('logger')) { + return; + } + + $container->register('logger', Logger::class) + ->setPublic(false); + } +} diff --git a/vendor/symfony/http-kernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php b/vendor/symfony/http-kernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php index 9c00f99b..985dfb71 100644 --- a/vendor/symfony/http-kernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php +++ b/vendor/symfony/http-kernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php @@ -53,11 +53,13 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface $def->setPublic(true); $class = $def->getClass(); $autowire = $def->isAutowired(); + $bindings = $def->getBindings(); // resolve service class, taking parent definitions into account - while (!$class && $def instanceof ChildDefinition) { + while ($def instanceof ChildDefinition) { $def = $container->findDefinition($def->getParent()); - $class = $def->getClass(); + $class = $class ?: $def->getClass(); + $bindings = $def->getBindings(); } $class = $parameterBag->resolveValue($class); @@ -129,6 +131,19 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface } elseif ($p->allowsNull() && !$p->isOptional()) { $invalidBehavior = ContainerInterface::NULL_ON_INVALID_REFERENCE; } + } elseif (isset($bindings[$bindingName = '$'.$p->name]) || isset($bindings[$bindingName = $type])) { + $binding = $bindings[$bindingName]; + + list($bindingValue, $bindingId) = $binding->getValues(); + + if (!$bindingValue instanceof Reference) { + continue; + } + + $binding->setValues(array($bindingValue, $bindingId, true)); + $args[$p->name] = $bindingValue; + + continue; } elseif (!$type || !$autowire) { continue; } diff --git a/vendor/symfony/http-kernel/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPass.php b/vendor/symfony/http-kernel/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPass.php index 440b0d00..ab50cec3 100644 --- a/vendor/symfony/http-kernel/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPass.php +++ b/vendor/symfony/http-kernel/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPass.php @@ -50,7 +50,7 @@ class RemoveEmptyControllerArgumentLocatorsPass implements CompilerPassInterface $action = substr(strrchr($controller, ':'), 1); $id = substr($controller, 0, -1 - strlen($action)); $controllerDef = $container->getDefinition($id); - foreach ($controllerDef->getMethodCalls() as list($method, $args)) { + foreach ($controllerDef->getMethodCalls() as list($method)) { if (0 === strcasecmp($action, $method)) { $reason = sprintf('Removing method "%s" of service "%s" from controller candidates: the method is called at instantiation, thus cannot be an action.', $action, $id); break; diff --git a/vendor/symfony/http-kernel/DependencyInjection/ResettableServicePass.php b/vendor/symfony/http-kernel/DependencyInjection/ResettableServicePass.php new file mode 100644 index 00000000..29433a6d --- /dev/null +++ b/vendor/symfony/http-kernel/DependencyInjection/ResettableServicePass.php @@ -0,0 +1,66 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpKernel\DependencyInjection; + +use Symfony\Component\DependencyInjection\Argument\IteratorArgument; +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\DependencyInjection\Exception\RuntimeException; +use Symfony\Component\DependencyInjection\Reference; + +/** + * @author Alexander M. Turek <me@derrabus.de> + */ +class ResettableServicePass implements CompilerPassInterface +{ + private $tagName; + + public function __construct($tagName = 'kernel.reset') + { + $this->tagName = $tagName; + } + + /** + * {@inheritdoc} + */ + public function process(ContainerBuilder $container) + { + if (!$container->has('services_resetter')) { + return; + } + + $services = $methods = array(); + + foreach ($container->findTaggedServiceIds($this->tagName, true) as $id => $tags) { + $services[$id] = new Reference($id, ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE); + $attributes = $tags[0]; + + if (!isset($attributes['method'])) { + throw new RuntimeException(sprintf('Tag %s requires the "method" attribute to be set.', $this->tagName)); + } + + $methods[$id] = $attributes['method']; + } + + if (empty($services)) { + $container->removeAlias('services_resetter'); + $container->removeDefinition('services_resetter'); + + return; + } + + $container->findDefinition('services_resetter') + ->setArgument(0, new IteratorArgument($services)) + ->setArgument(1, $methods); + } +} diff --git a/vendor/symfony/http-kernel/DependencyInjection/ServicesResetter.php b/vendor/symfony/http-kernel/DependencyInjection/ServicesResetter.php new file mode 100644 index 00000000..b82d2fef --- /dev/null +++ b/vendor/symfony/http-kernel/DependencyInjection/ServicesResetter.php @@ -0,0 +1,39 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpKernel\DependencyInjection; + +/** + * Resets provided services. + * + * @author Alexander M. Turek <me@derrabus.de> + * @author Nicolas Grekas <p@tchwork.com> + * + * @internal + */ +class ServicesResetter +{ + private $resettableServices; + private $resetMethods; + + public function __construct(\Traversable $resettableServices, array $resetMethods) + { + $this->resettableServices = $resettableServices; + $this->resetMethods = $resetMethods; + } + + public function reset() + { + foreach ($this->resettableServices as $id => $service) { + $service->{$this->resetMethods[$id]}(); + } + } +} diff --git a/vendor/symfony/http-kernel/Event/FilterControllerArgumentsEvent.php b/vendor/symfony/http-kernel/Event/FilterControllerArgumentsEvent.php index 1dc784ed..2b08f2d7 100644 --- a/vendor/symfony/http-kernel/Event/FilterControllerArgumentsEvent.php +++ b/vendor/symfony/http-kernel/Event/FilterControllerArgumentsEvent.php @@ -45,9 +45,6 @@ class FilterControllerArgumentsEvent extends FilterControllerEvent return $this->arguments; } - /** - * @param array $arguments - */ public function setArguments(array $arguments) { $this->arguments = $arguments; diff --git a/vendor/symfony/http-kernel/Event/FilterControllerEvent.php b/vendor/symfony/http-kernel/Event/FilterControllerEvent.php index e0d46aa4..84cbc2ea 100644 --- a/vendor/symfony/http-kernel/Event/FilterControllerEvent.php +++ b/vendor/symfony/http-kernel/Event/FilterControllerEvent.php @@ -27,9 +27,6 @@ use Symfony\Component\HttpFoundation\Request; */ class FilterControllerEvent extends KernelEvent { - /** - * The current controller. - */ private $controller; public function __construct(HttpKernelInterface $kernel, callable $controller, Request $request, $requestType) @@ -49,11 +46,6 @@ class FilterControllerEvent extends KernelEvent return $this->controller; } - /** - * Sets a new controller. - * - * @param callable $controller - */ public function setController(callable $controller) { $this->controller = $controller; diff --git a/vendor/symfony/http-kernel/Event/FilterResponseEvent.php b/vendor/symfony/http-kernel/Event/FilterResponseEvent.php index ed816a9d..53a7efce 100644 --- a/vendor/symfony/http-kernel/Event/FilterResponseEvent.php +++ b/vendor/symfony/http-kernel/Event/FilterResponseEvent.php @@ -26,11 +26,6 @@ use Symfony\Component\HttpFoundation\Response; */ class FilterResponseEvent extends KernelEvent { - /** - * The current response object. - * - * @var Response - */ private $response; public function __construct(HttpKernelInterface $kernel, Request $request, $requestType, Response $response) @@ -52,8 +47,6 @@ class FilterResponseEvent extends KernelEvent /** * Sets a new response object. - * - * @param Response $response */ public function setResponse(Response $response) { diff --git a/vendor/symfony/http-kernel/Event/GetResponseEvent.php b/vendor/symfony/http-kernel/Event/GetResponseEvent.php index 4c96a4b7..f7745ea3 100644 --- a/vendor/symfony/http-kernel/Event/GetResponseEvent.php +++ b/vendor/symfony/http-kernel/Event/GetResponseEvent.php @@ -24,11 +24,6 @@ use Symfony\Component\HttpFoundation\Response; */ class GetResponseEvent extends KernelEvent { - /** - * The response object. - * - * @var Response - */ private $response; /** @@ -43,8 +38,6 @@ class GetResponseEvent extends KernelEvent /** * Sets a response and stops event propagation. - * - * @param Response $response */ public function setResponse(Response $response) { diff --git a/vendor/symfony/http-kernel/Event/KernelEvent.php b/vendor/symfony/http-kernel/Event/KernelEvent.php index 2043a017..992f6b4d 100644 --- a/vendor/symfony/http-kernel/Event/KernelEvent.php +++ b/vendor/symfony/http-kernel/Event/KernelEvent.php @@ -22,28 +22,16 @@ use Symfony\Component\EventDispatcher\Event; */ class KernelEvent extends Event { - /** - * The kernel in which this event was thrown. - * - * @var HttpKernelInterface - */ private $kernel; - - /** - * The request the kernel is currently processing. - * - * @var Request - */ private $request; + private $requestType; /** - * The request type the kernel is currently processing. One of - * HttpKernelInterface::MASTER_REQUEST and HttpKernelInterface::SUB_REQUEST. - * - * @var int + * @param HttpKernelInterface $kernel The kernel in which this event was thrown + * @param Request $request The request the kernel is currently processing + * @param int $requestType The request type the kernel is currently processing; one of + * HttpKernelInterface::MASTER_REQUEST or HttpKernelInterface::SUB_REQUEST */ - private $requestType; - public function __construct(HttpKernelInterface $kernel, Request $request, $requestType) { $this->kernel = $kernel; diff --git a/vendor/symfony/http-kernel/EventListener/AbstractSessionListener.php b/vendor/symfony/http-kernel/EventListener/AbstractSessionListener.php index 7a6c2073..dff29ee8 100644 --- a/vendor/symfony/http-kernel/EventListener/AbstractSessionListener.php +++ b/vendor/symfony/http-kernel/EventListener/AbstractSessionListener.php @@ -11,7 +11,9 @@ namespace Symfony\Component\HttpKernel\EventListener; +use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Component\HttpFoundation\Session\SessionInterface; +use Symfony\Component\HttpKernel\Event\FilterResponseEvent; use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\EventDispatcher\EventSubscriberInterface; @@ -38,10 +40,30 @@ abstract class AbstractSessionListener implements EventSubscriberInterface $request->setSession($session); } + public function onKernelResponse(FilterResponseEvent $event) + { + if (!$event->isMasterRequest()) { + return; + } + + if (!$session = $event->getRequest()->getSession()) { + return; + } + + if ($session->isStarted() || ($session instanceof Session && $session->hasBeenStarted())) { + $event->getResponse() + ->setPrivate() + ->setMaxAge(0) + ->headers->addCacheControlDirective('must-revalidate'); + } + } + public static function getSubscribedEvents() { return array( KernelEvents::REQUEST => array('onKernelRequest', 128), + // low priority to come after regular response listeners, same as SaveSessionListener + KernelEvents::RESPONSE => array('onKernelResponse', -1000), ); } diff --git a/vendor/symfony/http-kernel/EventListener/AbstractTestSessionListener.php b/vendor/symfony/http-kernel/EventListener/AbstractTestSessionListener.php index eb6e66c0..5f0ea5c0 100644 --- a/vendor/symfony/http-kernel/EventListener/AbstractTestSessionListener.php +++ b/vendor/symfony/http-kernel/EventListener/AbstractTestSessionListener.php @@ -12,6 +12,7 @@ namespace Symfony\Component\HttpKernel\EventListener; use Symfony\Component\HttpFoundation\Cookie; +use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\Event\FilterResponseEvent; @@ -50,8 +51,6 @@ abstract class AbstractTestSessionListener implements EventSubscriberInterface /** * Checks if session was initialized and saves if current request is master * Runs on 'kernel.response' in test environment. - * - * @param FilterResponseEvent $event */ public function onKernelResponse(FilterResponseEvent $event) { @@ -59,9 +58,15 @@ abstract class AbstractTestSessionListener implements EventSubscriberInterface return; } - $session = $event->getRequest()->getSession(); - if ($session && $session->isStarted()) { + if (!$session = $event->getRequest()->getSession()) { + return; + } + + if ($wasStarted = $session->isStarted()) { $session->save(); + } + + if ($session instanceof Session ? !$session->isEmpty() : $wasStarted) { $params = session_get_cookie_params(); $event->getResponse()->headers->setCookie(new Cookie($session->getName(), $session->getId(), 0 === $params['lifetime'] ? 0 : time() + $params['lifetime'], $params['path'], $params['domain'], $params['secure'], $params['httponly'])); } diff --git a/vendor/symfony/http-kernel/EventListener/AddRequestFormatsListener.php b/vendor/symfony/http-kernel/EventListener/AddRequestFormatsListener.php index 280844c1..f21fc6ab 100644 --- a/vendor/symfony/http-kernel/EventListener/AddRequestFormatsListener.php +++ b/vendor/symfony/http-kernel/EventListener/AddRequestFormatsListener.php @@ -22,14 +22,8 @@ use Symfony\Component\HttpKernel\Event\GetResponseEvent; */ class AddRequestFormatsListener implements EventSubscriberInterface { - /** - * @var array - */ protected $formats; - /** - * @param array $formats - */ public function __construct(array $formats) { $this->formats = $formats; @@ -37,13 +31,12 @@ class AddRequestFormatsListener implements EventSubscriberInterface /** * Adds request formats. - * - * @param GetResponseEvent $event */ public function onKernelRequest(GetResponseEvent $event) { + $request = $event->getRequest(); foreach ($this->formats as $format => $mimeTypes) { - $event->getRequest()->setFormat($format, $mimeTypes); + $request->setFormat($format, $mimeTypes); } } diff --git a/vendor/symfony/http-kernel/EventListener/DebugHandlersListener.php b/vendor/symfony/http-kernel/EventListener/DebugHandlersListener.php index 29e1725a..2911caa1 100644 --- a/vendor/symfony/http-kernel/EventListener/DebugHandlersListener.php +++ b/vendor/symfony/http-kernel/EventListener/DebugHandlersListener.php @@ -37,6 +37,7 @@ class DebugHandlersListener implements EventSubscriberInterface private $fileLinkFormat; private $scope; private $firstCall = true; + private $hasTerminatedWithException; /** * @param callable|null $exceptionHandler A handler that will be called on Exception @@ -60,19 +61,19 @@ class DebugHandlersListener implements EventSubscriberInterface /** * Configures the error handler. - * - * @param Event|null $event The triggering event */ public function configure(Event $event = null) { - if (!$this->firstCall) { + if (!$event instanceof KernelEvent ? !$this->firstCall : !$event->isMasterRequest()) { return; } - $this->firstCall = false; + $this->firstCall = $this->hasTerminatedWithException = false; + + $handler = set_exception_handler('var_dump'); + $handler = is_array($handler) ? $handler[0] : null; + restore_exception_handler(); + if ($this->logger || null !== $this->throwAt) { - $handler = set_error_handler('var_dump'); - $handler = is_array($handler) ? $handler[0] : null; - restore_error_handler(); if ($handler instanceof ErrorHandler) { if ($this->logger) { $handler->setDefaultLogger($this->logger, $this->levels); @@ -88,7 +89,7 @@ class DebugHandlersListener implements EventSubscriberInterface $handler->screamAt($levels); } if ($this->scope) { - $handler->scopeAt($this->levels); + $handler->scopeAt($levels & ~E_USER_DEPRECATED & ~E_DEPRECATED); } else { $handler->scopeAt(0, true); } @@ -101,8 +102,16 @@ class DebugHandlersListener implements EventSubscriberInterface } if (!$this->exceptionHandler) { if ($event instanceof KernelEvent) { - if (method_exists($event->getKernel(), 'terminateWithException')) { - $this->exceptionHandler = array($event->getKernel(), 'terminateWithException'); + if (method_exists($kernel = $event->getKernel(), 'terminateWithException')) { + $request = $event->getRequest(); + $hasRun = &$this->hasTerminatedWithException; + $this->exceptionHandler = function (\Exception $e) use ($kernel, $request, &$hasRun) { + if ($hasRun) { + throw $e; + } + $hasRun = true; + $kernel->terminateWithException($e, $request); + }; } } elseif ($event instanceof ConsoleEvent && $app = $event->getCommand()->getApplication()) { $output = $event->getOutput(); @@ -115,13 +124,14 @@ class DebugHandlersListener implements EventSubscriberInterface } } if ($this->exceptionHandler) { - $handler = set_exception_handler('var_dump'); - $handler = is_array($handler) ? $handler[0] : null; - restore_exception_handler(); if ($handler instanceof ErrorHandler) { - $h = $handler->setExceptionHandler('var_dump') ?: $this->exceptionHandler; - $handler->setExceptionHandler($h); - $handler = is_array($h) ? $h[0] : null; + $h = $handler->setExceptionHandler('var_dump'); + if (is_array($h) && $h[0] instanceof ExceptionHandler) { + $handler->setExceptionHandler($h); + $handler = $h[0]; + } else { + $handler->setExceptionHandler($this->exceptionHandler); + } } if ($handler instanceof ExceptionHandler) { $handler->setHandler($this->exceptionHandler); diff --git a/vendor/symfony/http-kernel/EventListener/DumpListener.php b/vendor/symfony/http-kernel/EventListener/DumpListener.php index 88acef31..de19e131 100644 --- a/vendor/symfony/http-kernel/EventListener/DumpListener.php +++ b/vendor/symfony/http-kernel/EventListener/DumpListener.php @@ -27,10 +27,6 @@ class DumpListener implements EventSubscriberInterface private $cloner; private $dumper; - /** - * @param ClonerInterface $cloner Cloner service - * @param DataDumperInterface $dumper Dumper service - */ public function __construct(ClonerInterface $cloner, DataDumperInterface $dumper) { $this->cloner = $cloner; diff --git a/vendor/symfony/http-kernel/EventListener/ExceptionListener.php b/vendor/symfony/http-kernel/EventListener/ExceptionListener.php index cf3a2f0a..f18e42c7 100644 --- a/vendor/symfony/http-kernel/EventListener/ExceptionListener.php +++ b/vendor/symfony/http-kernel/EventListener/ExceptionListener.php @@ -13,7 +13,9 @@ namespace Symfony\Component\HttpKernel\EventListener; use Psr\Log\LoggerInterface; use Symfony\Component\Debug\Exception\FlattenException; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\Event\FilterResponseEvent; use Symfony\Component\HttpKernel\Log\DebugLoggerInterface; use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; use Symfony\Component\HttpKernel\KernelEvents; @@ -30,17 +32,20 @@ class ExceptionListener implements EventSubscriberInterface { protected $controller; protected $logger; + protected $debug; - public function __construct($controller, LoggerInterface $logger = null) + public function __construct($controller, LoggerInterface $logger = null, $debug = false) { $this->controller = $controller; $this->logger = $logger; + $this->debug = $debug; } public function onKernelException(GetResponseForExceptionEvent $event) { $exception = $event->getException(); $request = $event->getRequest(); + $eventDispatcher = func_num_args() > 2 ? func_get_arg(2) : null; $this->logException($exception, sprintf('Uncaught PHP Exception %s: "%s" at %s line %s', get_class($exception), $exception->getMessage(), $exception->getFile(), $exception->getLine())); @@ -67,6 +72,14 @@ class ExceptionListener implements EventSubscriberInterface } $event->setResponse($response); + + if ($this->debug && $eventDispatcher instanceof EventDispatcherInterface) { + $cspRemovalListener = function (FilterResponseEvent $event) use (&$cspRemovalListener, $eventDispatcher) { + $event->getResponse()->headers->remove('Content-Security-Policy'); + $eventDispatcher->removeListener(KernelEvents::RESPONSE, $cspRemovalListener); + }; + $eventDispatcher->addListener(KernelEvents::RESPONSE, $cspRemovalListener, -128); + } } public static function getSubscribedEvents() diff --git a/vendor/symfony/http-kernel/EventListener/FragmentListener.php b/vendor/symfony/http-kernel/EventListener/FragmentListener.php index 4e814525..da518fcc 100644 --- a/vendor/symfony/http-kernel/EventListener/FragmentListener.php +++ b/vendor/symfony/http-kernel/EventListener/FragmentListener.php @@ -47,8 +47,6 @@ class FragmentListener implements EventSubscriberInterface /** * Fixes request attributes when the path is '/_fragment'. * - * @param GetResponseEvent $event A GetResponseEvent instance - * * @throws AccessDeniedHttpException if the request does not come from a trusted IP */ public function onKernelRequest(GetResponseEvent $event) diff --git a/vendor/symfony/http-kernel/EventListener/ProfilerListener.php b/vendor/symfony/http-kernel/EventListener/ProfilerListener.php index 8886da01..e3e4e762 100644 --- a/vendor/symfony/http-kernel/EventListener/ProfilerListener.php +++ b/vendor/symfony/http-kernel/EventListener/ProfilerListener.php @@ -40,8 +40,8 @@ class ProfilerListener implements EventSubscriberInterface * @param Profiler $profiler A Profiler instance * @param RequestStack $requestStack A RequestStack instance * @param RequestMatcherInterface|null $matcher A RequestMatcher instance - * @param bool $onlyException true if the profiler only collects data when an exception occurs, false otherwise - * @param bool $onlyMasterRequests true if the profiler only collects data when the request is a master request, false otherwise + * @param bool $onlyException True if the profiler only collects data when an exception occurs, false otherwise + * @param bool $onlyMasterRequests True if the profiler only collects data when the request is a master request, false otherwise */ public function __construct(Profiler $profiler, RequestStack $requestStack, RequestMatcherInterface $matcher = null, $onlyException = false, $onlyMasterRequests = false) { @@ -56,8 +56,6 @@ class ProfilerListener implements EventSubscriberInterface /** * Handles the onKernelException event. - * - * @param GetResponseForExceptionEvent $event A GetResponseForExceptionEvent instance */ public function onKernelException(GetResponseForExceptionEvent $event) { @@ -70,8 +68,6 @@ class ProfilerListener implements EventSubscriberInterface /** * Handles the onKernelResponse event. - * - * @param FilterResponseEvent $event A FilterResponseEvent instance */ public function onKernelResponse(FilterResponseEvent $event) { diff --git a/vendor/symfony/http-kernel/EventListener/ResponseListener.php b/vendor/symfony/http-kernel/EventListener/ResponseListener.php index eeb2b0fc..6d56197a 100644 --- a/vendor/symfony/http-kernel/EventListener/ResponseListener.php +++ b/vendor/symfony/http-kernel/EventListener/ResponseListener.php @@ -31,8 +31,6 @@ class ResponseListener implements EventSubscriberInterface /** * Filters the Response. - * - * @param FilterResponseEvent $event A FilterResponseEvent instance */ public function onKernelResponse(FilterResponseEvent $event) { diff --git a/vendor/symfony/http-kernel/EventListener/RouterListener.php b/vendor/symfony/http-kernel/EventListener/RouterListener.php index 16f31a2d..caaf80f8 100644 --- a/vendor/symfony/http-kernel/EventListener/RouterListener.php +++ b/vendor/symfony/http-kernel/EventListener/RouterListener.php @@ -12,13 +12,17 @@ namespace Symfony\Component\HttpKernel\EventListener; use Psr\Log\LoggerInterface; +use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\HttpKernel\Event\FinishRequestEvent; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\HttpKernel\KernelEvents; +use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\Routing\Exception\MethodNotAllowedException; +use Symfony\Component\Routing\Exception\NoConfigurationException; use Symfony\Component\Routing\Exception\ResourceNotFoundException; use Symfony\Component\Routing\Matcher\UrlMatcherInterface; use Symfony\Component\Routing\Matcher\RequestMatcherInterface; @@ -31,6 +35,7 @@ use Symfony\Component\HttpFoundation\Request; * Initializes the context from the request and sets request attributes based on a matching route. * * @author Fabien Potencier <fabien@symfony.com> + * @author Yonel Ceruto <yonelceruto@gmail.com> */ class RouterListener implements EventSubscriberInterface { @@ -38,16 +43,20 @@ class RouterListener implements EventSubscriberInterface private $context; private $logger; private $requestStack; + private $projectDir; + private $debug; /** * @param UrlMatcherInterface|RequestMatcherInterface $matcher The Url or Request matcher * @param RequestStack $requestStack A RequestStack instance * @param RequestContext|null $context The RequestContext (can be null when $matcher implements RequestContextAwareInterface) * @param LoggerInterface|null $logger The logger + * @param string $projectDir + * @param bool $debug * * @throws \InvalidArgumentException */ - public function __construct($matcher, RequestStack $requestStack, RequestContext $context = null, LoggerInterface $logger = null) + public function __construct($matcher, RequestStack $requestStack, RequestContext $context = null, LoggerInterface $logger = null, $projectDir = null, $debug = true) { if (!$matcher instanceof UrlMatcherInterface && !$matcher instanceof RequestMatcherInterface) { throw new \InvalidArgumentException('Matcher must either implement UrlMatcherInterface or RequestMatcherInterface.'); @@ -61,12 +70,18 @@ class RouterListener implements EventSubscriberInterface $this->context = $context ?: $matcher->getContext(); $this->requestStack = $requestStack; $this->logger = $logger; + $this->projectDir = $projectDir; + $this->debug = $debug; } private function setCurrentRequest(Request $request = null) { if (null !== $request) { - $this->context->fromRequest($request); + try { + $this->context->fromRequest($request); + } catch (\UnexpectedValueException $e) { + throw new BadRequestHttpException($e->getMessage(), $e, $e->getCode()); + } } } @@ -114,6 +129,12 @@ class RouterListener implements EventSubscriberInterface unset($parameters['_route'], $parameters['_controller']); $request->attributes->set('_route_params', $parameters); } catch (ResourceNotFoundException $e) { + if ($this->debug && $e instanceof NoConfigurationException) { + $event->setResponse($this->createWelcomeResponse()); + + return; + } + $message = sprintf('No route found for "%s %s"', $request->getMethod(), $request->getPathInfo()); if ($referer = $request->headers->get('referer')) { @@ -135,4 +156,16 @@ class RouterListener implements EventSubscriberInterface KernelEvents::FINISH_REQUEST => array(array('onKernelFinishRequest', 0)), ); } + + private function createWelcomeResponse() + { + $version = Kernel::VERSION; + $baseDir = realpath($this->projectDir).DIRECTORY_SEPARATOR; + $docVersion = substr(Kernel::VERSION, 0, 3); + + ob_start(); + include __DIR__.'/../Resources/welcome.html.php'; + + return new Response(ob_get_clean(), Response::HTTP_NOT_FOUND); + } } diff --git a/vendor/symfony/http-kernel/EventListener/StreamedResponseListener.php b/vendor/symfony/http-kernel/EventListener/StreamedResponseListener.php index 571cd74e..671db5d8 100644 --- a/vendor/symfony/http-kernel/EventListener/StreamedResponseListener.php +++ b/vendor/symfony/http-kernel/EventListener/StreamedResponseListener.php @@ -26,8 +26,6 @@ class StreamedResponseListener implements EventSubscriberInterface { /** * Filters the Response. - * - * @param FilterResponseEvent $event A FilterResponseEvent instance */ public function onKernelResponse(FilterResponseEvent $event) { diff --git a/vendor/symfony/http-kernel/EventListener/SurrogateListener.php b/vendor/symfony/http-kernel/EventListener/SurrogateListener.php index 358fc977..37d1b9d0 100644 --- a/vendor/symfony/http-kernel/EventListener/SurrogateListener.php +++ b/vendor/symfony/http-kernel/EventListener/SurrogateListener.php @@ -26,9 +26,6 @@ class SurrogateListener implements EventSubscriberInterface { private $surrogate; - /** - * @param SurrogateInterface $surrogate An SurrogateInterface instance - */ public function __construct(SurrogateInterface $surrogate = null) { $this->surrogate = $surrogate; @@ -36,8 +33,6 @@ class SurrogateListener implements EventSubscriberInterface /** * Filters the Response. - * - * @param FilterResponseEvent $event A FilterResponseEvent instance */ public function onKernelResponse(FilterResponseEvent $event) { diff --git a/vendor/symfony/http-kernel/EventListener/ValidateRequestListener.php b/vendor/symfony/http-kernel/EventListener/ValidateRequestListener.php index b96c7814..a33853f7 100644 --- a/vendor/symfony/http-kernel/EventListener/ValidateRequestListener.php +++ b/vendor/symfony/http-kernel/EventListener/ValidateRequestListener.php @@ -24,8 +24,6 @@ class ValidateRequestListener implements EventSubscriberInterface { /** * Performs the validation. - * - * @param GetResponseEvent $event */ public function onKernelRequest(GetResponseEvent $event) { diff --git a/vendor/symfony/http-kernel/Fragment/AbstractSurrogateFragmentRenderer.php b/vendor/symfony/http-kernel/Fragment/AbstractSurrogateFragmentRenderer.php index e955cd0d..a8dca41b 100644 --- a/vendor/symfony/http-kernel/Fragment/AbstractSurrogateFragmentRenderer.php +++ b/vendor/symfony/http-kernel/Fragment/AbstractSurrogateFragmentRenderer.php @@ -63,7 +63,7 @@ abstract class AbstractSurrogateFragmentRenderer extends RoutableFragmentRendere { if (!$this->surrogate || !$this->surrogate->hasSurrogateCapability($request)) { if ($uri instanceof ControllerReference && $this->containsNonScalars($uri->attributes)) { - @trigger_error('Passing non-scalar values as part of URI attributes to the ESI and SSI rendering strategies is deprecated since version 3.1, and will be removed in 4.0. Use a different rendering strategy or pass scalar values.', E_USER_DEPRECATED); + @trigger_error('Passing non-scalar values as part of URI attributes to the ESI and SSI rendering strategies is deprecated since Symfony 3.1, and will be removed in 4.0. Use a different rendering strategy or pass scalar values.', E_USER_DEPRECATED); } return $this->inlineStrategy->render($uri, $request, $options); @@ -98,8 +98,8 @@ abstract class AbstractSurrogateFragmentRenderer extends RoutableFragmentRendere private function containsNonScalars(array $values) { foreach ($values as $value) { - if (is_array($value) && $this->containsNonScalars($value)) { - return true; + if (is_array($value)) { + return $this->containsNonScalars($value); } elseif (!is_scalar($value) && null !== $value) { return true; } diff --git a/vendor/symfony/http-kernel/Fragment/FragmentHandler.php b/vendor/symfony/http-kernel/Fragment/FragmentHandler.php index 3ea27e61..c9d952ff 100644 --- a/vendor/symfony/http-kernel/Fragment/FragmentHandler.php +++ b/vendor/symfony/http-kernel/Fragment/FragmentHandler.php @@ -48,8 +48,6 @@ class FragmentHandler /** * Adds a renderer. - * - * @param FragmentRendererInterface $renderer A FragmentRendererInterface instance */ public function addRenderer(FragmentRendererInterface $renderer) { @@ -95,8 +93,6 @@ class FragmentHandler * When the Response is a StreamedResponse, the content is streamed immediately * instead of being returned. * - * @param Response $response A Response instance - * * @return string|null The Response content or null when the Response is streamed * * @throws \RuntimeException when the Response is not successful diff --git a/vendor/symfony/http-kernel/Fragment/InlineFragmentRenderer.php b/vendor/symfony/http-kernel/Fragment/InlineFragmentRenderer.php index 8ed81f9a..3f3a51a5 100644 --- a/vendor/symfony/http-kernel/Fragment/InlineFragmentRenderer.php +++ b/vendor/symfony/http-kernel/Fragment/InlineFragmentRenderer.php @@ -29,10 +29,6 @@ class InlineFragmentRenderer extends RoutableFragmentRenderer private $kernel; private $dispatcher; - /** - * @param HttpKernelInterface $kernel A HttpKernelInterface instance - * @param EventDispatcherInterface $dispatcher A EventDispatcherInterface instance - */ public function __construct(HttpKernelInterface $kernel, EventDispatcherInterface $dispatcher = null) { $this->kernel = $kernel; diff --git a/vendor/symfony/http-kernel/HttpCache/AbstractSurrogate.php b/vendor/symfony/http-kernel/HttpCache/AbstractSurrogate.php index 09998278..3b2d5f26 100644 --- a/vendor/symfony/http-kernel/HttpCache/AbstractSurrogate.php +++ b/vendor/symfony/http-kernel/HttpCache/AbstractSurrogate.php @@ -113,8 +113,6 @@ abstract class AbstractSurrogate implements SurrogateInterface /** * Remove the Surrogate from the Surrogate-Control header. - * - * @param Response $response */ protected function removeFromControl(Response $response) { diff --git a/vendor/symfony/http-kernel/HttpCache/HttpCache.php b/vendor/symfony/http-kernel/HttpCache/HttpCache.php index 41f95a47..7c5a44f0 100644 --- a/vendor/symfony/http-kernel/HttpCache/HttpCache.php +++ b/vendor/symfony/http-kernel/HttpCache/HttpCache.php @@ -36,6 +36,8 @@ class HttpCache implements HttpKernelInterface, TerminableInterface private $traces = array(); /** + * Constructor. + * * The available options are: * * * debug: If true, the traces are added as a HTTP header to ease debugging @@ -67,11 +69,6 @@ class HttpCache implements HttpKernelInterface, TerminableInterface * the cache can serve a stale response when an error is encountered (default: 60). * This setting is overridden by the stale-if-error HTTP Cache-Control extension * (see RFC 5861). - * - * @param HttpKernelInterface $kernel An HttpKernelInterface instance - * @param StoreInterface $store A Store instance - * @param SurrogateInterface $surrogate A SurrogateInterface instance - * @param array $options An array of options */ public function __construct(HttpKernelInterface $kernel, StoreInterface $store, SurrogateInterface $surrogate = null, array $options = array()) { @@ -290,7 +287,7 @@ class HttpCache implements HttpKernelInterface, TerminableInterface * it triggers "miss" processing. * * @param Request $request A Request instance - * @param bool $catch whether to process exceptions + * @param bool $catch Whether to process exceptions * * @return Response A Response instance * @@ -399,7 +396,7 @@ class HttpCache implements HttpKernelInterface, TerminableInterface * stores it in the cache if is cacheable. * * @param Request $request A Request instance - * @param bool $catch whether to process exceptions + * @param bool $catch Whether to process exceptions * * @return Response A Response instance */ @@ -503,9 +500,6 @@ class HttpCache implements HttpKernelInterface, TerminableInterface /** * Checks whether the cache entry is "fresh enough" to satisfy the Request. * - * @param Request $request A Request instance - * @param Response $entry A Response instance - * * @return bool true if the cache entry if fresh enough, false otherwise */ protected function isFreshEnough(Request $request, Response $entry) @@ -524,9 +518,6 @@ class HttpCache implements HttpKernelInterface, TerminableInterface /** * Locks a Request during the call to the backend. * - * @param Request $request A Request instance - * @param Response $entry A Response instance - * * @return bool true if the cache entry can be returned even if it is staled, false otherwise */ protected function lock(Request $request, Response $entry) @@ -572,9 +563,6 @@ class HttpCache implements HttpKernelInterface, TerminableInterface /** * Writes the Response to the cache. * - * @param Request $request A Request instance - * @param Response $response A Response instance - * * @throws \Exception */ protected function store(Request $request, Response $response) @@ -599,9 +587,6 @@ class HttpCache implements HttpKernelInterface, TerminableInterface /** * Restores the Response body. - * - * @param Request $request A Request instance - * @param Response $response A Response instance */ private function restoreResponseBody(Request $request, Response $response) { @@ -643,8 +628,6 @@ class HttpCache implements HttpKernelInterface, TerminableInterface * Checks if the Request includes authorization or other sensitive information * that should cause the Response to be considered private by default. * - * @param Request $request A Request instance - * * @return bool true if the Request is private, false otherwise */ private function isPrivateRequest(Request $request) @@ -721,11 +704,11 @@ class HttpCache implements HttpKernelInterface, TerminableInterface private function waitForLock(Request $request) { $wait = 0; - while ($this->store->isLocked($request) && $wait < 5000000) { + while ($this->store->isLocked($request) && $wait < 100) { usleep(50000); - $wait += 50000; + ++$wait; } - return $wait < 5000000; + return $wait < 100; } } diff --git a/vendor/symfony/http-kernel/HttpCache/ResponseCacheStrategyInterface.php b/vendor/symfony/http-kernel/HttpCache/ResponseCacheStrategyInterface.php index d70c2e06..e282299a 100644 --- a/vendor/symfony/http-kernel/HttpCache/ResponseCacheStrategyInterface.php +++ b/vendor/symfony/http-kernel/HttpCache/ResponseCacheStrategyInterface.php @@ -27,15 +27,11 @@ interface ResponseCacheStrategyInterface { /** * Adds a Response. - * - * @param Response $response */ public function add(Response $response); /** * Updates the Response HTTP headers based on the embedded Responses. - * - * @param Response $response */ public function update(Response $response); } diff --git a/vendor/symfony/http-kernel/HttpCache/Store.php b/vendor/symfony/http-kernel/HttpCache/Store.php index 83c3a9ae..fa0d4a86 100644 --- a/vendor/symfony/http-kernel/HttpCache/Store.php +++ b/vendor/symfony/http-kernel/HttpCache/Store.php @@ -60,8 +60,6 @@ class Store implements StoreInterface /** * Tries to lock the cache for a given Request, without blocking. * - * @param Request $request A Request instance - * * @return bool|string true if the lock is acquired, the path to the current lock otherwise */ public function lock(Request $request) @@ -89,8 +87,6 @@ class Store implements StoreInterface /** * Releases the lock for the given Request. * - * @param Request $request A Request instance - * * @return bool False if the lock file does not exist or cannot be unlocked, true otherwise */ public function unlock(Request $request) @@ -131,8 +127,6 @@ class Store implements StoreInterface /** * Locates a cached Response for the Request provided. * - * @param Request $request A Request instance - * * @return Response|null A Response instance, or null if no cache entry was found */ public function lookup(Request $request) @@ -157,7 +151,7 @@ class Store implements StoreInterface return; } - list($req, $headers) = $match; + $headers = $match[1]; if (file_exists($body = $this->getPath($headers['x-content-digest'][0]))) { return $this->restoreResponse($headers, $body); } @@ -173,9 +167,6 @@ class Store implements StoreInterface * Existing entries are read and any that match the response are removed. This * method calls write with the new list of cache entries. * - * @param Request $request A Request instance - * @param Response $response A Response instance - * * @return string The key under which the response is stored * * @throws \RuntimeException @@ -228,8 +219,6 @@ class Store implements StoreInterface /** * Returns content digest for $response. * - * @param Response $response - * * @return string */ protected function generateContentDigest(Response $response) @@ -240,8 +229,6 @@ class Store implements StoreInterface /** * Invalidates all cache entries that match the request. * - * @param Request $request A Request instance - * * @throws \RuntimeException */ public function invalidate(Request $request) @@ -432,8 +419,6 @@ class Store implements StoreInterface * headers, use a Vary header to indicate them, and each representation will * be stored independently under the same cache key. * - * @param Request $request A Request instance - * * @return string A key for the given Request */ protected function generateCacheKey(Request $request) @@ -444,8 +429,6 @@ class Store implements StoreInterface /** * Returns a cache key for the given Request. * - * @param Request $request A Request instance - * * @return string A key for the given Request */ private function getCacheKey(Request $request) @@ -460,8 +443,6 @@ class Store implements StoreInterface /** * Persists the Request HTTP headers. * - * @param Request $request A Request instance - * * @return array An array of HTTP headers */ private function persistRequest(Request $request) @@ -472,8 +453,6 @@ class Store implements StoreInterface /** * Persists the Response HTTP headers. * - * @param Response $response A Response instance - * * @return array An array of HTTP headers */ private function persistResponse(Response $response) diff --git a/vendor/symfony/http-kernel/HttpCache/StoreInterface.php b/vendor/symfony/http-kernel/HttpCache/StoreInterface.php index ddc0c04e..8f1cf440 100644 --- a/vendor/symfony/http-kernel/HttpCache/StoreInterface.php +++ b/vendor/symfony/http-kernel/HttpCache/StoreInterface.php @@ -27,8 +27,6 @@ interface StoreInterface /** * Locates a cached Response for the Request provided. * - * @param Request $request A Request instance - * * @return Response|null A Response instance, or null if no cache entry was found */ public function lookup(Request $request); @@ -39,25 +37,18 @@ interface StoreInterface * Existing entries are read and any that match the response are removed. This * method calls write with the new list of cache entries. * - * @param Request $request A Request instance - * @param Response $response A Response instance - * * @return string The key under which the response is stored */ public function write(Request $request, Response $response); /** * Invalidates all cache entries that match the request. - * - * @param Request $request A Request instance */ public function invalidate(Request $request); /** * Locks the cache for a given Request. * - * @param Request $request A Request instance - * * @return bool|string true if the lock is acquired, the path to the current lock otherwise */ public function lock(Request $request); @@ -65,8 +56,6 @@ interface StoreInterface /** * Releases the lock for the given Request. * - * @param Request $request A Request instance - * * @return bool False if the lock file does not exist or cannot be unlocked, true otherwise */ public function unlock(Request $request); @@ -74,8 +63,6 @@ interface StoreInterface /** * Returns whether or not a lock exists. * - * @param Request $request A Request instance - * * @return bool true if lock exists, false otherwise */ public function isLocked(Request $request); diff --git a/vendor/symfony/http-kernel/HttpCache/SurrogateInterface.php b/vendor/symfony/http-kernel/HttpCache/SurrogateInterface.php index 5d65fd65..85391f8f 100644 --- a/vendor/symfony/http-kernel/HttpCache/SurrogateInterface.php +++ b/vendor/symfony/http-kernel/HttpCache/SurrogateInterface.php @@ -33,16 +33,12 @@ interface SurrogateInterface /** * Checks that at least one surrogate has Surrogate capability. * - * @param Request $request A Request instance - * * @return bool true if one surrogate has Surrogate capability, false otherwise */ public function hasSurrogateCapability(Request $request); /** * Adds Surrogate-capability to the given Request. - * - * @param Request $request A Request instance */ public function addSurrogateCapability(Request $request); @@ -50,16 +46,12 @@ interface SurrogateInterface * Adds HTTP headers to specify that the Response needs to be parsed for Surrogate. * * This method only adds an Surrogate HTTP header if the Response has some Surrogate tags. - * - * @param Response $response A Response instance */ public function addSurrogateControl(Response $response); /** * Checks that the Response needs to be parsed for Surrogate tags. * - * @param Response $response A Response instance - * * @return bool true if the Response needs to be parsed, false otherwise */ public function needsParsing(Response $response); @@ -79,9 +71,6 @@ interface SurrogateInterface /** * Replaces a Response Surrogate tags with the included resource content. * - * @param Request $request A Request instance - * @param Response $response A Response instance - * * @return Response */ public function process(Request $request, Response $response); diff --git a/vendor/symfony/http-kernel/HttpKernel.php b/vendor/symfony/http-kernel/HttpKernel.php index 8d55ccde..41f8913b 100644 --- a/vendor/symfony/http-kernel/HttpKernel.php +++ b/vendor/symfony/http-kernel/HttpKernel.php @@ -89,14 +89,12 @@ class HttpKernel implements HttpKernelInterface, TerminableInterface } /** - * @throws \LogicException If the request stack is empty - * * @internal */ - public function terminateWithException(\Exception $exception) + public function terminateWithException(\Exception $exception, Request $request = null) { - if (!$request = $this->requestStack->getMasterRequest()) { - throw new \LogicException('Request stack is empty', 0, $exception); + if (!$request = $request ?: $this->requestStack->getMasterRequest()) { + throw $exception; } $response = $this->handleException($exception, $request, self::MASTER_REQUEST); @@ -150,7 +148,7 @@ class HttpKernel implements HttpKernelInterface, TerminableInterface $arguments = $event->getArguments(); // call controller - $response = call_user_func_array($controller, $arguments); + $response = \call_user_func_array($controller, $arguments); // view if (!$response instanceof Response) { @@ -242,7 +240,7 @@ class HttpKernel implements HttpKernelInterface, TerminableInterface // the developer asked for a specific status code if ($response->headers->has('X-Status-Code')) { - @trigger_error(sprintf('Using the X-Status-Code header is deprecated since version 3.3 and will be removed in 4.0. Use %s::allowCustomResponseCode() instead.', GetResponseForExceptionEvent::class), E_USER_DEPRECATED); + @trigger_error(sprintf('Using the X-Status-Code header is deprecated since Symfony 3.3 and will be removed in 4.0. Use %s::allowCustomResponseCode() instead.', GetResponseForExceptionEvent::class), E_USER_DEPRECATED); $response->setStatusCode($response->headers->get('X-Status-Code')); diff --git a/vendor/symfony/http-kernel/Kernel.php b/vendor/symfony/http-kernel/Kernel.php index 3a29e7b0..eb2364e4 100644 --- a/vendor/symfony/http-kernel/Kernel.php +++ b/vendor/symfony/http-kernel/Kernel.php @@ -13,6 +13,8 @@ namespace Symfony\Component\HttpKernel; use Symfony\Bridge\ProxyManager\LazyProxy\Instantiator\RuntimeInstantiator; use Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper; +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\Compiler\PassConfig; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Dumper\PhpDumper; @@ -22,6 +24,7 @@ use Symfony\Component\DependencyInjection\Loader\IniFileLoader; use Symfony\Component\DependencyInjection\Loader\PhpFileLoader; use Symfony\Component\DependencyInjection\Loader\DirectoryLoader; use Symfony\Component\DependencyInjection\Loader\ClosureLoader; +use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Bundle\BundleInterface; @@ -42,7 +45,7 @@ use Symfony\Component\ClassLoader\ClassCollectionLoader; * * @author Fabien Potencier <fabien@symfony.com> */ -abstract class Kernel implements KernelInterface, TerminableInterface +abstract class Kernel implements KernelInterface, RebootableInterface, TerminableInterface { /** * @var BundleInterface[] @@ -60,16 +63,19 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $loadClassCache; private $projectDir; + private $warmupDir; + private $requestStackSize = 0; + private $resetServices = false; - const VERSION = '3.3.10'; - const VERSION_ID = 30310; + const VERSION = '3.4.4'; + const VERSION_ID = 30404; const MAJOR_VERSION = 3; - const MINOR_VERSION = 3; - const RELEASE_VERSION = 10; + const MINOR_VERSION = 4; + const RELEASE_VERSION = 4; const EXTRA_VERSION = ''; - const END_OF_MAINTENANCE = '01/2018'; - const END_OF_LIFE = '07/2018'; + const END_OF_MAINTENANCE = '11/2020'; + const END_OF_LIFE = '11/2021'; /** * @param string $environment The environment @@ -95,6 +101,8 @@ abstract class Kernel implements KernelInterface, TerminableInterface $this->booted = false; $this->container = null; + $this->requestStackSize = 0; + $this->resetServices = false; } /** @@ -103,8 +111,20 @@ abstract class Kernel implements KernelInterface, TerminableInterface public function boot() { if (true === $this->booted) { + if (!$this->requestStackSize && $this->resetServices) { + if ($this->container->has('services_resetter')) { + $this->container->get('services_resetter')->reset(); + } + $this->resetServices = false; + } + return; } + if ($this->debug && !isset($_ENV['SHELL_VERBOSITY']) && !isset($_SERVER['SHELL_VERBOSITY'])) { + putenv('SHELL_VERBOSITY=3'); + $_ENV['SHELL_VERBOSITY'] = 3; + $_SERVER['SHELL_VERBOSITY'] = 3; + } if ($this->loadClassCache) { $this->doLoadClassCache($this->loadClassCache[0], $this->loadClassCache[1]); @@ -124,6 +144,16 @@ abstract class Kernel implements KernelInterface, TerminableInterface $this->booted = true; } + /** + * {@inheritdoc} + */ + public function reboot($warmupDir) + { + $this->shutdown(); + $this->warmupDir = $warmupDir; + $this->boot(); + } + /** * {@inheritdoc} */ @@ -155,6 +185,8 @@ abstract class Kernel implements KernelInterface, TerminableInterface } $this->container = null; + $this->requestStackSize = 0; + $this->resetServices = false; } /** @@ -162,11 +194,15 @@ abstract class Kernel implements KernelInterface, TerminableInterface */ public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true) { - if (false === $this->booted) { - $this->boot(); - } + $this->boot(); + ++$this->requestStackSize; + $this->resetServices = true; - return $this->getHttpKernel()->handle($request, $type, $catch); + try { + return $this->getHttpKernel()->handle($request, $type, $catch); + } finally { + --$this->requestStackSize; + } } /** @@ -190,8 +226,17 @@ abstract class Kernel implements KernelInterface, TerminableInterface /** * {@inheritdoc} */ - public function getBundle($name, $first = true) + public function getBundle($name, $first = true/*, $noDeprecation = false */) { + $noDeprecation = false; + if (func_num_args() >= 3) { + $noDeprecation = func_get_arg(2); + } + + if (!$first && !$noDeprecation) { + @trigger_error(sprintf('Passing "false" as the second argument to %s() is deprecated as of 3.4 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED); + } + if (!isset($this->bundleMap[$name])) { throw new \InvalidArgumentException(sprintf('Bundle "%s" does not exist or it is not enabled. Maybe you forgot to add it in the registerBundles() method of your %s.php file?', $name, get_class($this))); } @@ -227,7 +272,7 @@ abstract class Kernel implements KernelInterface, TerminableInterface $isResource = 0 === strpos($path, 'Resources') && null !== $dir; $overridePath = substr($path, 9); $resourceBundle = null; - $bundles = $this->getBundle($bundleName, false); + $bundles = $this->getBundle($bundleName, false, true); $files = array(); foreach ($bundles as $bundle) { @@ -348,12 +393,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface * @param string $name The cache name prefix * @param string $extension File extension of the resulting file * - * @deprecated since version 3.3, to be removed in 4.0. + * @deprecated since version 3.3, to be removed in 4.0. The class cache is not needed anymore when using PHP 7.0. */ public function loadClassCache($name = 'classes', $extension = '.php') { if (\PHP_VERSION_ID >= 70000) { - @trigger_error(__METHOD__.'() is deprecated since version 3.3, to be removed in 4.0.', E_USER_DEPRECATED); + @trigger_error(__METHOD__.'() is deprecated since Symfony 3.3, to be removed in 4.0.', E_USER_DEPRECATED); } $this->loadClassCache = array($name, $extension); @@ -367,10 +412,10 @@ abstract class Kernel implements KernelInterface, TerminableInterface public function setClassCache(array $classes) { if (\PHP_VERSION_ID >= 70000) { - @trigger_error(__METHOD__.'() is deprecated since version 3.3, to be removed in 4.0.', E_USER_DEPRECATED); + @trigger_error(__METHOD__.'() is deprecated since Symfony 3.3, to be removed in 4.0.', E_USER_DEPRECATED); } - file_put_contents($this->getCacheDir().'/classes.map', sprintf('<?php return %s;', var_export($classes, true))); + file_put_contents(($this->warmupDir ?: $this->getCacheDir()).'/classes.map', sprintf('<?php return %s;', var_export($classes, true))); } /** @@ -378,7 +423,7 @@ abstract class Kernel implements KernelInterface, TerminableInterface */ public function setAnnotatedClassCache(array $annotatedClasses) { - file_put_contents($this->getCacheDir().'/annotations.map', sprintf('<?php return %s;', var_export($annotatedClasses, true))); + file_put_contents(($this->warmupDir ?: $this->getCacheDir()).'/annotations.map', sprintf('<?php return %s;', var_export($annotatedClasses, true))); } /** @@ -419,11 +464,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected function doLoadClassCache($name, $extension) { if (\PHP_VERSION_ID >= 70000) { - @trigger_error(__METHOD__.'() is deprecated since version 3.3, to be removed in 4.0.', E_USER_DEPRECATED); + @trigger_error(__METHOD__.'() is deprecated since Symfony 3.3, to be removed in 4.0.', E_USER_DEPRECATED); } + $cacheDir = $this->warmupDir ?: $this->getCacheDir(); - if (!$this->booted && is_file($this->getCacheDir().'/classes.map')) { - ClassCollectionLoader::load(include($this->getCacheDir().'/classes.map'), $this->getCacheDir(), $name, $this->debug, false, $extension); + if (!$this->booted && is_file($cacheDir.'/classes.map')) { + ClassCollectionLoader::load(include($cacheDir.'/classes.map'), $cacheDir, $name, $this->debug, false, $extension); } } @@ -453,6 +499,8 @@ abstract class Kernel implements KernelInterface, TerminableInterface $this->bundles[$name] = $bundle; if ($parentName = $bundle->getParent()) { + @trigger_error('Bundle inheritance is deprecated as of 3.4 and will be removed in 4.0.', E_USER_DEPRECATED); + if (isset($directChildren[$parentName])) { throw new \LogicException(sprintf('Bundle "%s" is directly extended by two bundles "%s" and "%s".', $parentName, $name, $directChildren[$parentName])); } @@ -495,8 +543,6 @@ abstract class Kernel implements KernelInterface, TerminableInterface * The extension point similar to the Bundle::build() method. * * Use this method to register compiler passes and manipulate the container during the building process. - * - * @param ContainerBuilder $container */ protected function build(ContainerBuilder $container) { @@ -533,65 +579,108 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected function initializeContainer() { $class = $this->getContainerClass(); - $cache = new ConfigCache($this->getCacheDir().'/'.$class.'.php', $this->debug); - $fresh = true; - if (!$cache->isFresh()) { - if ($this->debug) { - $collectedLogs = array(); - $previousHandler = set_error_handler(function ($type, $message, $file, $line) use (&$collectedLogs, &$previousHandler) { - if (E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) { - return $previousHandler ? $previousHandler($type, $message, $file, $line) : false; - } + $cacheDir = $this->warmupDir ?: $this->getCacheDir(); + $cache = new ConfigCache($cacheDir.'/'.$class.'.php', $this->debug); + $oldContainer = null; + if ($fresh = $cache->isFresh()) { + // Silence E_WARNING to ignore "include" failures - don't use "@" to prevent silencing fatal errors + $errorLevel = error_reporting(\E_ALL ^ \E_WARNING); + $fresh = $oldContainer = false; + try { + if (\is_object($this->container = include $cache->getPath())) { + $this->container->set('kernel', $this); + $oldContainer = $this->container; + $fresh = true; + } + } catch (\Throwable $e) { + } catch (\Exception $e) { + } finally { + error_reporting($errorLevel); + } + } - if (isset($collectedLogs[$message])) { - ++$collectedLogs[$message]['count']; + if ($fresh) { + return; + } - return; - } + if ($this->debug) { + $collectedLogs = array(); + $previousHandler = defined('PHPUNIT_COMPOSER_INSTALL'); + $previousHandler = $previousHandler ?: set_error_handler(function ($type, $message, $file, $line) use (&$collectedLogs, &$previousHandler) { + if (E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) { + return $previousHandler ? $previousHandler($type, $message, $file, $line) : false; + } + + if (isset($collectedLogs[$message])) { + ++$collectedLogs[$message]['count']; - $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3); - // Clean the trace by removing first frames added by the error handler itself. - for ($i = 0; isset($backtrace[$i]); ++$i) { - if (isset($backtrace[$i]['file'], $backtrace[$i]['line']) && $backtrace[$i]['line'] === $line && $backtrace[$i]['file'] === $file) { - $backtrace = array_slice($backtrace, 1 + $i); - break; - } + return; + } + + $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3); + // Clean the trace by removing first frames added by the error handler itself. + for ($i = 0; isset($backtrace[$i]); ++$i) { + if (isset($backtrace[$i]['file'], $backtrace[$i]['line']) && $backtrace[$i]['line'] === $line && $backtrace[$i]['file'] === $file) { + $backtrace = array_slice($backtrace, 1 + $i); + break; } + } - $collectedLogs[$message] = array( - 'type' => $type, - 'message' => $message, - 'file' => $file, - 'line' => $line, - 'trace' => $backtrace, - 'count' => 1, - ); - }); + $collectedLogs[$message] = array( + 'type' => $type, + 'message' => $message, + 'file' => $file, + 'line' => $line, + 'trace' => $backtrace, + 'count' => 1, + ); + }); + } + + try { + $container = null; + $container = $this->buildContainer(); + $container->compile(); + } finally { + if ($this->debug && true !== $previousHandler) { + restore_error_handler(); + + file_put_contents($cacheDir.'/'.$class.'Deprecations.log', serialize(array_values($collectedLogs))); + file_put_contents($cacheDir.'/'.$class.'Compiler.log', null !== $container ? implode("\n", $container->getCompiler()->getLog()) : ''); } + } + if (null === $oldContainer) { + $errorLevel = error_reporting(\E_ALL ^ \E_WARNING); try { - $container = null; - $container = $this->buildContainer(); - $container->compile(); + $oldContainer = include $cache->getPath(); + } catch (\Throwable $e) { + } catch (\Exception $e) { } finally { - if ($this->debug) { - restore_error_handler(); + error_reporting($errorLevel); + } + } + $oldContainer = is_object($oldContainer) ? new \ReflectionClass($oldContainer) : false; - file_put_contents($this->getCacheDir().'/'.$class.'Deprecations.log', serialize(array_values($collectedLogs))); - file_put_contents($this->getCacheDir().'/'.$class.'Compiler.log', null !== $container ? implode("\n", $container->getCompiler()->getLog()) : ''); + $this->dumpContainer($cache, $container, $class, $this->getContainerBaseClass()); + $this->container = require $cache->getPath(); + $this->container->set('kernel', $this); + + if ($oldContainer && get_class($this->container) !== $oldContainer->name) { + // Because concurrent requests might still be using them, + // old container files are not removed immediately, + // but on a next dump of the container. + $oldContainerDir = dirname($oldContainer->getFileName()); + foreach (glob(dirname($oldContainerDir).'/*.legacy') as $legacyContainer) { + if ($oldContainerDir.'.legacy' !== $legacyContainer && @unlink($legacyContainer)) { + (new Filesystem())->remove(substr($legacyContainer, 0, -7)); } } - $this->dumpContainer($cache, $container, $class, $this->getContainerBaseClass()); - $fresh = false; + touch($oldContainerDir.'.legacy'); } - require_once $cache->getPath(); - - $this->container = new $class(); - $this->container->set('kernel', $this); - - if (!$fresh && $this->container->has('cache_warmer')) { + if ($this->container->has('cache_warmer')) { $this->container->get('cache_warmer')->warmUp($this->container->getParameter('kernel.cache_dir')); } } @@ -622,7 +711,7 @@ abstract class Kernel implements KernelInterface, TerminableInterface 'kernel.environment' => $this->environment, 'kernel.debug' => $this->debug, 'kernel.name' => $this->name, - 'kernel.cache_dir' => realpath($this->getCacheDir()) ?: $this->getCacheDir(), + 'kernel.cache_dir' => realpath($cacheDir = $this->warmupDir ?: $this->getCacheDir()) ?: $cacheDir, 'kernel.logs_dir' => realpath($this->getLogDir()) ?: $this->getLogDir(), 'kernel.bundles' => $bundles, 'kernel.bundles_metadata' => $bundlesMetadata, @@ -668,7 +757,7 @@ abstract class Kernel implements KernelInterface, TerminableInterface */ protected function buildContainer() { - foreach (array('cache' => $this->getCacheDir(), 'logs' => $this->getLogDir()) as $name => $dir) { + foreach (array('cache' => $this->warmupDir ?: $this->getCacheDir(), 'logs' => $this->getLogDir()) as $name => $dir) { if (!is_dir($dir)) { if (false === @mkdir($dir, 0777, true) && !is_dir($dir)) { throw new \RuntimeException(sprintf("Unable to create the %s directory (%s)\n", $name, $dir)); @@ -694,8 +783,6 @@ abstract class Kernel implements KernelInterface, TerminableInterface /** * Prepares the ContainerBuilder before it is compiled. - * - * @param ContainerBuilder $container A ContainerBuilder instance */ protected function prepareContainer(ContainerBuilder $container) { @@ -731,6 +818,9 @@ abstract class Kernel implements KernelInterface, TerminableInterface $container = new ContainerBuilder(); $container->getParameterBag()->add($this->getKernelParameters()); + if ($this instanceof CompilerPassInterface) { + $container->addCompilerPass($this, PassConfig::TYPE_BEFORE_OPTIMIZATION, -10000); + } if (class_exists('ProxyManager\Configuration') && class_exists('Symfony\Bridge\ProxyManager\LazyProxy\Instantiator\RuntimeInstantiator')) { $container->setProxyInstantiator(new RuntimeInstantiator()); } @@ -752,19 +842,34 @@ abstract class Kernel implements KernelInterface, TerminableInterface $dumper = new PhpDumper($container); if (class_exists('ProxyManager\Configuration') && class_exists('Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper')) { - $dumper->setProxyDumper(new ProxyDumper(md5($cache->getPath()))); + $dumper->setProxyDumper(new ProxyDumper(substr(hash('sha256', $cache->getPath()), 0, 7))); } - $content = $dumper->dump(array('class' => $class, 'base_class' => $baseClass, 'file' => $cache->getPath(), 'debug' => $this->debug)); + $content = $dumper->dump(array( + 'class' => $class, + 'base_class' => $baseClass, + 'file' => $cache->getPath(), + 'as_files' => true, + 'debug' => $this->debug, + 'inline_class_loader_parameter' => \PHP_VERSION_ID >= 70000 && !$this->loadClassCache && !class_exists(ClassCollectionLoader::class, false) ? 'container.dumper.inline_class_loader' : null, + )); + + $rootCode = array_pop($content); + $dir = dirname($cache->getPath()).'/'; + $fs = new Filesystem(); - $cache->write($content, $container->getResources()); + foreach ($content as $file => $code) { + $fs->dumpFile($dir.$file, $code); + @chmod($dir.$file, 0666 & ~umask()); + } + @unlink(dirname($dir.$file).'.legacy'); + + $cache->write($rootCode, $container->getResources()); } /** * Returns a loader for the container. * - * @param ContainerInterface $container The service container - * * @return DelegatingLoader The loader */ protected function getContainerLoader(ContainerInterface $container) diff --git a/vendor/symfony/http-kernel/KernelEvents.php b/vendor/symfony/http-kernel/KernelEvents.php index 3e961737..67437632 100644 --- a/vendor/symfony/http-kernel/KernelEvents.php +++ b/vendor/symfony/http-kernel/KernelEvents.php @@ -26,8 +26,6 @@ final class KernelEvents * other code in the framework is executed. * * @Event("Symfony\Component\HttpKernel\Event\GetResponseEvent") - * - * @var string */ const REQUEST = 'kernel.request'; @@ -38,8 +36,6 @@ final class KernelEvents * to modify the thrown exception. * * @Event("Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent") - * - * @var string */ const EXCEPTION = 'kernel.exception'; @@ -51,8 +47,6 @@ final class KernelEvents * controller. * * @Event("Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent") - * - * @var string */ const VIEW = 'kernel.view'; @@ -64,8 +58,6 @@ final class KernelEvents * request. * * @Event("Symfony\Component\HttpKernel\Event\FilterControllerEvent") - * - * @var string */ const CONTROLLER = 'kernel.controller'; @@ -76,8 +68,6 @@ final class KernelEvents * the controller. * * @Event("Symfony\Component\HttpKernel\Event\FilterControllerArgumentsEvent") - * - * @var string */ const CONTROLLER_ARGUMENTS = 'kernel.controller_arguments'; @@ -89,8 +79,6 @@ final class KernelEvents * replied. * * @Event("Symfony\Component\HttpKernel\Event\FilterResponseEvent") - * - * @var string */ const RESPONSE = 'kernel.response'; @@ -100,8 +88,6 @@ final class KernelEvents * This event allows you to run expensive post-response jobs. * * @Event("Symfony\Component\HttpKernel\Event\PostResponseEvent") - * - * @var string */ const TERMINATE = 'kernel.terminate'; @@ -112,8 +98,6 @@ final class KernelEvents * the application, when it was changed during the request. * * @Event("Symfony\Component\HttpKernel\Event\FinishRequestEvent") - * - * @var string */ const FINISH_REQUEST = 'kernel.finish_request'; } diff --git a/vendor/symfony/http-kernel/KernelInterface.php b/vendor/symfony/http-kernel/KernelInterface.php index b8609b9e..b341e3e9 100644 --- a/vendor/symfony/http-kernel/KernelInterface.php +++ b/vendor/symfony/http-kernel/KernelInterface.php @@ -33,8 +33,6 @@ interface KernelInterface extends HttpKernelInterface, \Serializable /** * Loads the container configuration. - * - * @param LoaderInterface $loader A LoaderInterface instance */ public function registerContainerConfiguration(LoaderInterface $loader); @@ -60,6 +58,9 @@ interface KernelInterface extends HttpKernelInterface, \Serializable /** * Returns a bundle and optionally its descendants by its name. * + * The second argument is deprecated as of 3.4 and will be removed in 4.0. This method + * will always return an instance of BundleInterface in 4.0. + * * @param string $name Bundle name * @param bool $first Whether to return the first bundle only or together with its descendants * diff --git a/vendor/symfony/http-kernel/LICENSE b/vendor/symfony/http-kernel/LICENSE index 17d16a13..21d7fb9e 100644 --- a/vendor/symfony/http-kernel/LICENSE +++ b/vendor/symfony/http-kernel/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2017 Fabien Potencier +Copyright (c) 2004-2018 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/symfony/http-kernel/Log/DebugLoggerInterface.php b/vendor/symfony/http-kernel/Log/DebugLoggerInterface.php index 5635a218..f0606d3b 100644 --- a/vendor/symfony/http-kernel/Log/DebugLoggerInterface.php +++ b/vendor/symfony/http-kernel/Log/DebugLoggerInterface.php @@ -15,6 +15,8 @@ namespace Symfony\Component\HttpKernel\Log; * DebugLoggerInterface. * * @author Fabien Potencier <fabien@symfony.com> + * + * @method clear() Removes all log records. */ interface DebugLoggerInterface { diff --git a/vendor/symfony/http-kernel/Log/Logger.php b/vendor/symfony/http-kernel/Log/Logger.php new file mode 100644 index 00000000..617efcf1 --- /dev/null +++ b/vendor/symfony/http-kernel/Log/Logger.php @@ -0,0 +1,111 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpKernel\Log; + +use Psr\Log\AbstractLogger; +use Psr\Log\InvalidArgumentException; +use Psr\Log\LogLevel; + +/** + * Minimalist PSR-3 logger designed to write in stderr or any other stream. + * + * @author Kévin Dunglas <dunglas@gmail.com> + */ +class Logger extends AbstractLogger +{ + private static $levels = array( + LogLevel::DEBUG => 0, + LogLevel::INFO => 1, + LogLevel::NOTICE => 2, + LogLevel::WARNING => 3, + LogLevel::ERROR => 4, + LogLevel::CRITICAL => 5, + LogLevel::ALERT => 6, + LogLevel::EMERGENCY => 7, + ); + + private $minLevelIndex; + private $formatter; + private $handle; + + public function __construct($minLevel = null, $output = 'php://stderr', callable $formatter = null) + { + if (null === $minLevel) { + $minLevel = LogLevel::WARNING; + + if (isset($_ENV['SHELL_VERBOSITY']) || isset($_SERVER['SHELL_VERBOSITY'])) { + switch ((int) (isset($_ENV['SHELL_VERBOSITY']) ? $_ENV['SHELL_VERBOSITY'] : $_SERVER['SHELL_VERBOSITY'])) { + case -1: $minLevel = LogLevel::ERROR; break; + case 1: $minLevel = LogLevel::NOTICE; break; + case 2: $minLevel = LogLevel::INFO; break; + case 3: $minLevel = LogLevel::DEBUG; break; + } + } + } + + if (!isset(self::$levels[$minLevel])) { + throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $minLevel)); + } + + $this->minLevelIndex = self::$levels[$minLevel]; + $this->formatter = $formatter ?: array($this, 'format'); + if (false === $this->handle = is_resource($output) ? $output : @fopen($output, 'a')) { + throw new InvalidArgumentException(sprintf('Unable to open "%s".', $output)); + } + } + + /** + * {@inheritdoc} + */ + public function log($level, $message, array $context = array()) + { + if (!isset(self::$levels[$level])) { + throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $level)); + } + + if (self::$levels[$level] < $this->minLevelIndex) { + return; + } + + $formatter = $this->formatter; + fwrite($this->handle, $formatter($level, $message, $context)); + } + + /** + * @param string $level + * @param string $message + * @param array $context + * + * @return string + */ + private function format($level, $message, array $context) + { + if (false !== strpos($message, '{')) { + $replacements = array(); + foreach ($context as $key => $val) { + if (null === $val || is_scalar($val) || (\is_object($val) && method_exists($val, '__toString'))) { + $replacements["{{$key}}"] = $val; + } elseif ($val instanceof \DateTimeInterface) { + $replacements["{{$key}}"] = $val->format(\DateTime::RFC3339); + } elseif (\is_object($val)) { + $replacements["{{$key}}"] = '[object '.\get_class($val).']'; + } else { + $replacements["{{$key}}"] = '['.\gettype($val).']'; + } + } + + $message = strtr($message, $replacements); + } + + return sprintf('%s [%s] %s', date(\DateTime::RFC3339), $level, $message).\PHP_EOL; + } +} diff --git a/vendor/symfony/http-kernel/Profiler/Profile.php b/vendor/symfony/http-kernel/Profiler/Profile.php index fba74ed8..c21c9d38 100644 --- a/vendor/symfony/http-kernel/Profiler/Profile.php +++ b/vendor/symfony/http-kernel/Profiler/Profile.php @@ -73,8 +73,6 @@ class Profile /** * Sets the parent token. - * - * @param Profile $parent */ public function setParent(Profile $parent) { @@ -166,7 +164,7 @@ class Profile } /** - * @param int The time + * @param int $time The time */ public function setTime($time) { @@ -214,8 +212,6 @@ class Profile /** * Adds the child token. - * - * @param Profile $child */ public function addChild(Profile $child) { @@ -266,8 +262,6 @@ class Profile /** * Adds a Collector. - * - * @param DataCollectorInterface $collector A DataCollectorInterface instance */ public function addCollector(DataCollectorInterface $collector) { diff --git a/vendor/symfony/http-kernel/Profiler/Profiler.php b/vendor/symfony/http-kernel/Profiler/Profiler.php index 2580b4ff..15bfbc5a 100644 --- a/vendor/symfony/http-kernel/Profiler/Profiler.php +++ b/vendor/symfony/http-kernel/Profiler/Profiler.php @@ -25,9 +25,6 @@ use Psr\Log\LoggerInterface; */ class Profiler { - /** - * @var ProfilerStorageInterface - */ private $storage; /** @@ -35,24 +32,18 @@ class Profiler */ private $collectors = array(); - /** - * @var LoggerInterface - */ private $logger; - - /** - * @var bool - */ + private $initiallyEnabled = true; private $enabled = true; /** - * @param ProfilerStorageInterface $storage A ProfilerStorageInterface instance - * @param LoggerInterface $logger A LoggerInterface instance + * @param bool $enable The initial enabled state */ - public function __construct(ProfilerStorageInterface $storage, LoggerInterface $logger = null) + public function __construct(ProfilerStorageInterface $storage, LoggerInterface $logger = null, $enable = true) { $this->storage = $storage; $this->logger = $logger; + $this->initiallyEnabled = $this->enabled = (bool) $enable; } /** @@ -74,8 +65,6 @@ class Profiler /** * Loads the Profile for the given Response. * - * @param Response $response A Response instance - * * @return Profile|false A Profile instance */ public function loadProfileFromResponse(Response $response) @@ -102,8 +91,6 @@ class Profiler /** * Saves a Profile. * - * @param Profile $profile A Profile instance - * * @return bool */ public function saveProfile(Profile $profile) @@ -153,10 +140,6 @@ class Profiler /** * Collects data for the given Response. * - * @param Request $request A Request instance - * @param Response $response A Response instance - * @param \Exception $exception An exception instance if the request threw one - * * @return Profile|null A Profile instance or null if the profiler is disabled */ public function collect(Request $request, Response $response, \Exception $exception = null) @@ -188,6 +171,18 @@ class Profiler return $profile; } + public function reset() + { + foreach ($this->collectors as $collector) { + if (!method_exists($collector, 'reset')) { + continue; + } + + $collector->reset(); + } + $this->enabled = $this->initiallyEnabled; + } + /** * Gets the Collectors associated with this profiler. * @@ -213,11 +208,13 @@ class Profiler /** * Adds a Collector. - * - * @param DataCollectorInterface $collector A DataCollectorInterface instance */ public function add(DataCollectorInterface $collector) { + if (!method_exists($collector, 'reset')) { + @trigger_error(sprintf('Implementing "%s" without the "reset()" method is deprecated since Symfony 3.4 and will be unsupported in 4.0 for class "%s".', DataCollectorInterface::class, \get_class($collector)), E_USER_DEPRECATED); + } + $this->collectors[$collector->getName()] = $collector; } diff --git a/vendor/symfony/http-kernel/Profiler/ProfilerStorageInterface.php b/vendor/symfony/http-kernel/Profiler/ProfilerStorageInterface.php index ea72af23..544fb1fe 100644 --- a/vendor/symfony/http-kernel/Profiler/ProfilerStorageInterface.php +++ b/vendor/symfony/http-kernel/Profiler/ProfilerStorageInterface.php @@ -46,8 +46,6 @@ interface ProfilerStorageInterface /** * Saves a Profile. * - * @param Profile $profile A Profile instance - * * @return bool Write operation successful */ public function write(Profile $profile); diff --git a/vendor/symfony/http-kernel/RebootableInterface.php b/vendor/symfony/http-kernel/RebootableInterface.php new file mode 100644 index 00000000..58d9ef59 --- /dev/null +++ b/vendor/symfony/http-kernel/RebootableInterface.php @@ -0,0 +1,30 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpKernel; + +/** + * Allows the Kernel to be rebooted using a temporary cache directory. + * + * @author Nicolas Grekas <p@tchwork.com> + */ +interface RebootableInterface +{ + /** + * Reboots a kernel. + * + * The getCacheDir() method of a rebootable kernel should not be called + * while building the container. Use the %kernel.cache_dir% parameter instead. + * + * @param string|null $warmupDir pass null to reboot in the regular cache directory + */ + public function reboot($warmupDir); +} diff --git a/vendor/symfony/http-kernel/Resources/welcome.html.php b/vendor/symfony/http-kernel/Resources/welcome.html.php new file mode 100644 index 00000000..d8c37beb --- /dev/null +++ b/vendor/symfony/http-kernel/Resources/welcome.html.php @@ -0,0 +1,84 @@ +<!DOCTYPE html> +<html> +<head> + <meta charset="UTF-8" /> + <title>Welcome!</title> + <style> + body { background: #F5F5F5; font: 18px/1.5 sans-serif; } + h1, h2 { line-height: 1.2; margin: 0 0 .5em; } + h1 { font-size: 36px; } + h2 { font-size: 21px; margin-bottom: 1em; } + p { margin: 0 0 1em 0; } + a { color: #0000F0; } + a:hover { text-decoration: none; } + code { background: #F5F5F5; max-width: 100px; padding: 2px 6px; word-wrap: break-word; } + #wrapper { background: #FFF; margin: 1em auto; max-width: 800px; width: 95%; } + #container { padding: 2em; } + #welcome, #status { margin-bottom: 2em; } + #welcome h1 span { display: block; font-size: 75%; } + #comment { font-size: 14px; text-align: center; color: #777777; background: #FEFFEA; padding: 10px; } + #comment p { margin-bottom: 0; } + #icon-status, #icon-book { float: left; height: 64px; margin-right: 1em; margin-top: -4px; width: 64px; } + #icon-book { display: none; } + + @media (min-width: 768px) { + #wrapper { width: 80%; margin: 2em auto; } + #icon-book { display: inline-block; } + #status a, #next a { display: block; } + + @-webkit-keyframes fade-in { 0% { opacity: 0; } 100% { opacity: 1; } } + @keyframes fade-in { 0% { opacity: 0; } 100% { opacity: 1; } } + .sf-toolbar { opacity: 0; -webkit-animation: fade-in 1s .2s forwards; animation: fade-in 1s .2s forwards;} + } + </style> +</head> +<body> +<div id="wrapper"> + <div id="container"> + <div id="welcome"> + <h1><span>Welcome to</span> Symfony <?php echo $version; ?></h1> + </div> + + <div id="status"> + <p> + <svg id="icon-status" width="1792" height="1792" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1671 566q0 40-28 68l-724 724-136 136q-28 28-68 28t-68-28l-136-136-362-362q-28-28-28-68t28-68l136-136q28-28 68-28t68 28l294 295 656-657q28-28 68-28t68 28l136 136q28 28 28 68z" fill="#759E1A"/></svg> + + Your application is now ready. You can start working on it at:<br> + <code><?php echo $baseDir; ?></code> + </p> + </div> + + <div id="next"> + <h2>What's next?</h2> + <p> + <svg id="icon-book" version="1.1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="-12.5 9 64 64" enable-background="new -12.5 9 64 64" xml:space="preserve"> + <path fill="#AAA" d="M6.8,40.8c2.4,0.8,4.5-0.7,4.9-2.5c0.2-1.2-0.3-2.1-1.3-3.2l-0.8-0.8c-0.4-0.5-0.6-1.3-0.2-1.9 + c0.4-0.5,0.9-0.8,1.8-0.5c1.3,0.4,1.9,1.3,2.9,2.2c-0.4,1.4-0.7,2.9-0.9,4.2l-0.2,1c-0.7,4-1.3,6.2-2.7,7.5 + c-0.3,0.3-0.7,0.5-1.3,0.6c-0.3,0-0.4-0.3-0.4-0.3c0-0.3,0.2-0.3,0.3-0.4c0.2-0.1,0.5-0.3,0.4-0.8c0-0.7-0.6-1.3-1.3-1.3 + c-0.6,0-1.4,0.6-1.4,1.7s1,1.9,2.4,1.8c0.8,0,2.5-0.3,4.2-2.5c2-2.5,2.5-5.4,2.9-7.4l0.5-2.8c0.3,0,0.5,0.1,0.8,0.1 + c2.4,0.1,3.7-1.3,3.7-2.3c0-0.6-0.3-1.2-0.9-1.2c-0.4,0-0.8,0.3-1,0.8c-0.1,0.6,0.8,1.1,0.1,1.5c-0.5,0.3-1.4,0.6-2.7,0.4l0.3-1.3 + c0.5-2.6,1-5.7,3.2-5.8c0.2,0,0.8,0,0.8,0.4c0,0.2,0,0.2-0.2,0.5c-0.2,0.3-0.3,0.4-0.2,0.7c0,0.7,0.5,1.1,1.2,1.1 + c0.9,0,1.2-1,1.2-1.4c0-1.2-1.2-1.8-2.6-1.8c-1.5,0.1-2.8,0.9-3.7,2.1c-1.1,1.3-1.8,2.9-2.3,4.5c-0.9-0.8-1.6-1.8-3.1-2.3 + c-1.1-0.7-2.3-0.5-3.4,0.3c-0.5,0.4-0.8,1-1,1.6c-0.4,1.5,0.4,2.9,0.8,3.4l0.9,1c0.2,0.2,0.6,0.8,0.4,1.5c-0.3,0.8-1.2,1.3-2.1,1 + c-0.4-0.2-1-0.5-0.9-0.9c0.1-0.2,0.2-0.3,0.3-0.5s0.1-0.3,0.1-0.3c0.2-0.6-0.1-1.4-0.7-1.6c-0.6-0.2-1.2,0-1.3,0.8 + C4.3,38.4,4.7,40,6.8,40.8z M46.1,20.9c0-4.2-3.2-7.5-7.1-7.5h-3.8C34.8,10.8,32.7,9,30.2,9L-2.3,9.1c-2.8,0.1-4.9,2.4-4.9,5.4 + L-7,58.6c0,4.8,8.1,13.9,11.6,14.1l34.7-0.1c3.9,0,7-3.4,7-7.6L46.1,20.9z M-0.3,36.4c0-8.6,6.5-15.6,14.5-15.6 + c8,0,14.5,7,14.5,15.6S22.1,52,14.2,52C6.1,52-0.3,45-0.3,36.4z M42.1,65.1c0,1.8-1.5,3.1-3.1,3.1H4.6c-0.7,0-3-1.8-4.5-4.4h30.4 + c2.8,0,5-2.4,5-5.4V17.9h3.7c1.6,0,2.9,1.4,2.9,3.1V65.1L42.1,65.1z"/> + </svg> + + Read the documentation to learn + <a href="https://symfony.com/doc/<?php echo $docVersion; ?>/page_creation.html"> + How to create your first page in Symfony + </a> + </p> + </div> + </div> + <div id="comment"> + <p> + You're seeing this message because you have debug mode enabled and you haven't configured any URLs. + </p> + </div> +</div> +</body> +</html> diff --git a/vendor/symfony/http-kernel/TerminableInterface.php b/vendor/symfony/http-kernel/TerminableInterface.php index d55a15b8..8aa33197 100644 --- a/vendor/symfony/http-kernel/TerminableInterface.php +++ b/vendor/symfony/http-kernel/TerminableInterface.php @@ -27,9 +27,6 @@ interface TerminableInterface * Terminates a request/response cycle. * * Should be called after sending the response and before shutting down the kernel. - * - * @param Request $request A Request instance - * @param Response $response A Response instance */ public function terminate(Request $request, Response $response); } diff --git a/vendor/symfony/http-kernel/Tests/Bundle/BundleTest.php b/vendor/symfony/http-kernel/Tests/Bundle/BundleTest.php index eeefccab..8e52b097 100644 --- a/vendor/symfony/http-kernel/Tests/Bundle/BundleTest.php +++ b/vendor/symfony/http-kernel/Tests/Bundle/BundleTest.php @@ -31,6 +31,10 @@ class BundleTest extends TestCase ); } + /** + * @group legacy + * @expectedDeprecation Auto-registration of the command "Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionPresentBundle\Command\FooCommand" is deprecated since Symfony 3.4 and won't be supported in 4.0. Use PSR-4 based service discovery instead. + */ public function testRegisterCommands() { $cmd = new FooCommand(); diff --git a/vendor/symfony/http-kernel/Tests/CacheClearer/ChainCacheClearerTest.php b/vendor/symfony/http-kernel/Tests/CacheClearer/ChainCacheClearerTest.php index 1bc85334..ec2ecff9 100644 --- a/vendor/symfony/http-kernel/Tests/CacheClearer/ChainCacheClearerTest.php +++ b/vendor/symfony/http-kernel/Tests/CacheClearer/ChainCacheClearerTest.php @@ -39,6 +39,9 @@ class ChainCacheClearerTest extends TestCase $chainClearer->clear(self::$cacheDir); } + /** + * @group legacy + */ public function testInjectClearerUsingAdd() { $clearer = $this->getMockClearer(); diff --git a/vendor/symfony/http-kernel/Tests/CacheClearer/Psr6CacheClearerTest.php b/vendor/symfony/http-kernel/Tests/CacheClearer/Psr6CacheClearerTest.php index a5d9b6ef..3e20efbf 100644 --- a/vendor/symfony/http-kernel/Tests/CacheClearer/Psr6CacheClearerTest.php +++ b/vendor/symfony/http-kernel/Tests/CacheClearer/Psr6CacheClearerTest.php @@ -48,7 +48,7 @@ class Psr6CacheClearerTest extends TestCase /** * @group legacy - * @expectedDeprecation The Symfony\Component\HttpKernel\CacheClearer\Psr6CacheClearer::addPool() method is deprecated since version 3.3 and will be removed in 4.0. Pass an array of pools indexed by name to the constructor instead. + * @expectedDeprecation The Symfony\Component\HttpKernel\CacheClearer\Psr6CacheClearer::addPool() method is deprecated since Symfony 3.3 and will be removed in 4.0. Pass an array of pools indexed by name to the constructor instead. */ public function testClearPoolsInjectedByAdder() { diff --git a/vendor/symfony/http-kernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php b/vendor/symfony/http-kernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php index d07ade30..ba159124 100644 --- a/vendor/symfony/http-kernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php +++ b/vendor/symfony/http-kernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php @@ -38,6 +38,9 @@ class CacheWarmerAggregateTest extends TestCase $aggregate->warmUp(self::$cacheDir); } + /** + * @group legacy + */ public function testInjectWarmersUsingAdd() { $warmer = $this->getCacheWarmerMock(); @@ -49,6 +52,9 @@ class CacheWarmerAggregateTest extends TestCase $aggregate->warmUp(self::$cacheDir); } + /** + * @group legacy + */ public function testInjectWarmersUsingSetWarmers() { $warmer = $this->getCacheWarmerMock(); diff --git a/vendor/symfony/http-kernel/Tests/Config/EnvParametersResourceTest.php b/vendor/symfony/http-kernel/Tests/Config/EnvParametersResourceTest.php index 6fe8a675..986e05d8 100644 --- a/vendor/symfony/http-kernel/Tests/Config/EnvParametersResourceTest.php +++ b/vendor/symfony/http-kernel/Tests/Config/EnvParametersResourceTest.php @@ -14,6 +14,9 @@ namespace Symfony\Component\HttpKernel\Tests\Config; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpKernel\Config\EnvParametersResource; +/** + * @group legacy + */ class EnvParametersResourceTest extends TestCase { protected $prefix = '__DUMMY_'; diff --git a/vendor/symfony/http-kernel/Tests/Controller/ArgumentResolver/ServiceValueResolverTest.php b/vendor/symfony/http-kernel/Tests/Controller/ArgumentResolver/ServiceValueResolverTest.php new file mode 100644 index 00000000..b05828f5 --- /dev/null +++ b/vendor/symfony/http-kernel/Tests/Controller/ArgumentResolver/ServiceValueResolverTest.php @@ -0,0 +1,93 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpKernel\Tests\Controller\ArgumentResolver; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\DependencyInjection\ServiceLocator; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\Controller\ArgumentResolver\ServiceValueResolver; +use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata; + +class ServiceValueResolverTest extends TestCase +{ + public function testDoNotSupportWhenControllerDoNotExists() + { + $resolver = new ServiceValueResolver(new ServiceLocator(array())); + $argument = new ArgumentMetadata('dummy', DummyService::class, false, false, null); + $request = $this->requestWithAttributes(array('_controller' => 'my_controller')); + + $this->assertFalse($resolver->supports($request, $argument)); + } + + public function testExistingController() + { + $resolver = new ServiceValueResolver(new ServiceLocator(array( + 'App\\Controller\\Mine::method' => function () { + return new ServiceLocator(array( + 'dummy' => function () { + return new DummyService(); + }, + )); + }, + ))); + + $request = $this->requestWithAttributes(array('_controller' => 'App\\Controller\\Mine::method')); + $argument = new ArgumentMetadata('dummy', DummyService::class, false, false, null); + + $this->assertTrue($resolver->supports($request, $argument)); + $this->assertYieldEquals(array(new DummyService()), $resolver->resolve($request, $argument)); + } + + public function testControllerNameIsAnArray() + { + $resolver = new ServiceValueResolver(new ServiceLocator(array( + 'App\\Controller\\Mine::method' => function () { + return new ServiceLocator(array( + 'dummy' => function () { + return new DummyService(); + }, + )); + }, + ))); + + $request = $this->requestWithAttributes(array('_controller' => array('App\\Controller\\Mine', 'method'))); + $argument = new ArgumentMetadata('dummy', DummyService::class, false, false, null); + + $this->assertTrue($resolver->supports($request, $argument)); + $this->assertYieldEquals(array(new DummyService()), $resolver->resolve($request, $argument)); + } + + private function requestWithAttributes(array $attributes) + { + $request = Request::create('/'); + + foreach ($attributes as $name => $value) { + $request->attributes->set($name, $value); + } + + return $request; + } + + private function assertYieldEquals(array $expected, \Generator $generator) + { + $args = array(); + foreach ($generator as $arg) { + $args[] = $arg; + } + + $this->assertEquals($expected, $args); + } +} + +class DummyService +{ +} diff --git a/vendor/symfony/http-kernel/Tests/Controller/ContainerControllerResolverTest.php b/vendor/symfony/http-kernel/Tests/Controller/ContainerControllerResolverTest.php index b3deb03c..0019123b 100644 --- a/vendor/symfony/http-kernel/Tests/Controller/ContainerControllerResolverTest.php +++ b/vendor/symfony/http-kernel/Tests/Controller/ContainerControllerResolverTest.php @@ -13,6 +13,8 @@ namespace Symfony\Component\HttpKernel\Tests\Controller; use Psr\Container\ContainerInterface; use Psr\Log\LoggerInterface; +use Symfony\Component\Debug\ErrorHandler; +use Symfony\Component\DependencyInjection\Container; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Controller\ContainerControllerResolver; @@ -21,6 +23,10 @@ class ContainerControllerResolverTest extends ControllerResolverTest public function testGetControllerService() { $container = $this->createMockContainer(); + $container->expects($this->once()) + ->method('has') + ->with('foo') + ->will($this->returnValue(true)); $container->expects($this->once()) ->method('get') ->with('foo') @@ -106,6 +112,48 @@ class ContainerControllerResolverTest extends ControllerResolverTest $this->assertSame(array(NonInstantiableController::class, 'action'), $controller); } + /** + * @expectedException \LogicException + * @expectedExceptionMessage Controller "Symfony\Component\HttpKernel\Tests\Controller\ImpossibleConstructController" cannot be fetched from the container because it is private. Did you forget to tag the service with "controller.service_arguments"? + */ + public function testNonConstructController() + { + $container = $this->getMockBuilder(Container::class)->getMock(); + $container->expects($this->at(0)) + ->method('has') + ->with(ImpossibleConstructController::class) + ->will($this->returnValue(true)) + ; + + $container->expects($this->at(1)) + ->method('has') + ->with(ImpossibleConstructController::class) + ->will($this->returnValue(false)) + ; + + $container->expects($this->atLeastOnce()) + ->method('getRemovedIds') + ->with() + ->will($this->returnValue(array(ImpossibleConstructController::class => true))) + ; + + $resolver = $this->createControllerResolver(null, $container); + $request = Request::create('/'); + $request->attributes->set('_controller', array(ImpossibleConstructController::class, 'action')); + + if (\PHP_VERSION_ID < 70100) { + ErrorHandler::register(); + try { + $resolver->getController($request); + } finally { + restore_error_handler(); + restore_exception_handler(); + } + } else { + $resolver->getController($request); + } + } + public function testNonInstantiableControllerWithCorrespondingService() { $service = new \stdClass(); @@ -131,6 +179,57 @@ class ContainerControllerResolverTest extends ControllerResolverTest $this->assertSame(array($service, 'action'), $controller); } + /** + * @expectedException \LogicException + * @expectedExceptionMessage Controller "app.my_controller" cannot be fetched from the container because it is private. Did you forget to tag the service with "controller.service_arguments"? + */ + public function testExceptionWhenUsingRemovedControllerService() + { + $container = $this->getMockBuilder(Container::class)->getMock(); + $container->expects($this->at(0)) + ->method('has') + ->with('app.my_controller') + ->will($this->returnValue(false)) + ; + + $container->expects($this->atLeastOnce()) + ->method('getRemovedIds') + ->with() + ->will($this->returnValue(array('app.my_controller' => true))) + ; + + $resolver = $this->createControllerResolver(null, $container); + + $request = Request::create('/'); + $request->attributes->set('_controller', 'app.my_controller'); + $resolver->getController($request); + } + + /** + * @expectedException \LogicException + * @expectedExceptionMessage Controller "app.my_controller" cannot be called without a method name. Did you forget an "__invoke" method? + */ + public function testExceptionWhenUsingControllerWithoutAnInvokeMethod() + { + $container = $this->getMockBuilder(Container::class)->getMock(); + $container->expects($this->once()) + ->method('has') + ->with('app.my_controller') + ->will($this->returnValue(true)) + ; + $container->expects($this->once()) + ->method('get') + ->with('app.my_controller') + ->will($this->returnValue(new ImpossibleConstructController('toto', 'controller'))) + ; + + $resolver = $this->createControllerResolver(null, $container); + + $request = Request::create('/'); + $request->attributes->set('_controller', 'app.my_controller'); + $resolver->getController($request); + } + /** * @dataProvider getUndefinedControllers */ @@ -153,9 +252,9 @@ class ContainerControllerResolverTest extends ControllerResolverTest public function getUndefinedControllers() { return array( - array('foo', \LogicException::class, '/Unable to parse the controller name "foo"\./'), + array('foo', \LogicException::class, '/Controller not found: service "foo" does not exist\./'), array('oof::bar', \InvalidArgumentException::class, '/Class "oof" does not exist\./'), - array('stdClass', \LogicException::class, '/Unable to parse the controller name "stdClass"\./'), + array('stdClass', \LogicException::class, '/Controller not found: service "stdClass" does not exist\./'), array( 'Symfony\Component\HttpKernel\Tests\Controller\ControllerResolverTest::bar', \InvalidArgumentException::class, @@ -196,3 +295,14 @@ abstract class NonInstantiableController { } } + +class ImpossibleConstructController +{ + public function __construct($toto, $controller) + { + } + + public function action() + { + } +} diff --git a/vendor/symfony/http-kernel/Tests/DataCollector/DumpDataCollectorTest.php b/vendor/symfony/http-kernel/Tests/DataCollector/DumpDataCollectorTest.php index e642e3c3..fc4b92b5 100644 --- a/vendor/symfony/http-kernel/Tests/DataCollector/DumpDataCollectorTest.php +++ b/vendor/symfony/http-kernel/Tests/DataCollector/DumpDataCollectorTest.php @@ -35,7 +35,7 @@ class DumpDataCollectorTest extends TestCase $this->assertSame(1, $collector->getDumpsCount()); $dump = $collector->getDumps('html'); - $this->assertTrue(isset($dump[0]['data'])); + $this->assertArrayHasKey('data', $dump[0]); $dump[0]['data'] = preg_replace('/^.*?<pre/', '<pre', $dump[0]['data']); $dump[0]['data'] = preg_replace('/sf-dump-\d+/', 'sf-dump', $dump[0]['data']); diff --git a/vendor/symfony/http-kernel/Tests/DataCollector/ExceptionDataCollectorTest.php b/vendor/symfony/http-kernel/Tests/DataCollector/ExceptionDataCollectorTest.php index afad9f58..178f1f01 100644 --- a/vendor/symfony/http-kernel/Tests/DataCollector/ExceptionDataCollectorTest.php +++ b/vendor/symfony/http-kernel/Tests/DataCollector/ExceptionDataCollectorTest.php @@ -37,4 +37,23 @@ class ExceptionDataCollectorTest extends TestCase $this->assertSame('exception', $c->getName()); $this->assertSame($trace, $c->getTrace()); } + + public function testCollectWithoutException() + { + $c = new ExceptionDataCollector(); + $c->collect(new Request(), new Response()); + + $this->assertFalse($c->hasException()); + } + + public function testReset() + { + $c = new ExceptionDataCollector(); + + $c->collect(new Request(), new Response(), new \Exception()); + $c->reset(); + $c->collect(new Request(), new Response()); + + $this->assertFalse($c->hasException()); + } } diff --git a/vendor/symfony/http-kernel/Tests/DataCollector/LoggerDataCollectorTest.php b/vendor/symfony/http-kernel/Tests/DataCollector/LoggerDataCollectorTest.php index 62bf2c00..3dec3bd7 100644 --- a/vendor/symfony/http-kernel/Tests/DataCollector/LoggerDataCollectorTest.php +++ b/vendor/symfony/http-kernel/Tests/DataCollector/LoggerDataCollectorTest.php @@ -19,7 +19,10 @@ class LoggerDataCollectorTest extends TestCase { public function testCollectWithUnexpectedFormat() { - $logger = $this->getMockBuilder('Symfony\Component\HttpKernel\Log\DebugLoggerInterface')->getMock(); + $logger = $this + ->getMockBuilder('Symfony\Component\HttpKernel\Log\DebugLoggerInterface') + ->setMethods(array('countErrors', 'getLogs', 'clear')) + ->getMock(); $logger->expects($this->once())->method('countErrors')->will($this->returnValue('foo')); $logger->expects($this->exactly(2))->method('getLogs')->will($this->returnValue(array())); @@ -43,7 +46,10 @@ class LoggerDataCollectorTest extends TestCase */ public function testCollect($nb, $logs, $expectedLogs, $expectedDeprecationCount, $expectedScreamCount, $expectedPriorities = null) { - $logger = $this->getMockBuilder('Symfony\Component\HttpKernel\Log\DebugLoggerInterface')->getMock(); + $logger = $this + ->getMockBuilder('Symfony\Component\HttpKernel\Log\DebugLoggerInterface') + ->setMethods(array('countErrors', 'getLogs', 'clear')) + ->getMock(); $logger->expects($this->once())->method('countErrors')->will($this->returnValue($nb)); $logger->expects($this->exactly(2))->method('getLogs')->will($this->returnValue($logs)); @@ -70,6 +76,18 @@ class LoggerDataCollectorTest extends TestCase } } + public function testReset() + { + $logger = $this + ->getMockBuilder('Symfony\Component\HttpKernel\Log\DebugLoggerInterface') + ->setMethods(array('countErrors', 'getLogs', 'clear')) + ->getMock(); + $logger->expects($this->once())->method('clear'); + + $c = new LoggerDataCollector($logger); + $c->reset(); + } + public function getCollectTestData() { yield 'simple log' => array( diff --git a/vendor/symfony/http-kernel/Tests/DataCollector/RequestDataCollectorTest.php b/vendor/symfony/http-kernel/Tests/DataCollector/RequestDataCollectorTest.php index 93767b96..69bef76d 100644 --- a/vendor/symfony/http-kernel/Tests/DataCollector/RequestDataCollectorTest.php +++ b/vendor/symfony/http-kernel/Tests/DataCollector/RequestDataCollectorTest.php @@ -71,20 +71,6 @@ class RequestDataCollectorTest extends TestCase $this->assertEquals(array(), $c->getRouteParams()); } - public function testKernelResponseDoesNotStartSession() - { - $kernel = $this->getMockBuilder(HttpKernelInterface::class)->getMock(); - $request = new Request(); - $session = new Session(new MockArraySessionStorage()); - $request->setSession($session); - $response = new Response(); - - $c = new RequestDataCollector(); - $c->onKernelResponse(new FilterResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST, $response)); - - $this->assertFalse($session->isStarted()); - } - /** * @dataProvider provideControllerCallables */ @@ -210,6 +196,56 @@ class RequestDataCollectorTest extends TestCase $this->assertSame('n/a', $c->getController()); } + public function testItAddsRedirectedAttributesWhenRequestContainsSpecificCookie() + { + $request = $this->createRequest(); + $request->cookies->add(array( + 'sf_redirect' => '{}', + )); + + $kernel = $this->getMockBuilder(HttpKernelInterface::class)->getMock(); + + $c = new RequestDataCollector(); + $c->onKernelResponse(new FilterResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST, $this->createResponse())); + + $this->assertTrue($request->attributes->get('_redirected')); + } + + public function testItSetsARedirectCookieIfTheResponseIsARedirection() + { + $c = new RequestDataCollector(); + + $response = $this->createResponse(); + $response->setStatusCode(302); + $response->headers->set('Location', '/somewhere-else'); + + $c->collect($request = $this->createRequest(), $response); + $c->lateCollect(); + + $cookie = $this->getCookieByName($response, 'sf_redirect'); + + $this->assertNotEmpty($cookie->getValue()); + } + + public function testItCollectsTheRedirectionAndClearTheCookie() + { + $c = new RequestDataCollector(); + + $request = $this->createRequest(); + $request->attributes->set('_redirected', true); + $request->cookies->add(array( + 'sf_redirect' => '{"method": "POST"}', + )); + + $c->collect($request, $response = $this->createResponse()); + $c->lateCollect(); + + $this->assertEquals('POST', $c->getRedirect()['method']); + + $cookie = $this->getCookieByName($response, 'sf_redirect'); + $this->assertNull($cookie->getValue()); + } + protected function createRequest($routeParams = array('name' => 'foo')) { $request = Request::create('http://test.com/foo?bar=baz'); @@ -284,4 +320,15 @@ class RequestDataCollectorTest extends TestCase { throw new \LogicException('Unexpected method call'); } + + private function getCookieByName(Response $response, $name) + { + foreach ($response->headers->getCookies() as $cookie) { + if ($cookie->getName() == $name) { + return $cookie; + } + } + + throw new \InvalidArgumentException(sprintf('Cookie named "%s" is not in response', $name)); + } } diff --git a/vendor/symfony/http-kernel/Tests/DependencyInjection/LazyLoadingFragmentHandlerTest.php b/vendor/symfony/http-kernel/Tests/DependencyInjection/LazyLoadingFragmentHandlerTest.php index 0406345d..73021483 100644 --- a/vendor/symfony/http-kernel/Tests/DependencyInjection/LazyLoadingFragmentHandlerTest.php +++ b/vendor/symfony/http-kernel/Tests/DependencyInjection/LazyLoadingFragmentHandlerTest.php @@ -20,7 +20,7 @@ class LazyLoadingFragmentHandlerTest extends TestCase { /** * @group legacy - * @expectedDeprecation The Symfony\Component\HttpKernel\DependencyInjection\LazyLoadingFragmentHandler::addRendererService() method is deprecated since version 3.3 and will be removed in 4.0. + * @expectedDeprecation The Symfony\Component\HttpKernel\DependencyInjection\LazyLoadingFragmentHandler::addRendererService() method is deprecated since Symfony 3.3 and will be removed in 4.0. */ public function testRenderWithLegacyMapping() { diff --git a/vendor/symfony/http-kernel/Tests/DependencyInjection/LoggerPassTest.php b/vendor/symfony/http-kernel/Tests/DependencyInjection/LoggerPassTest.php new file mode 100644 index 00000000..b199e11d --- /dev/null +++ b/vendor/symfony/http-kernel/Tests/DependencyInjection/LoggerPassTest.php @@ -0,0 +1,56 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpKernel\Tests\DependencyInjection; + +use PHPUnit\Framework\TestCase; +use Psr\Log\LoggerInterface; +use Symfony\Component\HttpKernel\DependencyInjection\LoggerPass; +use Symfony\Component\HttpKernel\Log\Logger; +use Symfony\Component\DependencyInjection\ContainerBuilder; + +/** + * @author Kévin Dunglas <dunglas@gmail.com> + */ +class LoggerPassTest extends TestCase +{ + public function testAlwaysSetAutowiringAlias() + { + $container = new ContainerBuilder(); + $container->register('logger', 'Foo'); + + (new LoggerPass())->process($container); + + $this->assertFalse($container->getAlias(LoggerInterface::class)->isPublic()); + } + + public function testDoNotOverrideExistingLogger() + { + $container = new ContainerBuilder(); + $container->register('logger', 'Foo'); + + (new LoggerPass())->process($container); + + $this->assertSame('Foo', $container->getDefinition('logger')->getClass()); + } + + public function testRegisterLogger() + { + $container = new ContainerBuilder(); + $container->setParameter('kernel.debug', false); + + (new LoggerPass())->process($container); + + $definition = $container->getDefinition('logger'); + $this->assertSame(Logger::class, $definition->getClass()); + $this->assertFalse($definition->isPublic()); + } +} diff --git a/vendor/symfony/http-kernel/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php b/vendor/symfony/http-kernel/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php index 83a07cb4..4016deb4 100644 --- a/vendor/symfony/http-kernel/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php +++ b/vendor/symfony/http-kernel/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php @@ -19,6 +19,7 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ServiceLocator; use Symfony\Component\DependencyInjection\TypedReference; +use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\HttpKernel\DependencyInjection\RegisterControllerArgumentLocatorsPass; class RegisterControllerArgumentLocatorsPassTest extends TestCase @@ -281,6 +282,50 @@ class RegisterControllerArgumentLocatorsPassTest extends TestCase $this->assertTrue($container->getDefinition('foo')->isPublic()); } + + /** + * @dataProvider provideBindings + */ + public function testBindings($bindingName) + { + $container = new ContainerBuilder(); + $resolver = $container->register('argument_resolver.service')->addArgument(array()); + + $container->register('foo', RegisterTestController::class) + ->setBindings(array($bindingName => new Reference('foo'))) + ->addTag('controller.service_arguments'); + + $pass = new RegisterControllerArgumentLocatorsPass(); + $pass->process($container); + + $locator = $container->getDefinition((string) $resolver->getArgument(0))->getArgument(0); + + $locator = $container->getDefinition((string) $locator['foo:fooAction']->getValues()[0]); + + $expected = array('bar' => new ServiceClosureArgument(new Reference('foo'))); + $this->assertEquals($expected, $locator->getArgument(0)); + } + + public function provideBindings() + { + return array(array(ControllerDummy::class), array('$bar')); + } + + public function testDoNotBindScalarValueToControllerArgument() + { + $container = new ContainerBuilder(); + $resolver = $container->register('argument_resolver.service')->addArgument(array()); + + $container->register('foo', ArgumentWithoutTypeController::class) + ->setBindings(array('$someArg' => '%foo%')) + ->addTag('controller.service_arguments'); + + $pass = new RegisterControllerArgumentLocatorsPass(); + $pass->process($container); + + $locator = $container->getDefinition((string) $resolver->getArgument(0))->getArgument(0); + $this->assertEmpty($locator); + } } class RegisterTestController diff --git a/vendor/symfony/http-kernel/Tests/DependencyInjection/ResettableServicePassTest.php b/vendor/symfony/http-kernel/Tests/DependencyInjection/ResettableServicePassTest.php new file mode 100644 index 00000000..f7ea16db --- /dev/null +++ b/vendor/symfony/http-kernel/Tests/DependencyInjection/ResettableServicePassTest.php @@ -0,0 +1,78 @@ +<?php + +namespace Symfony\Component\HttpKernel\Tests\DependencyInjection; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\DependencyInjection\Argument\IteratorArgument; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\HttpKernel\DependencyInjection\ResettableServicePass; +use Symfony\Component\HttpKernel\DependencyInjection\ServicesResetter; +use Symfony\Component\HttpKernel\Tests\Fixtures\ClearableService; +use Symfony\Component\HttpKernel\Tests\Fixtures\ResettableService; + +class ResettableServicePassTest extends TestCase +{ + public function testCompilerPass() + { + $container = new ContainerBuilder(); + $container->register('one', ResettableService::class) + ->setPublic(true) + ->addTag('kernel.reset', array('method' => 'reset')); + $container->register('two', ClearableService::class) + ->setPublic(true) + ->addTag('kernel.reset', array('method' => 'clear')); + + $container->register('services_resetter', ServicesResetter::class) + ->setPublic(true) + ->setArguments(array(null, array())); + $container->addCompilerPass(new ResettableServicePass()); + + $container->compile(); + + $definition = $container->getDefinition('services_resetter'); + + $this->assertEquals( + array( + new IteratorArgument(array( + 'one' => new Reference('one', ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE), + 'two' => new Reference('two', ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE), + )), + array( + 'one' => 'reset', + 'two' => 'clear', + ), + ), + $definition->getArguments() + ); + } + + /** + * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException + * @expectedExceptionMessage Tag kernel.reset requires the "method" attribute to be set. + */ + public function testMissingMethod() + { + $container = new ContainerBuilder(); + $container->register(ResettableService::class) + ->addTag('kernel.reset'); + $container->register('services_resetter', ServicesResetter::class) + ->setArguments(array(null, array())); + $container->addCompilerPass(new ResettableServicePass()); + + $container->compile(); + } + + public function testCompilerPassWithoutResetters() + { + $container = new ContainerBuilder(); + $container->register('services_resetter', ServicesResetter::class) + ->setArguments(array(null, array())); + $container->addCompilerPass(new ResettableServicePass()); + + $container->compile(); + + $this->assertFalse($container->has('services_resetter')); + } +} diff --git a/vendor/symfony/http-kernel/Tests/DependencyInjection/ServicesResetterTest.php b/vendor/symfony/http-kernel/Tests/DependencyInjection/ServicesResetterTest.php new file mode 100644 index 00000000..47c62abd --- /dev/null +++ b/vendor/symfony/http-kernel/Tests/DependencyInjection/ServicesResetterTest.php @@ -0,0 +1,42 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpKernel\Tests\DependencyInjection; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\HttpKernel\DependencyInjection\ServicesResetter; +use Symfony\Component\HttpKernel\Tests\Fixtures\ClearableService; +use Symfony\Component\HttpKernel\Tests\Fixtures\ResettableService; + +class ServicesResetterTest extends TestCase +{ + protected function setUp() + { + ResettableService::$counter = 0; + ClearableService::$counter = 0; + } + + public function testResetServices() + { + $resetter = new ServicesResetter(new \ArrayIterator(array( + 'id1' => new ResettableService(), + 'id2' => new ClearableService(), + )), array( + 'id1' => 'reset', + 'id2' => 'clear', + )); + + $resetter->reset(); + + $this->assertEquals(1, ResettableService::$counter); + $this->assertEquals(1, ClearableService::$counter); + } +} diff --git a/vendor/symfony/http-kernel/Tests/Event/FilterControllerArgumentsEventTest.php b/vendor/symfony/http-kernel/Tests/Event/FilterControllerArgumentsEventTest.php new file mode 100644 index 00000000..9165d31f --- /dev/null +++ b/vendor/symfony/http-kernel/Tests/Event/FilterControllerArgumentsEventTest.php @@ -0,0 +1,17 @@ +<?php + +namespace Symfony\Component\HttpKernel\Tests\Event; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\Event\FilterControllerArgumentsEvent; +use PHPUnit\Framework\TestCase; +use Symfony\Component\HttpKernel\Tests\TestHttpKernel; + +class FilterControllerArgumentsEventTest extends TestCase +{ + public function testFilterControllerArgumentsEvent() + { + $filterController = new FilterControllerArgumentsEvent(new TestHttpKernel(), function () {}, array('test'), new Request(), 1); + $this->assertEquals($filterController->getArguments(), array('test')); + } +} diff --git a/vendor/symfony/http-kernel/Tests/EventListener/DebugHandlersListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/DebugHandlersListenerTest.php index d1349906..467b8dde 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/DebugHandlersListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/DebugHandlersListenerTest.php @@ -29,8 +29,6 @@ use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\KernelEvents; /** - * DebugHandlersListenerTest. - * * @author Nicolas Grekas <p@tchwork.com> */ class DebugHandlersListenerTest extends TestCase @@ -132,4 +130,26 @@ class DebugHandlersListenerTest extends TestCase $xHandler(new \Exception()); } + + public function testReplaceExistingExceptionHandler() + { + $userHandler = function () {}; + $listener = new DebugHandlersListener($userHandler); + $eHandler = new ErrorHandler(); + $eHandler->setExceptionHandler('var_dump'); + + $exception = null; + set_exception_handler(array($eHandler, 'handleException')); + try { + $listener->configure(); + } catch (\Exception $exception) { + } + restore_exception_handler(); + + if (null !== $exception) { + throw $exception; + } + + $this->assertSame($userHandler, $eHandler->setExceptionHandler('var_dump')); + } } diff --git a/vendor/symfony/http-kernel/Tests/EventListener/ExceptionListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/ExceptionListenerTest.php index f5501a3f..3cb0b298 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/ExceptionListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/ExceptionListenerTest.php @@ -12,8 +12,11 @@ namespace Symfony\Component\HttpKernel\Tests\EventListener; use PHPUnit\Framework\TestCase; +use Symfony\Component\EventDispatcher\EventDispatcher; +use Symfony\Component\HttpKernel\Event\FilterResponseEvent; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\EventListener\ExceptionListener; +use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\Log\DebugLoggerInterface; use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; use Symfony\Component\HttpFoundation\Request; @@ -96,8 +99,8 @@ class ExceptionListenerTest extends TestCase $request = new Request(); $exception = new \Exception('foo'); - $event = new GetResponseForExceptionEvent(new TestKernel(), $request, 'foo', $exception); - $event2 = new GetResponseForExceptionEvent(new TestKernelThatThrowsException(), $request, 'foo', $exception); + $event = new GetResponseForExceptionEvent(new TestKernel(), $request, HttpKernelInterface::MASTER_REQUEST, $exception); + $event2 = new GetResponseForExceptionEvent(new TestKernelThatThrowsException(), $request, HttpKernelInterface::MASTER_REQUEST, $exception); return array( array($event, $event2), @@ -116,12 +119,38 @@ class ExceptionListenerTest extends TestCase $request = Request::create('/'); $request->setRequestFormat('xml'); - $event = new GetResponseForExceptionEvent($kernel, $request, 'foo', new \Exception('foo')); + $event = new GetResponseForExceptionEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST, new \Exception('foo')); $listener->onKernelException($event); $response = $event->getResponse(); $this->assertEquals('xml', $response->getContent()); } + + public function testCSPHeaderIsRemoved() + { + $dispatcher = new EventDispatcher(); + $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); + $kernel->expects($this->once())->method('handle')->will($this->returnCallback(function (Request $request) { + return new Response($request->getRequestFormat()); + })); + + $listener = new ExceptionListener('foo', $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(), true); + + $dispatcher->addSubscriber($listener); + + $request = Request::create('/'); + $event = new GetResponseForExceptionEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST, new \Exception('foo')); + $dispatcher->dispatch(KernelEvents::EXCEPTION, $event); + + $response = new Response('', 200, array('content-security-policy' => "style-src 'self'")); + $this->assertTrue($response->headers->has('content-security-policy')); + + $event = new FilterResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST, $response); + $dispatcher->dispatch(KernelEvents::RESPONSE, $event); + + $this->assertFalse($response->headers->has('content-security-policy'), 'CSP header has been removed'); + $this->assertFalse($dispatcher->hasListeners(KernelEvents::RESPONSE), 'CSP removal listener has been removed'); + } } class TestLogger extends Logger implements DebugLoggerInterface diff --git a/vendor/symfony/http-kernel/Tests/EventListener/LocaleListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/LocaleListenerTest.php index 2ce32819..332393ee 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/LocaleListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/LocaleListenerTest.php @@ -38,8 +38,7 @@ class LocaleListenerTest extends TestCase public function testLocaleFromRequestAttribute() { $request = Request::create('/'); - session_name('foo'); - $request->cookies->set('foo', 'value'); + $request->cookies->set(session_name(), 'value'); $request->attributes->set('_locale', 'es'); $listener = new LocaleListener($this->requestStack, 'fr'); diff --git a/vendor/symfony/http-kernel/Tests/EventListener/RouterListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/RouterListenerTest.php index a40e5799..342dfc36 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/RouterListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/RouterListenerTest.php @@ -24,6 +24,7 @@ use Symfony\Component\HttpKernel\EventListener\ValidateRequestListener; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\HttpKernel; use Symfony\Component\HttpKernel\Event\GetResponseEvent; +use Symfony\Component\Routing\Exception\NoConfigurationException; use Symfony\Component\Routing\RequestContext; class RouterListenerTest extends TestCase @@ -185,4 +186,41 @@ class RouterListenerTest extends TestCase $response = $kernel->handle($request); $this->assertSame(400, $response->getStatusCode()); } + + public function testNoRoutingConfigurationResponse() + { + $requestStack = new RequestStack(); + + $requestMatcher = $this->getMockBuilder('Symfony\Component\Routing\Matcher\RequestMatcherInterface')->getMock(); + $requestMatcher + ->expects($this->once()) + ->method('matchRequest') + ->willThrowException(new NoConfigurationException()) + ; + + $dispatcher = new EventDispatcher(); + $dispatcher->addSubscriber(new RouterListener($requestMatcher, $requestStack, new RequestContext())); + + $kernel = new HttpKernel($dispatcher, new ControllerResolver(), $requestStack, new ArgumentResolver()); + + $request = Request::create('http://localhost/'); + $response = $kernel->handle($request); + $this->assertSame(404, $response->getStatusCode()); + $this->assertContains('Welcome', $response->getContent()); + } + + /** + * @expectedException \Symfony\Component\HttpKernel\Exception\BadRequestHttpException + */ + public function testRequestWithBadHost() + { + $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); + $request = Request::create('http://bad host %22/'); + $event = new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST); + + $requestMatcher = $this->getMockBuilder('Symfony\Component\Routing\Matcher\RequestMatcherInterface')->getMock(); + + $listener = new RouterListener($requestMatcher, $this->requestStack, new RequestContext()); + $listener->onKernelRequest($event); + } } diff --git a/vendor/symfony/http-kernel/Tests/EventListener/SaveSessionListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/SaveSessionListenerTest.php new file mode 100644 index 00000000..5492c3d7 --- /dev/null +++ b/vendor/symfony/http-kernel/Tests/EventListener/SaveSessionListenerTest.php @@ -0,0 +1,49 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpKernel\Tests\EventListener; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpFoundation\Session\SessionInterface; +use Symfony\Component\HttpKernel\Event\FilterResponseEvent; +use Symfony\Component\HttpKernel\EventListener\SaveSessionListener; +use Symfony\Component\HttpKernel\HttpKernelInterface; + +class SaveSessionListenerTest extends TestCase +{ + public function testOnlyTriggeredOnMasterRequest() + { + $listener = new SaveSessionListener(); + $event = $this->getMockBuilder(FilterResponseEvent::class)->disableOriginalConstructor()->getMock(); + $event->expects($this->once())->method('isMasterRequest')->willReturn(false); + $event->expects($this->never())->method('getRequest'); + + // sub request + $listener->onKernelResponse($event); + } + + public function testSessionSaved() + { + $listener = new SaveSessionListener(); + $kernel = $this->getMockBuilder(HttpKernelInterface::class)->disableOriginalConstructor()->getMock(); + + $session = $this->getMockBuilder(SessionInterface::class)->disableOriginalConstructor()->getMock(); + $session->expects($this->once())->method('isStarted')->willReturn(true); + $session->expects($this->once())->method('save'); + + $request = new Request(); + $request->setSession($session); + $response = new Response(); + $listener->onKernelResponse(new FilterResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST, $response)); + } +} diff --git a/vendor/symfony/http-kernel/Tests/EventListener/SessionListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/SessionListenerTest.php new file mode 100644 index 00000000..34598363 --- /dev/null +++ b/vendor/symfony/http-kernel/Tests/EventListener/SessionListenerTest.php @@ -0,0 +1,79 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpKernel\Tests\EventListener; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\DependencyInjection\Container; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpFoundation\Session\Session; +use Symfony\Component\HttpKernel\Event\GetResponseEvent; +use Symfony\Component\HttpKernel\Event\FilterResponseEvent; +use Symfony\Component\HttpKernel\EventListener\AbstractSessionListener; +use Symfony\Component\HttpKernel\EventListener\SessionListener; +use Symfony\Component\HttpKernel\HttpKernelInterface; + +class SessionListenerTest extends TestCase +{ + public function testOnlyTriggeredOnMasterRequest() + { + $listener = $this->getMockForAbstractClass(AbstractSessionListener::class); + $event = $this->getMockBuilder(GetResponseEvent::class)->disableOriginalConstructor()->getMock(); + $event->expects($this->once())->method('isMasterRequest')->willReturn(false); + $event->expects($this->never())->method('getRequest'); + + // sub request + $listener->onKernelRequest($event); + } + + public function testSessionIsSet() + { + $session = $this->getMockBuilder(Session::class)->disableOriginalConstructor()->getMock(); + + $container = new Container(); + $container->set('session', $session); + + $request = new Request(); + $listener = new SessionListener($container); + + $event = $this->getMockBuilder(GetResponseEvent::class)->disableOriginalConstructor()->getMock(); + $event->expects($this->once())->method('isMasterRequest')->willReturn(true); + $event->expects($this->once())->method('getRequest')->willReturn($request); + + $listener->onKernelRequest($event); + + $this->assertTrue($request->hasSession()); + $this->assertSame($session, $request->getSession()); + } + + public function testResponseIsPrivate() + { + $session = $this->getMockBuilder(Session::class)->disableOriginalConstructor()->getMock(); + $session->expects($this->once())->method('isStarted')->willReturn(false); + $session->expects($this->once())->method('hasBeenStarted')->willReturn(true); + + $container = new Container(); + $container->set('session', $session); + + $listener = new SessionListener($container); + $kernel = $this->getMockBuilder(HttpKernelInterface::class)->disableOriginalConstructor()->getMock(); + + $request = new Request(); + $response = new Response(); + $listener->onKernelRequest(new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST)); + $listener->onKernelResponse(new FilterResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST, $response)); + + $this->assertTrue($response->headers->hasCacheControlDirective('private')); + $this->assertTrue($response->headers->hasCacheControlDirective('must-revalidate')); + $this->assertSame('0', $response->headers->getCacheControlDirective('max-age')); + } +} diff --git a/vendor/symfony/http-kernel/Tests/EventListener/TestSessionListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/TestSessionListenerTest.php index 8ada8e7d..4452f487 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/TestSessionListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/TestSessionListenerTest.php @@ -65,8 +65,7 @@ class TestSessionListenerTest extends TestCase { $this->sessionHasBeenStarted(); - $params = session_get_cookie_params(); - session_set_cookie_params(0, $params['path'], $params['domain'], $params['secure'], $params['httponly']); + @ini_set('session.cookie_lifetime', 0); $response = $this->filterResponse(new Request(), HttpKernelInterface::MASTER_REQUEST); $cookies = $response->headers->getCookies(); @@ -74,6 +73,19 @@ class TestSessionListenerTest extends TestCase $this->assertEquals(0, reset($cookies)->getExpiresTime()); } + /** + * @requires function \Symfony\Component\HttpFoundation\Session\Session::isEmpty + */ + public function testEmptySessionDoesNotSendCookie() + { + $this->sessionHasBeenStarted(); + $this->sessionIsEmpty(); + + $response = $this->filterResponse(new Request(), HttpKernelInterface::MASTER_REQUEST); + + $this->assertSame(array(), $response->headers->getCookies()); + } + public function testUnstartedSessionIsNotSave() { $this->sessionHasNotBeenStarted(); @@ -131,6 +143,13 @@ class TestSessionListenerTest extends TestCase ->will($this->returnValue(false)); } + private function sessionIsEmpty() + { + $this->session->expects($this->once()) + ->method('isEmpty') + ->will($this->returnValue(true)); + } + private function getSession() { $mock = $this->getMockBuilder('Symfony\Component\HttpFoundation\Session\Session') diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/ClearableService.php b/vendor/symfony/http-kernel/Tests/Fixtures/ClearableService.php new file mode 100644 index 00000000..35acb419 --- /dev/null +++ b/vendor/symfony/http-kernel/Tests/Fixtures/ClearableService.php @@ -0,0 +1,13 @@ +<?php + +namespace Symfony\Component\HttpKernel\Tests\Fixtures; + +class ClearableService +{ + public static $counter = 0; + + public function clear() + { + ++self::$counter; + } +} diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/DataCollector/CloneVarDataCollector.php b/vendor/symfony/http-kernel/Tests/Fixtures/DataCollector/CloneVarDataCollector.php index 867ccdce..89dec36a 100644 --- a/vendor/symfony/http-kernel/Tests/Fixtures/DataCollector/CloneVarDataCollector.php +++ b/vendor/symfony/http-kernel/Tests/Fixtures/DataCollector/CloneVarDataCollector.php @@ -29,6 +29,11 @@ class CloneVarDataCollector extends DataCollector $this->data = $this->cloneVar($this->varToClone); } + public function reset() + { + $this->data = array(); + } + public function getData() { return $this->data; diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/ResettableService.php b/vendor/symfony/http-kernel/Tests/Fixtures/ResettableService.php new file mode 100644 index 00000000..ffb72a35 --- /dev/null +++ b/vendor/symfony/http-kernel/Tests/Fixtures/ResettableService.php @@ -0,0 +1,13 @@ +<?php + +namespace Symfony\Component\HttpKernel\Tests\Fixtures; + +class ResettableService +{ + public static $counter = 0; + + public function reset() + { + ++self::$counter; + } +} diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/TestEventDispatcher.php b/vendor/symfony/http-kernel/Tests/Fixtures/TestEventDispatcher.php index da7ef5bd..ca2e6a69 100644 --- a/vendor/symfony/http-kernel/Tests/Fixtures/TestEventDispatcher.php +++ b/vendor/symfony/http-kernel/Tests/Fixtures/TestEventDispatcher.php @@ -25,4 +25,8 @@ class TestEventDispatcher extends EventDispatcher implements TraceableEventDispa { return array('bar'); } + + public function reset() + { + } } diff --git a/vendor/symfony/http-kernel/Tests/Fragment/EsiFragmentRendererTest.php b/vendor/symfony/http-kernel/Tests/Fragment/EsiFragmentRendererTest.php index bfe922e2..7099b4d7 100644 --- a/vendor/symfony/http-kernel/Tests/Fragment/EsiFragmentRendererTest.php +++ b/vendor/symfony/http-kernel/Tests/Fragment/EsiFragmentRendererTest.php @@ -34,7 +34,15 @@ class EsiFragmentRendererTest extends TestCase { $strategy = new EsiFragmentRenderer(new Esi(), $this->getInlineStrategy(true), new UriSigner('foo')); $request = Request::create('/'); - $reference = new ControllerReference('main_controller', array('foo' => array('a' => array(), 'b' => new \stdClass())), array()); + $reference = new ControllerReference('main_controller', array('foo' => new \stdClass()), array()); + $strategy->render($reference, $request); + } + + public function testRenderFallbackWithScalarIsNotDeprecated() + { + $strategy = new EsiFragmentRenderer(new Esi(), $this->getInlineStrategy(true), new UriSigner('foo')); + $request = Request::create('/'); + $reference = new ControllerReference('main_controller', array('foo' => array(true)), array()); $strategy->render($reference, $request); } diff --git a/vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTest.php b/vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTest.php index 4664ea90..2a9a30d9 100644 --- a/vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTest.php +++ b/vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTest.php @@ -530,8 +530,8 @@ class HttpCacheTest extends HttpCacheTestCase $this->request('GET', '/'); $this->assertHttpKernelIsNotCalled(); $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertTrue(strtotime($this->responses[0]->headers->get('Date')) - strtotime($this->response->headers->get('Date')) < 2); - $this->assertTrue($this->response->headers->get('Age') > 0); + $this->assertLessThan(2, strtotime($this->responses[0]->headers->get('Date')) - strtotime($this->response->headers->get('Date'))); + $this->assertGreaterThan(0, $this->response->headers->get('Age')); $this->assertNotNull($this->response->headers->get('X-Content-Digest')); $this->assertTraceContains('fresh'); $this->assertTraceNotContains('store'); @@ -554,8 +554,8 @@ class HttpCacheTest extends HttpCacheTestCase $this->request('GET', '/'); $this->assertHttpKernelIsNotCalled(); $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertTrue(strtotime($this->responses[0]->headers->get('Date')) - strtotime($this->response->headers->get('Date')) < 2); - $this->assertTrue($this->response->headers->get('Age') > 0); + $this->assertLessThan(2, strtotime($this->responses[0]->headers->get('Date')) - strtotime($this->response->headers->get('Date'))); + $this->assertGreaterThan(0, $this->response->headers->get('Age')); $this->assertNotNull($this->response->headers->get('X-Content-Digest')); $this->assertTraceContains('fresh'); $this->assertTraceNotContains('store'); @@ -618,8 +618,8 @@ class HttpCacheTest extends HttpCacheTestCase $this->request('GET', '/'); $this->assertHttpKernelIsNotCalled(); $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertTrue(strtotime($this->responses[0]->headers->get('Date')) - strtotime($this->response->headers->get('Date')) < 2); - $this->assertTrue($this->response->headers->get('Age') > 0); + $this->assertLessThan(2, strtotime($this->responses[0]->headers->get('Date')) - strtotime($this->response->headers->get('Date'))); + $this->assertGreaterThan(0, $this->response->headers->get('Age')); $this->assertNotNull($this->response->headers->get('X-Content-Digest')); $this->assertTraceContains('fresh'); $this->assertTraceNotContains('store'); @@ -793,7 +793,7 @@ class HttpCacheTest extends HttpCacheTestCase $this->request('GET', '/'); $this->assertHttpKernelIsCalled(); $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertTrue($this->response->headers->get('Age') <= 1); + $this->assertLessThanOrEqual(1, $this->response->headers->get('Age')); $this->assertNotNull($this->response->headers->get('X-Content-Digest')); $this->assertTraceContains('stale'); $this->assertTraceNotContains('fresh'); @@ -831,7 +831,7 @@ class HttpCacheTest extends HttpCacheTestCase $this->assertEquals(200, $this->response->getStatusCode()); $this->assertNotNull($this->response->headers->get('Last-Modified')); $this->assertNotNull($this->response->headers->get('X-Content-Digest')); - $this->assertTrue($this->response->headers->get('Age') <= 1); + $this->assertLessThanOrEqual(1, $this->response->headers->get('Age')); $this->assertEquals('Hello World', $this->response->getContent()); $this->assertTraceContains('stale'); $this->assertTraceContains('valid'); @@ -881,7 +881,7 @@ class HttpCacheTest extends HttpCacheTestCase $this->assertEquals(200, $this->response->getStatusCode()); $this->assertNotNull($this->response->headers->get('ETag')); $this->assertNotNull($this->response->headers->get('X-Content-Digest')); - $this->assertTrue($this->response->headers->get('Age') <= 1); + $this->assertLessThanOrEqual(1, $this->response->headers->get('Age')); $this->assertEquals('Hello World', $this->response->getContent()); $this->assertTraceContains('stale'); $this->assertTraceContains('valid'); diff --git a/vendor/symfony/http-kernel/Tests/KernelTest.php b/vendor/symfony/http-kernel/Tests/KernelTest.php index 052e5766..755e1db2 100644 --- a/vendor/symfony/http-kernel/Tests/KernelTest.php +++ b/vendor/symfony/http-kernel/Tests/KernelTest.php @@ -13,10 +13,13 @@ namespace Symfony\Component\HttpKernel\Tests; use PHPUnit\Framework\TestCase; use Symfony\Component\Config\Loader\LoaderInterface; +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\HttpKernel\Bundle\BundleInterface; use Symfony\Component\HttpKernel\Config\EnvParametersResource; +use Symfony\Component\HttpKernel\DependencyInjection\ResettableServicePass; +use Symfony\Component\HttpKernel\DependencyInjection\ServicesResetter; use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpFoundation\Request; @@ -24,6 +27,7 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTest; use Symfony\Component\HttpKernel\Tests\Fixtures\KernelForOverrideName; use Symfony\Component\HttpKernel\Tests\Fixtures\KernelWithoutBundles; +use Symfony\Component\HttpKernel\Tests\Fixtures\ResettableService; class KernelTest extends TestCase { @@ -61,6 +65,31 @@ class KernelTest extends TestCase $this->assertNull($clone->getContainer()); } + public function testInitializeContainerClearsOldContainers() + { + $fs = new Filesystem(); + $legacyContainerDir = __DIR__.'/Fixtures/cache/custom/ContainerA123456'; + $fs->mkdir($legacyContainerDir); + touch($legacyContainerDir.'.legacy'); + + $kernel = new CustomProjectDirKernel(); + $kernel->boot(); + + $containerDir = __DIR__.'/Fixtures/cache/custom/'.substr(get_class($kernel->getContainer()), 0, 16); + $this->assertTrue(unlink(__DIR__.'/Fixtures/cache/custom/FixturesCustomDebugProjectContainer.php.meta')); + $this->assertFileExists($containerDir); + $this->assertFileNotExists($containerDir.'.legacy'); + + $kernel = new CustomProjectDirKernel(function ($container) { $container->register('foo', 'stdClass')->setPublic(true); }); + $kernel->boot(); + + $this->assertFileExists($containerDir); + $this->assertFileExists($containerDir.'.legacy'); + + $this->assertFileNotExists($legacyContainerDir); + $this->assertFileNotExists($legacyContainerDir.'.legacy'); + } + public function testBootInitializesBundlesAndContainer() { $kernel = $this->getKernel(array('initializeBundles', 'initializeContainer')); @@ -410,6 +439,9 @@ EOF; $this->assertEquals(__DIR__.'/Fixtures/Bundle1Bundle/foo.txt', $kernel->locateResource('@Bundle1Bundle/foo.txt')); } + /** + * @group legacy + */ public function testLocateResourceReturnsTheFirstThatMatchesWithParent() { $parent = $this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle'); @@ -426,6 +458,9 @@ EOF; $this->assertEquals(__DIR__.'/Fixtures/Bundle1Bundle/bar.txt', $kernel->locateResource('@ParentAABundle/bar.txt')); } + /** + * @group legacy + */ public function testLocateResourceReturnsAllMatches() { $parent = $this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle'); @@ -444,6 +479,9 @@ EOF; $kernel->locateResource('@Bundle1Bundle/foo.txt', null, false)); } + /** + * @group legacy + */ public function testLocateResourceReturnsAllMatchesBis() { $kernel = $this->getKernel(array('getBundle')); @@ -492,6 +530,9 @@ EOF; ); } + /** + * @group legacy + */ public function testLocateResourceReturnsTheDirOneForResourcesAndBundleOnes() { $kernel = $this->getKernel(array('getBundle')); @@ -508,6 +549,9 @@ EOF; ); } + /** + * @group legacy + */ public function testLocateResourceOverrideBundleAndResourcesFolders() { $parent = $this->getBundle(__DIR__.'/Fixtures/BaseBundle', null, 'BaseBundle', 'BaseBundle'); @@ -581,6 +625,9 @@ EOF; ); } + /** + * @group legacy + */ public function testInitializeBundles() { $parent = $this->getBundle(null, null, 'ParentABundle'); @@ -599,6 +646,9 @@ EOF; $this->assertEquals(array($child, $parent), $map['ParentABundle']); } + /** + * @group legacy + */ public function testInitializeBundlesSupportInheritanceCascade() { $grandparent = $this->getBundle(null, null, 'GrandParentBBundle'); @@ -621,6 +671,7 @@ EOF; } /** + * @group legacy * @expectedException \LogicException * @expectedExceptionMessage Bundle "ChildCBundle" extends bundle "FooBar", which is not registered. */ @@ -631,6 +682,9 @@ EOF; $kernel->boot(); } + /** + * @group legacy + */ public function testInitializeBundlesSupportsArbitraryBundleRegistrationOrder() { $grandparent = $this->getBundle(null, null, 'GrandParentCBundle'); @@ -653,6 +707,7 @@ EOF; } /** + * @group legacy * @expectedException \LogicException * @expectedExceptionMessage Bundle "ParentCBundle" is directly extended by two bundles "ChildC2Bundle" and "ChildC1Bundle". */ @@ -667,6 +722,7 @@ EOF; } /** + * @group legacy * @expectedException \LogicException * @expectedExceptionMessage Trying to register two bundles with the same name "DuplicateName" */ @@ -680,6 +736,7 @@ EOF; } /** + * @group legacy * @expectedException \LogicException * @expectedExceptionMessage Bundle "CircularRefBundle" can not extend itself. */ @@ -771,13 +828,79 @@ EOF; public function testProjectDirExtension() { - $kernel = new CustomProjectDirKernel('test', true); + $kernel = new CustomProjectDirKernel(); $kernel->boot(); $this->assertSame('foo', $kernel->getProjectDir()); $this->assertSame('foo', $kernel->getContainer()->getParameter('kernel.project_dir')); } + public function testKernelReset() + { + (new Filesystem())->remove(__DIR__.'/Fixtures/cache'); + + $kernel = new CustomProjectDirKernel(); + $kernel->boot(); + + $containerClass = get_class($kernel->getContainer()); + $containerFile = (new \ReflectionClass($kernel->getContainer()))->getFileName(); + unlink(__DIR__.'/Fixtures/cache/custom/FixturesCustomDebugProjectContainer.php.meta'); + + $kernel = new CustomProjectDirKernel(); + $kernel->boot(); + + $this->assertSame($containerClass, get_class($kernel->getContainer())); + $this->assertFileExists($containerFile); + unlink(__DIR__.'/Fixtures/cache/custom/FixturesCustomDebugProjectContainer.php.meta'); + + $kernel = new CustomProjectDirKernel(function ($container) { $container->register('foo', 'stdClass')->setPublic(true); }); + $kernel->boot(); + + $this->assertTrue(get_class($kernel->getContainer()) !== $containerClass); + $this->assertFileExists($containerFile); + $this->assertFileExists(dirname($containerFile).'.legacy'); + } + + public function testKernelPass() + { + $kernel = new PassKernel(); + $kernel->boot(); + + $this->assertTrue($kernel->getContainer()->getParameter('test.processed')); + } + + public function testServicesResetter() + { + $httpKernelMock = $this->getMockBuilder(HttpKernelInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $httpKernelMock + ->expects($this->exactly(2)) + ->method('handle'); + + $kernel = new CustomProjectDirKernel(function ($container) { + $container->addCompilerPass(new ResettableServicePass()); + $container->register('one', ResettableService::class) + ->setPublic(true) + ->addTag('kernel.reset', array('method' => 'reset')); + $container->register('services_resetter', ServicesResetter::class)->setPublic(true); + }, $httpKernelMock, 'resetting'); + + ResettableService::$counter = 0; + + $request = new Request(); + + $kernel->handle($request); + $kernel->getContainer()->get('one'); + + $this->assertEquals(0, ResettableService::$counter); + $this->assertFalse($kernel->getContainer()->initialized('services_resetter')); + + $kernel->handle($request); + + $this->assertEquals(1, ResettableService::$counter); + } + /** * Returns a mock for the BundleInterface. * @@ -878,12 +1001,16 @@ class TestKernel implements HttpKernelInterface class CustomProjectDirKernel extends Kernel { private $baseDir; + private $buildContainer; + private $httpKernel; - public function __construct() + public function __construct(\Closure $buildContainer = null, HttpKernelInterface $httpKernel = null, $name = 'custom') { - parent::__construct('test', false); + parent::__construct($name, true); $this->baseDir = 'foo'; + $this->buildContainer = $buildContainer; + $this->httpKernel = $httpKernel; } public function registerBundles() @@ -904,4 +1031,30 @@ class CustomProjectDirKernel extends Kernel { return __DIR__.'/Fixtures'; } + + protected function build(ContainerBuilder $container) + { + if ($build = $this->buildContainer) { + $build($container); + } + } + + protected function getHttpKernel() + { + return $this->httpKernel; + } +} + +class PassKernel extends CustomProjectDirKernel implements CompilerPassInterface +{ + public function __construct() + { + parent::__construct(); + Kernel::__construct('pass', true); + } + + public function process(ContainerBuilder $container) + { + $container->setParameter('test.processed', true); + } } diff --git a/vendor/symfony/http-kernel/Tests/Log/LoggerTest.php b/vendor/symfony/http-kernel/Tests/Log/LoggerTest.php new file mode 100644 index 00000000..ecf67af7 --- /dev/null +++ b/vendor/symfony/http-kernel/Tests/Log/LoggerTest.php @@ -0,0 +1,212 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpKernel\Tests\Log; + +use PHPUnit\Framework\TestCase; +use Psr\Log\LoggerInterface; +use Psr\Log\LogLevel; +use Symfony\Component\HttpKernel\Log\Logger; + +/** + * @author Kévin Dunglas <dunglas@gmail.com> + * @author Jordi Boggiano <j.boggiano@seld.be> + */ +class LoggerTest extends TestCase +{ + /** + * @var LoggerInterface + */ + private $logger; + + /** + * @var string + */ + private $tmpFile; + + protected function setUp() + { + $this->tmpFile = sys_get_temp_dir().DIRECTORY_SEPARATOR.'log'; + $this->logger = new Logger(LogLevel::DEBUG, $this->tmpFile); + } + + protected function tearDown() + { + if (!@unlink($this->tmpFile)) { + file_put_contents($this->tmpFile, ''); + } + } + + public static function assertLogsMatch(array $expected, array $given) + { + foreach ($given as $k => $line) { + self::assertThat(1 === preg_match('/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}[\+-][0-9]{2}:[0-9]{2} '.preg_quote($expected[$k]).'/', $line), self::isTrue(), "\"$line\" do not match expected pattern \"$expected[$k]\""); + } + } + + /** + * Return the log messages in order. + * + * @return string[] + */ + public function getLogs() + { + return file($this->tmpFile, FILE_IGNORE_NEW_LINES); + } + + public function testImplements() + { + $this->assertInstanceOf(LoggerInterface::class, $this->logger); + } + + /** + * @dataProvider provideLevelsAndMessages + */ + public function testLogsAtAllLevels($level, $message) + { + $this->logger->{$level}($message, array('user' => 'Bob')); + $this->logger->log($level, $message, array('user' => 'Bob')); + + $expected = array( + "[$level] message of level $level with context: Bob", + "[$level] message of level $level with context: Bob", + ); + $this->assertLogsMatch($expected, $this->getLogs()); + } + + public function provideLevelsAndMessages() + { + return array( + LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'), + LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'), + LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'), + LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'), + LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'), + LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'), + LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'), + LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'), + ); + } + + public function testLogLevelDisabled() + { + $this->logger = new Logger(LogLevel::INFO, $this->tmpFile); + + $this->logger->debug('test', array('user' => 'Bob')); + $this->logger->log(LogLevel::DEBUG, 'test', array('user' => 'Bob')); + + // Will always be true, but asserts than an exception isn't thrown + $this->assertSame(array(), $this->getLogs()); + } + + /** + * @expectedException \Psr\Log\InvalidArgumentException + */ + public function testThrowsOnInvalidLevel() + { + $this->logger->log('invalid level', 'Foo'); + } + + /** + * @expectedException \Psr\Log\InvalidArgumentException + */ + public function testThrowsOnInvalidMinLevel() + { + new Logger('invalid'); + } + + /** + * @expectedException \Psr\Log\InvalidArgumentException + */ + public function testInvalidOutput() + { + new Logger(LogLevel::DEBUG, '/'); + } + + public function testContextReplacement() + { + $logger = $this->logger; + $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar')); + + $expected = array('[info] {Message {nothing} Bob Bar a}'); + $this->assertLogsMatch($expected, $this->getLogs()); + } + + public function testObjectCastToString() + { + if (method_exists($this, 'createPartialMock')) { + $dummy = $this->createPartialMock(DummyTest::class, array('__toString')); + } else { + $dummy = $this->getMock(DummyTest::class, array('__toString')); + } + $dummy->expects($this->atLeastOnce()) + ->method('__toString') + ->will($this->returnValue('DUMMY')); + + $this->logger->warning($dummy); + + $expected = array('[warning] DUMMY'); + $this->assertLogsMatch($expected, $this->getLogs()); + } + + public function testContextCanContainAnything() + { + $context = array( + 'bool' => true, + 'null' => null, + 'string' => 'Foo', + 'int' => 0, + 'float' => 0.5, + 'nested' => array('with object' => new DummyTest()), + 'object' => new \DateTime(), + 'resource' => fopen('php://memory', 'r'), + ); + + $this->logger->warning('Crazy context data', $context); + + $expected = array('[warning] Crazy context data'); + $this->assertLogsMatch($expected, $this->getLogs()); + } + + public function testContextExceptionKeyCanBeExceptionOrOtherValues() + { + $logger = $this->logger; + $logger->warning('Random message', array('exception' => 'oops')); + $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail'))); + + $expected = array( + '[warning] Random message', + '[critical] Uncaught Exception!', + ); + $this->assertLogsMatch($expected, $this->getLogs()); + } + + public function testFormatter() + { + $this->logger = new Logger(LogLevel::DEBUG, $this->tmpFile, function ($level, $message, $context) { + return json_encode(array('level' => $level, 'message' => $message, 'context' => $context)).\PHP_EOL; + }); + + $this->logger->error('An error', array('foo' => 'bar')); + $this->logger->warning('A warning', array('baz' => 'bar')); + $this->assertSame(array( + '{"level":"error","message":"An error","context":{"foo":"bar"}}', + '{"level":"warning","message":"A warning","context":{"baz":"bar"}}', + ), $this->getLogs()); + } +} + +class DummyTest +{ + public function __toString() + { + } +} diff --git a/vendor/symfony/http-kernel/Tests/Profiler/ProfilerTest.php b/vendor/symfony/http-kernel/Tests/Profiler/ProfilerTest.php index 1a6f5463..243c3c5c 100644 --- a/vendor/symfony/http-kernel/Tests/Profiler/ProfilerTest.php +++ b/vendor/symfony/http-kernel/Tests/Profiler/ProfilerTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\HttpKernel\Tests\Profiler; use PHPUnit\Framework\TestCase; +use Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface; use Symfony\Component\HttpKernel\DataCollector\RequestDataCollector; use Symfony\Component\HttpKernel\Profiler\FileProfilerStorage; use Symfony\Component\HttpKernel\Profiler\Profiler; @@ -40,6 +41,19 @@ class ProfilerTest extends TestCase $this->assertSame('bar', $profile->getCollector('request')->getRequestQuery()->all()['foo']->getValue()); } + public function testReset() + { + $collector = $this->getMockBuilder(DataCollectorInterface::class) + ->setMethods(['collect', 'getName', 'reset']) + ->getMock(); + $collector->expects($this->any())->method('getName')->willReturn('mock'); + $collector->expects($this->once())->method('reset'); + + $profiler = new Profiler($this->storage); + $profiler->add($collector); + $profiler->reset(); + } + public function testFindWorksWithDates() { $profiler = new Profiler($this->storage); diff --git a/vendor/symfony/http-kernel/Tests/UriSignerTest.php b/vendor/symfony/http-kernel/Tests/UriSignerTest.php index 253a4c91..84ec19f7 100644 --- a/vendor/symfony/http-kernel/Tests/UriSignerTest.php +++ b/vendor/symfony/http-kernel/Tests/UriSignerTest.php @@ -36,7 +36,7 @@ class UriSignerTest extends TestCase $this->assertTrue($signer->check($signer->sign('http://example.com/foo?foo=bar'))); $this->assertTrue($signer->check($signer->sign('http://example.com/foo?foo=bar&0=integer'))); - $this->assertTrue($signer->sign('http://example.com/foo?foo=bar&bar=foo') === $signer->sign('http://example.com/foo?bar=foo&foo=bar')); + $this->assertSame($signer->sign('http://example.com/foo?foo=bar&bar=foo'), $signer->sign('http://example.com/foo?bar=foo&foo=bar')); } public function testCheckWithDifferentArgSeparator() diff --git a/vendor/symfony/http-kernel/UriSigner.php b/vendor/symfony/http-kernel/UriSigner.php index c3df2319..28459b4e 100644 --- a/vendor/symfony/http-kernel/UriSigner.php +++ b/vendor/symfony/http-kernel/UriSigner.php @@ -58,10 +58,6 @@ class UriSigner /** * Checks that a URI contains the correct hash. * - * The query string parameter must be the last one - * (as it is generated that way by the sign() method, it should - * never be a problem). - * * @param string $uri A signed URI * * @return bool True if the URI is signed correctly, false otherwise diff --git a/vendor/symfony/http-kernel/composer.json b/vendor/symfony/http-kernel/composer.json index cc543c6d..b3367576 100644 --- a/vendor/symfony/http-kernel/composer.json +++ b/vendor/symfony/http-kernel/composer.json @@ -17,38 +17,40 @@ ], "require": { "php": "^5.5.9|>=7.0.8", - "symfony/event-dispatcher": "~2.8|~3.0", - "symfony/http-foundation": "~3.3", - "symfony/debug": "~2.8|~3.0", + "symfony/event-dispatcher": "~2.8|~3.0|~4.0", + "symfony/http-foundation": "^3.4.4|^4.0.4", + "symfony/debug": "~2.8|~3.0|~4.0", "psr/log": "~1.0" }, "require-dev": { - "symfony/browser-kit": "~2.8|~3.0", + "symfony/browser-kit": "~2.8|~3.0|~4.0", "symfony/class-loader": "~2.8|~3.0", - "symfony/config": "~2.8|~3.0", - "symfony/console": "~2.8|~3.0", - "symfony/css-selector": "~2.8|~3.0", - "symfony/dependency-injection": "~3.3", - "symfony/dom-crawler": "~2.8|~3.0", - "symfony/expression-language": "~2.8|~3.0", - "symfony/finder": "~2.8|~3.0", - "symfony/process": "~2.8|~3.0", - "symfony/routing": "~2.8|~3.0", - "symfony/stopwatch": "~2.8|~3.0", - "symfony/templating": "~2.8|~3.0", - "symfony/translation": "~2.8|~3.0", - "symfony/var-dumper": "~3.3", + "symfony/config": "~2.8|~3.0|~4.0", + "symfony/console": "~2.8|~3.0|~4.0", + "symfony/css-selector": "~2.8|~3.0|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/dom-crawler": "~2.8|~3.0|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/finder": "~2.8|~3.0|~4.0", + "symfony/process": "~2.8|~3.0|~4.0", + "symfony/routing": "~3.4|~4.0", + "symfony/stopwatch": "~2.8|~3.0|~4.0", + "symfony/templating": "~2.8|~3.0|~4.0", + "symfony/translation": "~2.8|~3.0|~4.0", + "symfony/var-dumper": "~3.3|~4.0", "psr/cache": "~1.0" }, + "provide": { + "psr/log-implementation": "1.0" + }, "conflict": { "symfony/config": "<2.8", - "symfony/dependency-injection": "<3.3", + "symfony/dependency-injection": "<3.4", "symfony/var-dumper": "<3.3", "twig/twig": "<1.34|<2.4,>=2" }, "suggest": { "symfony/browser-kit": "", - "symfony/class-loader": "", "symfony/config": "", "symfony/console": "", "symfony/dependency-injection": "", @@ -64,7 +66,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } } } diff --git a/vendor/symfony/polyfill-mbstring/LICENSE b/vendor/symfony/polyfill-mbstring/LICENSE index 39fa189d..24fa32c2 100644 --- a/vendor/symfony/polyfill-mbstring/LICENSE +++ b/vendor/symfony/polyfill-mbstring/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2014-2016 Fabien Potencier +Copyright (c) 2015-2018 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/symfony/polyfill-mbstring/Mbstring.php b/vendor/symfony/polyfill-mbstring/Mbstring.php index 97e8c9b4..67cf9ab8 100644 --- a/vendor/symfony/polyfill-mbstring/Mbstring.php +++ b/vendor/symfony/polyfill-mbstring/Mbstring.php @@ -20,7 +20,10 @@ namespace Symfony\Polyfill\Mbstring; * - mb_convert_variables - Convert character code in variable(s) * - mb_decode_mimeheader - Decode string in MIME header field * - mb_encode_mimeheader - Encode string for MIME header XXX NATIVE IMPLEMENTATION IS REALLY BUGGED + * - mb_decode_numericentity - Decode HTML numeric string reference to character + * - mb_encode_numericentity - Encode character to HTML numeric string reference * - mb_convert_case - Perform case folding on a string + * - mb_detect_encoding - Detect character encoding * - mb_get_info - Get internal settings of mbstring * - mb_http_input - Detect HTTP input character encoding * - mb_http_output - Set/Get HTTP output character encoding @@ -47,8 +50,6 @@ namespace Symfony\Polyfill\Mbstring; * * Not implemented: * - mb_convert_kana - Convert "kana" one from another ("zen-kaku", "han-kaku" and more) - * - mb_decode_numericentity - Decode HTML numeric string reference to character - * - mb_encode_numericentity - Encode character to HTML numeric string reference * - mb_ereg_* - Regular expression with multibyte support * - mb_parse_str - Parse GET/POST/COOKIE data and set global variable * - mb_preferred_mime_name - Get MIME charset string @@ -137,9 +138,134 @@ final class Mbstring trigger_error('mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead', E_USER_WARNING); } + public static function mb_decode_numericentity($s, $convmap, $encoding = null) + { + if (null !== $s && !is_scalar($s) && !(is_object($s) && method_exists($s, '__toString'))) { + trigger_error('mb_decode_numericentity() expects parameter 1 to be string, '.gettype($s).' given', E_USER_WARNING); + return null; + } + + if (!is_array($convmap) || !$convmap) { + return false; + } + + if (null !== $encoding && !is_scalar($encoding)) { + trigger_error('mb_decode_numericentity() expects parameter 3 to be string, '.gettype($s).' given', E_USER_WARNING); + return ''; // Instead of null (cf. mb_encode_numericentity). + } + + $s = (string) $s; + if ('' === $s) { + return ''; + } + + $encoding = self::getEncoding($encoding); + + if ('UTF-8' === $encoding) { + $encoding = null; + if (!preg_match('//u', $s)) { + $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s); + } + } else { + $s = iconv($encoding, 'UTF-8//IGNORE', $s); + } + + $cnt = floor(count($convmap) / 4) * 4; + + for ($i = 0; $i < $cnt; $i += 4) { + // collector_decode_htmlnumericentity ignores $convmap[$i + 3] + $convmap[$i] += $convmap[$i + 2]; + $convmap[$i + 1] += $convmap[$i + 2]; + } + + $s = preg_replace_callback('/&#(?:0*([0-9]+)|x0*([0-9a-fA-F]+))(?!&);?/', function (array $m) use ($cnt, $convmap) { + $c = isset($m[2]) ? (int) hexdec($m[2]) : $m[1]; + for ($i = 0; $i < $cnt; $i += 4) { + if ($c >= $convmap[$i] && $c <= $convmap[$i + 1]) { + return Mbstring::mb_chr($c - $convmap[$i + 2]); + } + } + return $m[0]; + }, $s); + + if (null === $encoding) { + return $s; + } + + return iconv('UTF-8', $encoding.'//IGNORE', $s); + } + + public static function mb_encode_numericentity($s, $convmap, $encoding = null, $is_hex = false) + { + if (null !== $s && !is_scalar($s) && !(is_object($s) && method_exists($s, '__toString'))) { + trigger_error('mb_encode_numericentity() expects parameter 1 to be string, '.gettype($s).' given', E_USER_WARNING); + return null; + } + + if (!is_array($convmap) || !$convmap) { + return false; + } + + if (null !== $encoding && !is_scalar($encoding)) { + trigger_error('mb_encode_numericentity() expects parameter 3 to be string, '.gettype($s).' given', E_USER_WARNING); + return null; // Instead of '' (cf. mb_decode_numericentity). + } + + if (null !== $is_hex && !is_scalar($is_hex)) { + trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, '.gettype($s).' given', E_USER_WARNING); + return null; + } + + $s = (string) $s; + if ('' === $s) { + return ''; + } + + $encoding = self::getEncoding($encoding); + + if ('UTF-8' === $encoding) { + $encoding = null; + if (!preg_match('//u', $s)) { + $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s); + } + } else { + $s = iconv($encoding, 'UTF-8//IGNORE', $s); + } + + static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4); + + $cnt = floor(count($convmap) / 4) * 4; + $i = 0; + $len = strlen($s); + $result = ''; + + while ($i < $len) { + $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"]; + $uchr = substr($s, $i, $ulen); + $i += $ulen; + $c = self::mb_ord($uchr); + + for ($j = 0; $j < $cnt; $j += 4) { + if ($c >= $convmap[$j] && $c <= $convmap[$j + 1]) { + $cOffset = ($c + $convmap[$j + 2]) & $convmap[$j + 3]; + $result .= $is_hex ? sprintf('&#x%X;', $cOffset) : '&#'.$cOffset.';'; + continue 2; + } + } + $result .= $uchr; + } + + if (null === $encoding) { + return $result; + } + + return iconv('UTF-8', $encoding.'//IGNORE', $result); + } + public static function mb_convert_case($s, $mode, $encoding = null) { - if ('' === $s .= '') { + $s = (string) $s; + if ('' === $s) { return ''; } @@ -354,7 +480,8 @@ final class Mbstring return strpos($haystack, $needle, $offset); } - if ('' === $needle .= '') { + $needle = (string) $needle; + if ('' === $needle) { trigger_error(__METHOD__.': Empty delimiter', E_USER_WARNING); return false; @@ -428,7 +555,7 @@ final class Mbstring } } - return iconv_substr($s, $start, $length, $encoding).''; + return (string) iconv_substr($s, $start, $length, $encoding); } public static function mb_stripos($haystack, $needle, $offset = 0, $encoding = null) @@ -600,7 +727,7 @@ final class Mbstring return self::mb_substr($haystack, $pos, null, $encoding); } - private static function html_encoding_callback($m) + private static function html_encoding_callback(array $m) { $i = 1; $entities = ''; @@ -625,12 +752,12 @@ final class Mbstring return $entities; } - private static function title_case_lower($s) + private static function title_case_lower(array $s) { return self::mb_convert_case($s[0], MB_CASE_LOWER, 'UTF-8'); } - private static function title_case_upper($s) + private static function title_case_upper(array $s) { return self::mb_convert_case($s[0], MB_CASE_UPPER, 'UTF-8'); } diff --git a/vendor/symfony/polyfill-mbstring/bootstrap.php b/vendor/symfony/polyfill-mbstring/bootstrap.php index 33722910..2fdcc5a6 100644 --- a/vendor/symfony/polyfill-mbstring/bootstrap.php +++ b/vendor/symfony/polyfill-mbstring/bootstrap.php @@ -19,6 +19,8 @@ if (!function_exists('mb_strlen')) { function mb_convert_encoding($s, $to, $from = null) { return p\Mbstring::mb_convert_encoding($s, $to, $from); } function mb_decode_mimeheader($s) { return p\Mbstring::mb_decode_mimeheader($s); } function mb_encode_mimeheader($s, $charset = null, $transferEnc = null, $lf = null, $indent = null) { return p\Mbstring::mb_encode_mimeheader($s, $charset, $transferEnc, $lf, $indent); } + function mb_decode_numericentity($s, $convmap, $enc = null) { return p\Mbstring::mb_decode_numericentity($s, $convmap, $enc); } + function mb_encode_numericentity($s, $convmap, $enc = null, $is_hex = false) { return p\Mbstring::mb_encode_numericentity($s, $convmap, $enc, $is_hex); } function mb_convert_case($s, $mode, $enc = null) { return p\Mbstring::mb_convert_case($s, $mode, $enc); } function mb_internal_encoding($enc = null) { return p\Mbstring::mb_internal_encoding($enc); } function mb_language($lang = null) { return p\Mbstring::mb_language($lang); } diff --git a/vendor/symfony/polyfill-mbstring/composer.json b/vendor/symfony/polyfill-mbstring/composer.json index e184b210..4febcdd5 100644 --- a/vendor/symfony/polyfill-mbstring/composer.json +++ b/vendor/symfony/polyfill-mbstring/composer.json @@ -28,7 +28,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "1.5-dev" + "dev-master": "1.7-dev" } } } diff --git a/vendor/symfony/polyfill-php70/LICENSE b/vendor/symfony/polyfill-php70/LICENSE new file mode 100644 index 00000000..24fa32c2 --- /dev/null +++ b/vendor/symfony/polyfill-php70/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2015-2018 Fabien Potencier + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/symfony/polyfill-php70/Php70.php b/vendor/symfony/polyfill-php70/Php70.php new file mode 100644 index 00000000..8e784506 --- /dev/null +++ b/vendor/symfony/polyfill-php70/Php70.php @@ -0,0 +1,74 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Polyfill\Php70; + +/** + * @author Nicolas Grekas <p@tchwork.com> + * + * @internal + */ +final class Php70 +{ + public static function intdiv($dividend, $divisor) + { + $dividend = self::intArg($dividend, __FUNCTION__, 1); + $divisor = self::intArg($divisor, __FUNCTION__, 2); + + if (0 === $divisor) { + throw new \DivisionByZeroError('Division by zero'); + } + if (-1 === $divisor && ~PHP_INT_MAX === $dividend) { + throw new \ArithmeticError('Division of PHP_INT_MIN by -1 is not an integer'); + } + + return ($dividend - ($dividend % $divisor)) / $divisor; + } + + public static function preg_replace_callback_array(array $patterns, $subject, $limit = -1, &$count = 0) + { + $count = 0; + $result = (string) $subject; + if (0 === $limit = self::intArg($limit, __FUNCTION__, 3)) { + return $result; + } + + foreach ($patterns as $pattern => $callback) { + $result = preg_replace_callback($pattern, $callback, $result, $limit, $c); + $count += $c; + } + + return $result; + } + + public static function error_clear_last() + { + static $handler; + if (!$handler) { + $handler = function() { return false; }; + } + set_error_handler($handler); + @trigger_error(''); + restore_error_handler(); + } + + public static function intArg($value, $caller, $pos) + { + if (is_int($value)) { + return $value; + } + if (!is_numeric($value) || PHP_INT_MAX <= ($value += 0) || ~PHP_INT_MAX >= $value) { + throw new \TypeError(sprintf('%s() expects parameter %d to be integer, %s given', $caller, $pos, gettype($value))); + } + + return (int) $value; + } +} diff --git a/vendor/symfony/polyfill-php70/README.md b/vendor/symfony/polyfill-php70/README.md new file mode 100644 index 00000000..04988c6f --- /dev/null +++ b/vendor/symfony/polyfill-php70/README.md @@ -0,0 +1,28 @@ +Symfony Polyfill / Php70 +======================== + +This component provides features unavailable in releases prior to PHP 7.0: + +- [`intdiv`](http://php.net/intdiv) +- [`preg_replace_callback_array`](http://php.net/preg_replace_callback_array) +- [`error_clear_last`](http://php.net/error_clear_last) +- `random_bytes` and `random_int` (from [paragonie/random_compat](https://github.com/paragonie/random_compat)) +- [`*Error` throwable classes](http://php.net/Error) +- [`PHP_INT_MIN`](http://php.net/manual/en/reserved.constants.php#constant.php-int-min) +- `SessionUpdateTimestampHandlerInterface` + +More information can be found in the +[main Polyfill README](https://github.com/symfony/polyfill/blob/master/README.md). + +Compatibility notes +=================== + +To write portable code between PHP5 and PHP7, some care must be taken: +- `\*Error` exceptions must be caught before `\Exception`; +- after calling `error_clear_last()`, the result of `$e = error_get_last()` must be + verified using `isset($e['message'][0])` instead of `null !== $e`. + +License +======= + +This library is released under the [MIT license](LICENSE). diff --git a/vendor/symfony/polyfill-php70/Resources/stubs/ArithmeticError.php b/vendor/symfony/polyfill-php70/Resources/stubs/ArithmeticError.php new file mode 100644 index 00000000..68191244 --- /dev/null +++ b/vendor/symfony/polyfill-php70/Resources/stubs/ArithmeticError.php @@ -0,0 +1,5 @@ +<?php + +class ArithmeticError extends Error +{ +} diff --git a/vendor/symfony/polyfill-php70/Resources/stubs/AssertionError.php b/vendor/symfony/polyfill-php70/Resources/stubs/AssertionError.php new file mode 100644 index 00000000..acb12508 --- /dev/null +++ b/vendor/symfony/polyfill-php70/Resources/stubs/AssertionError.php @@ -0,0 +1,5 @@ +<?php + +class AssertionError extends Error +{ +} diff --git a/vendor/symfony/polyfill-php70/Resources/stubs/DivisionByZeroError.php b/vendor/symfony/polyfill-php70/Resources/stubs/DivisionByZeroError.php new file mode 100644 index 00000000..c99278b3 --- /dev/null +++ b/vendor/symfony/polyfill-php70/Resources/stubs/DivisionByZeroError.php @@ -0,0 +1,5 @@ +<?php + +class DivisionByZeroError extends Error +{ +} diff --git a/vendor/symfony/polyfill-php70/Resources/stubs/Error.php b/vendor/symfony/polyfill-php70/Resources/stubs/Error.php new file mode 100644 index 00000000..405847fb --- /dev/null +++ b/vendor/symfony/polyfill-php70/Resources/stubs/Error.php @@ -0,0 +1,5 @@ +<?php + +class Error extends Exception +{ +} diff --git a/vendor/symfony/polyfill-php70/Resources/stubs/ParseError.php b/vendor/symfony/polyfill-php70/Resources/stubs/ParseError.php new file mode 100644 index 00000000..2dd447dd --- /dev/null +++ b/vendor/symfony/polyfill-php70/Resources/stubs/ParseError.php @@ -0,0 +1,5 @@ +<?php + +class ParseError extends Error +{ +} diff --git a/vendor/symfony/polyfill-php70/Resources/stubs/SessionUpdateTimestampHandlerInterface.php b/vendor/symfony/polyfill-php70/Resources/stubs/SessionUpdateTimestampHandlerInterface.php new file mode 100644 index 00000000..0cc02c8f --- /dev/null +++ b/vendor/symfony/polyfill-php70/Resources/stubs/SessionUpdateTimestampHandlerInterface.php @@ -0,0 +1,23 @@ +<?php + +interface SessionUpdateTimestampHandlerInterface +{ + /** + * Checks if a session identifier already exists or not. + * + * @param string $key + * + * @return bool + */ + public function validateId($key); + + /** + * Updates the timestamp of a session when its data didn't change. + * + * @param string $key + * @param string $val + * + * @return bool + */ + public function updateTimestamp($key, $val); +} diff --git a/vendor/symfony/polyfill-php70/Resources/stubs/TypeError.php b/vendor/symfony/polyfill-php70/Resources/stubs/TypeError.php new file mode 100644 index 00000000..2bed1b48 --- /dev/null +++ b/vendor/symfony/polyfill-php70/Resources/stubs/TypeError.php @@ -0,0 +1,5 @@ +<?php + +class TypeError extends Error +{ +} diff --git a/vendor/symfony/polyfill-php70/bootstrap.php b/vendor/symfony/polyfill-php70/bootstrap.php new file mode 100644 index 00000000..445c3983 --- /dev/null +++ b/vendor/symfony/polyfill-php70/bootstrap.php @@ -0,0 +1,27 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Symfony\Polyfill\Php70 as p; + +if (PHP_VERSION_ID < 70000) { + if (!defined('PHP_INT_MIN')) { + define('PHP_INT_MIN', ~PHP_INT_MAX); + } + if (!function_exists('intdiv')) { + function intdiv($dividend, $divisor) { return p\Php70::intdiv($dividend, $divisor); } + } + if (!function_exists('preg_replace_callback_array')) { + function preg_replace_callback_array(array $patterns, $subject, $limit = -1, &$count = 0) { return p\Php70::preg_replace_callback_array($patterns, $subject, $limit, $count); } + } + if (!function_exists('error_clear_last')) { + function error_clear_last() { return p\Php70::error_clear_last(); } + } +} diff --git a/vendor/symfony/polyfill-php70/composer.json b/vendor/symfony/polyfill-php70/composer.json new file mode 100644 index 00000000..88ff357a --- /dev/null +++ b/vendor/symfony/polyfill-php70/composer.json @@ -0,0 +1,33 @@ +{ + "name": "symfony/polyfill-php70", + "type": "library", + "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions", + "keywords": ["polyfill", "shim", "compatibility", "portable"], + "homepage": "https://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "require": { + "php": ">=5.3.3", + "paragonie/random_compat": "~1.0|~2.0" + }, + "autoload": { + "psr-4": { "Symfony\\Polyfill\\Php70\\": "" }, + "files": [ "bootstrap.php" ], + "classmap": [ "Resources/stubs" ] + }, + "minimum-stability": "dev", + "extra": { + "branch-alias": { + "dev-master": "1.7-dev" + } + } +} diff --git a/vendor/symfony/routing/CHANGELOG.md b/vendor/symfony/routing/CHANGELOG.md index d04581f4..e278f8b1 100644 --- a/vendor/symfony/routing/CHANGELOG.md +++ b/vendor/symfony/routing/CHANGELOG.md @@ -1,6 +1,15 @@ CHANGELOG ========= +3.4.0 +----- + + * Added `NoConfigurationException`. + * Added the possibility to define a prefix for all routes of a controller via @Route(name="prefix_") + * Added support for prioritized routing loaders. + * Add matched and default parameters to redirect responses + * Added support for a `controller` keyword for configuring route controllers in YAML and XML configurations. + 3.3.0 ----- @@ -19,7 +28,7 @@ CHANGELOG * Added support for `bool`, `int`, `float`, `string`, `list` and `map` defaults in XML configurations. * Added support for UTF-8 requirements - + 2.8.0 ----- diff --git a/vendor/symfony/routing/DependencyInjection/RoutingResolverPass.php b/vendor/symfony/routing/DependencyInjection/RoutingResolverPass.php index 73a8f851..4af0a5a2 100644 --- a/vendor/symfony/routing/DependencyInjection/RoutingResolverPass.php +++ b/vendor/symfony/routing/DependencyInjection/RoutingResolverPass.php @@ -14,6 +14,7 @@ namespace Symfony\Component\Routing\DependencyInjection; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait; /** * Adds tagged routing.loader services to routing.resolver service. @@ -22,6 +23,8 @@ use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; */ class RoutingResolverPass implements CompilerPassInterface { + use PriorityTaggedServiceTrait; + private $resolverServiceId; private $loaderTag; @@ -39,7 +42,7 @@ class RoutingResolverPass implements CompilerPassInterface $definition = $container->getDefinition($this->resolverServiceId); - foreach ($container->findTaggedServiceIds($this->loaderTag, true) as $id => $attributes) { + foreach ($this->findAndSortTaggedServices($this->loaderTag, $container) as $id) { $definition->addMethodCall('addLoader', array(new Reference($id))); } } diff --git a/vendor/symfony/routing/Exception/MethodNotAllowedException.php b/vendor/symfony/routing/Exception/MethodNotAllowedException.php index f684c749..712412fe 100644 --- a/vendor/symfony/routing/Exception/MethodNotAllowedException.php +++ b/vendor/symfony/routing/Exception/MethodNotAllowedException.php @@ -20,9 +20,6 @@ namespace Symfony\Component\Routing\Exception; */ class MethodNotAllowedException extends \RuntimeException implements ExceptionInterface { - /** - * @var array - */ protected $allowedMethods = array(); public function __construct(array $allowedMethods, $message = null, $code = 0, \Exception $previous = null) diff --git a/vendor/symfony/routing/Exception/NoConfigurationException.php b/vendor/symfony/routing/Exception/NoConfigurationException.php new file mode 100644 index 00000000..333bc743 --- /dev/null +++ b/vendor/symfony/routing/Exception/NoConfigurationException.php @@ -0,0 +1,21 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Routing\Exception; + +/** + * Exception thrown when no routes are configured. + * + * @author Yonel Ceruto <yonelceruto@gmail.com> + */ +class NoConfigurationException extends ResourceNotFoundException +{ +} diff --git a/vendor/symfony/routing/Generator/Dumper/GeneratorDumper.php b/vendor/symfony/routing/Generator/Dumper/GeneratorDumper.php index 4a7051b5..659c5ba1 100644 --- a/vendor/symfony/routing/Generator/Dumper/GeneratorDumper.php +++ b/vendor/symfony/routing/Generator/Dumper/GeneratorDumper.php @@ -20,14 +20,8 @@ use Symfony\Component\Routing\RouteCollection; */ abstract class GeneratorDumper implements GeneratorDumperInterface { - /** - * @var RouteCollection - */ private $routes; - /** - * @param RouteCollection $routes The RouteCollection to dump - */ public function __construct(RouteCollection $routes) { $this->routes = $routes; diff --git a/vendor/symfony/routing/Generator/UrlGenerator.php b/vendor/symfony/routing/Generator/UrlGenerator.php index 7e4fa347..02a59a92 100644 --- a/vendor/symfony/routing/Generator/UrlGenerator.php +++ b/vendor/symfony/routing/Generator/UrlGenerator.php @@ -27,14 +27,7 @@ use Psr\Log\LoggerInterface; */ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInterface { - /** - * @var RouteCollection - */ protected $routes; - - /** - * @var RequestContext - */ protected $context; /** @@ -42,9 +35,6 @@ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInt */ protected $strictRequirements = true; - /** - * @var LoggerInterface|null - */ protected $logger; /** @@ -75,11 +65,6 @@ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInt '%7C' => '|', ); - /** - * @param RouteCollection $routes A RouteCollection instance - * @param RequestContext $context The context - * @param LoggerInterface|null $logger A logger instance - */ public function __construct(RouteCollection $routes, RequestContext $context, LoggerInterface $logger = null) { $this->routes = $routes; @@ -196,57 +181,56 @@ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInt } $schemeAuthority = ''; - if ($host = $this->context->getHost()) { - $scheme = $this->context->getScheme(); + $host = $this->context->getHost(); + $scheme = $this->context->getScheme(); - if ($requiredSchemes) { - if (!in_array($scheme, $requiredSchemes, true)) { - $referenceType = self::ABSOLUTE_URL; - $scheme = current($requiredSchemes); - } + if ($requiredSchemes) { + if (!in_array($scheme, $requiredSchemes, true)) { + $referenceType = self::ABSOLUTE_URL; + $scheme = current($requiredSchemes); } + } - if ($hostTokens) { - $routeHost = ''; - foreach ($hostTokens as $token) { - if ('variable' === $token[0]) { - if (null !== $this->strictRequirements && !preg_match('#^'.$token[2].'$#i'.(empty($token[4]) ? '' : 'u'), $mergedParams[$token[3]])) { - if ($this->strictRequirements) { - throw new InvalidParameterException(strtr($message, array('{parameter}' => $token[3], '{route}' => $name, '{expected}' => $token[2], '{given}' => $mergedParams[$token[3]]))); - } - - if ($this->logger) { - $this->logger->error($message, array('parameter' => $token[3], 'route' => $name, 'expected' => $token[2], 'given' => $mergedParams[$token[3]])); - } + if ($hostTokens) { + $routeHost = ''; + foreach ($hostTokens as $token) { + if ('variable' === $token[0]) { + if (null !== $this->strictRequirements && !preg_match('#^'.$token[2].'$#i'.(empty($token[4]) ? '' : 'u'), $mergedParams[$token[3]])) { + if ($this->strictRequirements) { + throw new InvalidParameterException(strtr($message, array('{parameter}' => $token[3], '{route}' => $name, '{expected}' => $token[2], '{given}' => $mergedParams[$token[3]]))); + } - return; + if ($this->logger) { + $this->logger->error($message, array('parameter' => $token[3], 'route' => $name, 'expected' => $token[2], 'given' => $mergedParams[$token[3]])); } - $routeHost = $token[1].$mergedParams[$token[3]].$routeHost; - } else { - $routeHost = $token[1].$routeHost; + return; } - } - if ($routeHost !== $host) { - $host = $routeHost; - if (self::ABSOLUTE_URL !== $referenceType) { - $referenceType = self::NETWORK_PATH; - } + $routeHost = $token[1].$mergedParams[$token[3]].$routeHost; + } else { + $routeHost = $token[1].$routeHost; } } - if (self::ABSOLUTE_URL === $referenceType || self::NETWORK_PATH === $referenceType) { - $port = ''; - if ('http' === $scheme && 80 != $this->context->getHttpPort()) { - $port = ':'.$this->context->getHttpPort(); - } elseif ('https' === $scheme && 443 != $this->context->getHttpsPort()) { - $port = ':'.$this->context->getHttpsPort(); + if ($routeHost !== $host) { + $host = $routeHost; + if (self::ABSOLUTE_URL !== $referenceType) { + $referenceType = self::NETWORK_PATH; } + } + } - $schemeAuthority = self::NETWORK_PATH === $referenceType ? '//' : "$scheme://"; - $schemeAuthority .= $host.$port; + if ((self::ABSOLUTE_URL === $referenceType || self::NETWORK_PATH === $referenceType) && !empty($host)) { + $port = ''; + if ('http' === $scheme && 80 != $this->context->getHttpPort()) { + $port = ':'.$this->context->getHttpPort(); + } elseif ('https' === $scheme && 443 != $this->context->getHttpsPort()) { + $port = ':'.$this->context->getHttpsPort(); } + + $schemeAuthority = self::NETWORK_PATH === $referenceType ? '//' : "$scheme://"; + $schemeAuthority .= $host.$port; } if (self::RELATIVE_PATH === $referenceType) { diff --git a/vendor/symfony/routing/LICENSE b/vendor/symfony/routing/LICENSE index 17d16a13..21d7fb9e 100644 --- a/vendor/symfony/routing/LICENSE +++ b/vendor/symfony/routing/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2017 Fabien Potencier +Copyright (c) 2004-2018 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/symfony/routing/Loader/AnnotationClassLoader.php b/vendor/symfony/routing/Loader/AnnotationClassLoader.php index d3ca72f7..2fe6fb59 100644 --- a/vendor/symfony/routing/Loader/AnnotationClassLoader.php +++ b/vendor/symfony/routing/Loader/AnnotationClassLoader.php @@ -57,9 +57,6 @@ use Symfony\Component\Config\Loader\LoaderResolverInterface; */ abstract class AnnotationClassLoader implements LoaderInterface { - /** - * @var Reader - */ protected $reader; /** @@ -72,9 +69,6 @@ abstract class AnnotationClassLoader implements LoaderInterface */ protected $defaultRouteIndex = 0; - /** - * @param Reader $reader - */ public function __construct(Reader $reader) { $this->reader = $reader; @@ -127,6 +121,7 @@ abstract class AnnotationClassLoader implements LoaderInterface if (0 === $collection->count() && $class->hasMethod('__invoke') && $annot = $this->reader->getClassAnnotation($class, $this->routeAnnotationClass)) { $globals['path'] = ''; + $globals['name'] = ''; $this->addRoute($collection, $annot, $globals, $class, $class->getMethod('__invoke')); } @@ -139,6 +134,7 @@ abstract class AnnotationClassLoader implements LoaderInterface if (null === $name) { $name = $this->getDefaultRouteName($class, $method); } + $name = $globals['name'].$name; $defaults = array_replace($globals['defaults'], $annot->getDefaults()); foreach ($method->getParameters() as $param) { @@ -220,9 +216,14 @@ abstract class AnnotationClassLoader implements LoaderInterface 'methods' => array(), 'host' => '', 'condition' => '', + 'name' => '', ); if ($annot = $this->reader->getClassAnnotation($class, $this->routeAnnotationClass)) { + if (null !== $annot->getName()) { + $globals['name'] = $annot->getName(); + } + if (null !== $annot->getPath()) { $globals['path'] = $annot->getPath(); } diff --git a/vendor/symfony/routing/Loader/AnnotationDirectoryLoader.php b/vendor/symfony/routing/Loader/AnnotationDirectoryLoader.php index 616d01ef..4574a020 100644 --- a/vendor/symfony/routing/Loader/AnnotationDirectoryLoader.php +++ b/vendor/symfony/routing/Loader/AnnotationDirectoryLoader.php @@ -34,7 +34,9 @@ class AnnotationDirectoryLoader extends AnnotationFileLoader */ public function load($path, $type = null) { - $dir = $this->locator->locate($path); + if (!is_dir($dir = $this->locator->locate($path))) { + return parent::supports($path, $type) ? parent::load($path, $type) : new RouteCollection(); + } $collection = new RouteCollection(); $collection->addResource(new DirectoryResource($dir, '/\.php$/')); @@ -74,16 +76,18 @@ class AnnotationDirectoryLoader extends AnnotationFileLoader */ public function supports($resource, $type = null) { - if (!is_string($resource)) { + if ('annotation' === $type) { + return true; + } + + if ($type || !is_string($resource)) { return false; } try { - $path = $this->locator->locate($resource); + return is_dir($this->locator->locate($resource)); } catch (\Exception $e) { return false; } - - return is_dir($path) && (!$type || 'annotation' === $type); } } diff --git a/vendor/symfony/routing/Loader/AnnotationFileLoader.php b/vendor/symfony/routing/Loader/AnnotationFileLoader.php index f85fac74..cf9f0704 100644 --- a/vendor/symfony/routing/Loader/AnnotationFileLoader.php +++ b/vendor/symfony/routing/Loader/AnnotationFileLoader.php @@ -27,9 +27,6 @@ class AnnotationFileLoader extends FileLoader protected $loader; /** - * @param FileLocatorInterface $locator A FileLocator instance - * @param AnnotationClassLoader $loader An AnnotationClassLoader instance - * * @throws \RuntimeException */ public function __construct(FileLocatorInterface $locator, AnnotationClassLoader $loader) @@ -115,22 +112,22 @@ class AnnotationFileLoader extends FileLoader } if (T_CLASS === $token[0]) { - // Skip usage of ::class constant - $isClassConstant = false; + // Skip usage of ::class constant and anonymous classes + $skipClassToken = false; for ($j = $i - 1; $j > 0; --$j) { if (!isset($tokens[$j][1])) { break; } - if (T_DOUBLE_COLON === $tokens[$j][0]) { - $isClassConstant = true; + if (T_DOUBLE_COLON === $tokens[$j][0] || T_NEW === $tokens[$j][0]) { + $skipClassToken = true; break; } elseif (!in_array($tokens[$j][0], array(T_WHITESPACE, T_DOC_COMMENT, T_COMMENT))) { break; } } - if (!$isClassConstant) { + if (!$skipClassToken) { $class = true; } } diff --git a/vendor/symfony/routing/Loader/Configurator/CollectionConfigurator.php b/vendor/symfony/routing/Loader/Configurator/CollectionConfigurator.php new file mode 100644 index 00000000..38d86cb8 --- /dev/null +++ b/vendor/symfony/routing/Loader/Configurator/CollectionConfigurator.php @@ -0,0 +1,79 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Routing\Loader\Configurator; + +use Symfony\Component\Routing\Route; +use Symfony\Component\Routing\RouteCollection; + +/** + * @author Nicolas Grekas <p@tchwork.com> + */ +class CollectionConfigurator +{ + use Traits\AddTrait; + use Traits\RouteTrait; + + private $parent; + + public function __construct(RouteCollection $parent, $name) + { + $this->parent = $parent; + $this->name = $name; + $this->collection = new RouteCollection(); + $this->route = new Route(''); + } + + public function __destruct() + { + $this->collection->addPrefix(rtrim($this->route->getPath(), '/')); + $this->parent->addCollection($this->collection); + } + + /** + * Adds a route. + * + * @param string $name + * @param string $path + * + * @return RouteConfigurator + */ + final public function add($name, $path) + { + $this->collection->add($this->name.$name, $route = clone $this->route); + + return new RouteConfigurator($this->collection, $route->setPath($path), $this->name); + } + + /** + * Creates a sub-collection. + * + * @return self + */ + final public function collection($name = '') + { + return new self($this->collection, $this->name.$name); + } + + /** + * Sets the prefix to add to the path of all child routes. + * + * @param string $prefix + * + * @return $this + */ + final public function prefix($prefix) + { + $this->route->setPath($prefix); + + return $this; + } +} diff --git a/vendor/symfony/routing/Loader/Configurator/ImportConfigurator.php b/vendor/symfony/routing/Loader/Configurator/ImportConfigurator.php new file mode 100644 index 00000000..d0a3c373 --- /dev/null +++ b/vendor/symfony/routing/Loader/Configurator/ImportConfigurator.php @@ -0,0 +1,49 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Routing\Loader\Configurator; + +use Symfony\Component\Routing\RouteCollection; + +/** + * @author Nicolas Grekas <p@tchwork.com> + */ +class ImportConfigurator +{ + use Traits\RouteTrait; + + private $parent; + + public function __construct(RouteCollection $parent, RouteCollection $route) + { + $this->parent = $parent; + $this->route = $route; + } + + public function __destruct() + { + $this->parent->addCollection($this->route); + } + + /** + * Sets the prefix to add to the path of all child routes. + * + * @param string $prefix + * + * @return $this + */ + final public function prefix($prefix) + { + $this->route->addPrefix($prefix); + + return $this; + } +} diff --git a/vendor/symfony/routing/Loader/Configurator/RouteConfigurator.php b/vendor/symfony/routing/Loader/Configurator/RouteConfigurator.php new file mode 100644 index 00000000..b8d87025 --- /dev/null +++ b/vendor/symfony/routing/Loader/Configurator/RouteConfigurator.php @@ -0,0 +1,31 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Routing\Loader\Configurator; + +use Symfony\Component\Routing\Route; +use Symfony\Component\Routing\RouteCollection; + +/** + * @author Nicolas Grekas <p@tchwork.com> + */ +class RouteConfigurator +{ + use Traits\AddTrait; + use Traits\RouteTrait; + + public function __construct(RouteCollection $collection, Route $route, $name = '') + { + $this->collection = $collection; + $this->route = $route; + $this->name = $name; + } +} diff --git a/vendor/symfony/routing/Loader/Configurator/RoutingConfigurator.php b/vendor/symfony/routing/Loader/Configurator/RoutingConfigurator.php new file mode 100644 index 00000000..4591a86b --- /dev/null +++ b/vendor/symfony/routing/Loader/Configurator/RoutingConfigurator.php @@ -0,0 +1,54 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Routing\Loader\Configurator; + +use Symfony\Component\Routing\Loader\PhpFileLoader; +use Symfony\Component\Routing\RouteCollection; + +/** + * @author Nicolas Grekas <p@tchwork.com> + */ +class RoutingConfigurator +{ + use Traits\AddTrait; + + private $loader; + private $path; + private $file; + + public function __construct(RouteCollection $collection, PhpFileLoader $loader, $path, $file) + { + $this->collection = $collection; + $this->loader = $loader; + $this->path = $path; + $this->file = $file; + } + + /** + * @return ImportConfigurator + */ + final public function import($resource, $type = null, $ignoreErrors = false) + { + $this->loader->setCurrentDir(dirname($this->path)); + $subCollection = $this->loader->import($resource, $type, $ignoreErrors, $this->file); + + return new ImportConfigurator($this->collection, $subCollection); + } + + /** + * @return CollectionConfigurator + */ + final public function collection($name = '') + { + return new CollectionConfigurator($this->collection, $name); + } +} diff --git a/vendor/symfony/routing/Loader/Configurator/Traits/AddTrait.php b/vendor/symfony/routing/Loader/Configurator/Traits/AddTrait.php new file mode 100644 index 00000000..7171fd24 --- /dev/null +++ b/vendor/symfony/routing/Loader/Configurator/Traits/AddTrait.php @@ -0,0 +1,54 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Routing\Loader\Configurator\Traits; + +use Symfony\Component\Routing\Loader\Configurator\RouteConfigurator; +use Symfony\Component\Routing\Route; +use Symfony\Component\Routing\RouteCollection; + +trait AddTrait +{ + /** + * @var RouteCollection + */ + private $collection; + + private $name = ''; + + /** + * Adds a route. + * + * @param string $name + * @param string $path + * + * @return RouteConfigurator + */ + final public function add($name, $path) + { + $this->collection->add($this->name.$name, $route = new Route($path)); + + return new RouteConfigurator($this->collection, $route); + } + + /** + * Adds a route. + * + * @param string $name + * @param string $path + * + * @return RouteConfigurator + */ + final public function __invoke($name, $path) + { + return $this->add($name, $path); + } +} diff --git a/vendor/symfony/routing/Loader/Configurator/Traits/RouteTrait.php b/vendor/symfony/routing/Loader/Configurator/Traits/RouteTrait.php new file mode 100644 index 00000000..4d2e255b --- /dev/null +++ b/vendor/symfony/routing/Loader/Configurator/Traits/RouteTrait.php @@ -0,0 +1,131 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Routing\Loader\Configurator\Traits; + +use Symfony\Component\Routing\Route; +use Symfony\Component\Routing\RouteCollection; + +trait RouteTrait +{ + /** + * @var RouteCollection|Route + */ + private $route; + + /** + * Adds defaults. + * + * @return $this + */ + final public function defaults(array $defaults) + { + $this->route->addDefaults($defaults); + + return $this; + } + + /** + * Adds requirements. + * + * @return $this + */ + final public function requirements(array $requirements) + { + $this->route->addRequirements($requirements); + + return $this; + } + + /** + * Adds options. + * + * @return $this + */ + final public function options(array $options) + { + $this->route->addOptions($options); + + return $this; + } + + /** + * Sets the condition. + * + * @param string $condition + * + * @return $this + */ + final public function condition($condition) + { + $this->route->setCondition($condition); + + return $this; + } + + /** + * Sets the pattern for the host. + * + * @param string $pattern + * + * @return $this + */ + final public function host($pattern) + { + $this->route->setHost($pattern); + + return $this; + } + + /** + * Sets the schemes (e.g. 'https') this route is restricted to. + * So an empty array means that any scheme is allowed. + * + * @param string[] $schemes + * + * @return $this + */ + final public function schemes(array $schemes) + { + $this->route->setSchemes($schemes); + + return $this; + } + + /** + * Sets the HTTP methods (e.g. 'POST') this route is restricted to. + * So an empty array means that any method is allowed. + * + * @param string[] $methods + * + * @return $this + */ + final public function methods(array $methods) + { + $this->route->setMethods($methods); + + return $this; + } + + /** + * Adds the "_controller" entry to defaults. + * + * @param callable|string $controller a callable or parseable pseudo-callable + * + * @return $this + */ + final public function controller($controller) + { + $this->route->addDefaults(array('_controller' => $controller)); + + return $this; + } +} diff --git a/vendor/symfony/routing/Loader/PhpFileLoader.php b/vendor/symfony/routing/Loader/PhpFileLoader.php index b4ba5fbc..3fcd692f 100644 --- a/vendor/symfony/routing/Loader/PhpFileLoader.php +++ b/vendor/symfony/routing/Loader/PhpFileLoader.php @@ -13,6 +13,7 @@ namespace Symfony\Component\Routing\Loader; use Symfony\Component\Config\Loader\FileLoader; use Symfony\Component\Config\Resource\FileResource; +use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; use Symfony\Component\Routing\RouteCollection; /** @@ -37,7 +38,21 @@ class PhpFileLoader extends FileLoader $path = $this->locator->locate($file); $this->setCurrentDir(dirname($path)); - $collection = self::includeFile($path, $this); + // the closure forbids access to the private scope in the included file + $loader = $this; + $load = \Closure::bind(function ($file) use ($loader) { + return include $file; + }, null, ProtectedPhpFileLoader::class); + + $result = $load($path); + + if ($result instanceof \Closure) { + $collection = new RouteCollection(); + $result(new RoutingConfigurator($collection, $this, $path, $file), $this); + } else { + $collection = $result; + } + $collection->addResource(new FileResource($path)); return $collection; @@ -50,17 +65,11 @@ class PhpFileLoader extends FileLoader { return is_string($resource) && 'php' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'php' === $type); } +} - /** - * Safe include. Used for scope isolation. - * - * @param string $file File to include - * @param PhpFileLoader $loader the loader variable is exposed to the included file below - * - * @return RouteCollection - */ - private static function includeFile($file, PhpFileLoader $loader) - { - return include $file; - } +/** + * @internal + */ +final class ProtectedPhpFileLoader extends PhpFileLoader +{ } diff --git a/vendor/symfony/routing/Loader/XmlFileLoader.php b/vendor/symfony/routing/Loader/XmlFileLoader.php index 396047e7..3a778907 100644 --- a/vendor/symfony/routing/Loader/XmlFileLoader.php +++ b/vendor/symfony/routing/Loader/XmlFileLoader.php @@ -229,6 +229,16 @@ class XmlFileLoader extends FileLoader } } + if ($controller = $node->getAttribute('controller')) { + if (isset($defaults['_controller'])) { + $name = $node->hasAttribute('id') ? sprintf('"%s"', $node->getAttribute('id')) : sprintf('the "%s" tag', $node->tagName); + + throw new \InvalidArgumentException(sprintf('The routing file "%s" must not specify both the "controller" attribute and the defaults key "_controller" for %s.', $path, $name)); + } + + $defaults['_controller'] = $controller; + } + return array($defaults, $requirements, $options, $condition); } diff --git a/vendor/symfony/routing/Loader/YamlFileLoader.php b/vendor/symfony/routing/Loader/YamlFileLoader.php index 72935fa5..037d581d 100644 --- a/vendor/symfony/routing/Loader/YamlFileLoader.php +++ b/vendor/symfony/routing/Loader/YamlFileLoader.php @@ -17,7 +17,6 @@ use Symfony\Component\Config\Resource\FileResource; use Symfony\Component\Yaml\Exception\ParseException; use Symfony\Component\Yaml\Parser as YamlParser; use Symfony\Component\Config\Loader\FileLoader; -use Symfony\Component\Yaml\Yaml; /** * YamlFileLoader loads Yaml routing files. @@ -28,7 +27,7 @@ use Symfony\Component\Yaml\Yaml; class YamlFileLoader extends FileLoader { private static $availableKeys = array( - 'resource', 'type', 'prefix', 'path', 'host', 'schemes', 'methods', 'defaults', 'requirements', 'options', 'condition', + 'resource', 'type', 'prefix', 'path', 'host', 'schemes', 'methods', 'defaults', 'requirements', 'options', 'condition', 'controller', ); private $yamlParser; @@ -65,7 +64,7 @@ class YamlFileLoader extends FileLoader }); try { - $parsedConfig = $this->yamlParser->parse(file_get_contents($path), Yaml::PARSE_KEYS_AS_STRINGS); + $parsedConfig = $this->yamlParser->parseFile($path); } catch (ParseException $e) { throw new \InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML.', $path), 0, $e); } finally { @@ -124,6 +123,10 @@ class YamlFileLoader extends FileLoader $methods = isset($config['methods']) ? $config['methods'] : array(); $condition = isset($config['condition']) ? $config['condition'] : null; + if (isset($config['controller'])) { + $defaults['_controller'] = $config['controller']; + } + $route = new Route($config['path'], $defaults, $requirements, $options, $host, $schemes, $methods, $condition); $collection->add($name, $route); @@ -149,6 +152,10 @@ class YamlFileLoader extends FileLoader $schemes = isset($config['schemes']) ? $config['schemes'] : null; $methods = isset($config['methods']) ? $config['methods'] : null; + if (isset($config['controller'])) { + $defaults['_controller'] = $config['controller']; + } + $this->setCurrentDir(dirname($path)); $subCollection = $this->import($config['resource'], $type, false, $file); @@ -212,5 +219,8 @@ class YamlFileLoader extends FileLoader $name, $path )); } + if (isset($config['controller']) && isset($config['defaults']['_controller'])) { + throw new \InvalidArgumentException(sprintf('The routing file "%s" must not specify both the "controller" key and the defaults key "_controller" for "%s".', $path, $name)); + } } } diff --git a/vendor/symfony/routing/Loader/schema/routing/routing-1.0.xsd b/vendor/symfony/routing/Loader/schema/routing/routing-1.0.xsd index 92d4ae20..a97111aa 100644 --- a/vendor/symfony/routing/Loader/schema/routing/routing-1.0.xsd +++ b/vendor/symfony/routing/Loader/schema/routing/routing-1.0.xsd @@ -41,6 +41,7 @@ <xsd:attribute name="host" type="xsd:string" /> <xsd:attribute name="schemes" type="xsd:string" /> <xsd:attribute name="methods" type="xsd:string" /> + <xsd:attribute name="controller" type="xsd:string" /> </xsd:complexType> <xsd:complexType name="import"> @@ -52,6 +53,7 @@ <xsd:attribute name="host" type="xsd:string" /> <xsd:attribute name="schemes" type="xsd:string" /> <xsd:attribute name="methods" type="xsd:string" /> + <xsd:attribute name="controller" type="xsd:string" /> </xsd:complexType> <xsd:complexType name="default" mixed="true"> diff --git a/vendor/symfony/routing/Matcher/Dumper/DumperCollection.php b/vendor/symfony/routing/Matcher/Dumper/DumperCollection.php index b24c8512..6916297b 100644 --- a/vendor/symfony/routing/Matcher/Dumper/DumperCollection.php +++ b/vendor/symfony/routing/Matcher/Dumper/DumperCollection.php @@ -105,8 +105,6 @@ class DumperCollection implements \IteratorAggregate /** * Sets the parent collection. - * - * @param DumperCollection $parent The parent collection */ protected function setParent(DumperCollection $parent) { diff --git a/vendor/symfony/routing/Matcher/Dumper/DumperRoute.php b/vendor/symfony/routing/Matcher/Dumper/DumperRoute.php index c2e2a116..c71989a3 100644 --- a/vendor/symfony/routing/Matcher/Dumper/DumperRoute.php +++ b/vendor/symfony/routing/Matcher/Dumper/DumperRoute.php @@ -22,14 +22,7 @@ use Symfony\Component\Routing\Route; */ class DumperRoute { - /** - * @var string - */ private $name; - - /** - * @var Route - */ private $route; /** diff --git a/vendor/symfony/routing/Matcher/Dumper/MatcherDumper.php b/vendor/symfony/routing/Matcher/Dumper/MatcherDumper.php index 70c23f64..ea51ab40 100644 --- a/vendor/symfony/routing/Matcher/Dumper/MatcherDumper.php +++ b/vendor/symfony/routing/Matcher/Dumper/MatcherDumper.php @@ -20,14 +20,8 @@ use Symfony\Component\Routing\RouteCollection; */ abstract class MatcherDumper implements MatcherDumperInterface { - /** - * @var RouteCollection - */ private $routes; - /** - * @param RouteCollection $routes The RouteCollection to dump - */ public function __construct(RouteCollection $routes) { $this->routes = $routes; diff --git a/vendor/symfony/routing/Matcher/Dumper/PhpMatcherDumper.php b/vendor/symfony/routing/Matcher/Dumper/PhpMatcherDumper.php index e172135e..acb9eddb 100644 --- a/vendor/symfony/routing/Matcher/Dumper/PhpMatcherDumper.php +++ b/vendor/symfony/routing/Matcher/Dumper/PhpMatcherDumper.php @@ -96,10 +96,10 @@ EOF; $code = rtrim($this->compileRoutes($this->getRoutes(), $supportsRedirections), "\n"); return <<<EOF - public function match(\$pathinfo) + public function match(\$rawPathinfo) { \$allow = array(); - \$pathinfo = rawurldecode(\$pathinfo); + \$pathinfo = rawurldecode(\$rawPathinfo); \$trimmedPathinfo = rtrim(\$pathinfo, '/'); \$context = \$this->context; \$request = \$this->request; @@ -155,6 +155,12 @@ EOF; } } + if ('' === $code) { + $code .= " if ('/' === \$pathinfo) {\n"; + $code .= " throw new Symfony\Component\Routing\Exception\NoConfigurationException();\n"; + $code .= " }\n"; + } + return $code; } @@ -328,10 +334,35 @@ EOF; } } + // the offset where the return value is appended below, with indendation + $retOffset = 12 + strlen($code); + + // optimize parameters array + if ($matches || $hostMatches) { + $vars = array(); + if ($hostMatches) { + $vars[] = '$hostMatches'; + } + if ($matches) { + $vars[] = '$matches'; + } + $vars[] = "array('_route' => '$name')"; + + $code .= sprintf( + " \$ret = \$this->mergeDefaults(array_replace(%s), %s);\n", + implode(', ', $vars), + str_replace("\n", '', var_export($route->getDefaults(), true)) + ); + } elseif ($route->getDefaults()) { + $code .= sprintf(" \$ret = %s;\n", str_replace("\n", '', var_export(array_replace($route->getDefaults(), array('_route' => $name)), true))); + } else { + $code .= sprintf(" \$ret = array('_route' => '%s');\n", $name); + } + if ($hasTrailingSlash) { $code .= <<<EOF if (substr(\$pathinfo, -1) !== '/') { - return \$this->redirect(\$pathinfo.'/', '$name'); + return array_replace(\$ret, \$this->redirect(\$rawPathinfo.'/', '$name')); } @@ -346,33 +377,17 @@ EOF; $code .= <<<EOF \$requiredSchemes = $schemes; if (!isset(\$requiredSchemes[\$scheme])) { - return \$this->redirect(\$pathinfo, '$name', key(\$requiredSchemes)); + return array_replace(\$ret, \$this->redirect(\$rawPathinfo, '$name', key(\$requiredSchemes))); } EOF; } - // optimize parameters array - if ($matches || $hostMatches) { - $vars = array(); - if ($hostMatches) { - $vars[] = '$hostMatches'; - } - if ($matches) { - $vars[] = '$matches'; - } - $vars[] = "array('_route' => '$name')"; - - $code .= sprintf( - " return \$this->mergeDefaults(array_replace(%s), %s);\n", - implode(', ', $vars), - str_replace("\n", '', var_export($route->getDefaults(), true)) - ); - } elseif ($route->getDefaults()) { - $code .= sprintf(" return %s;\n", str_replace("\n", '', var_export(array_replace($route->getDefaults(), array('_route' => $name)), true))); + if ($hasTrailingSlash || $schemes) { + $code .= " return \$ret;\n"; } else { - $code .= sprintf(" return array('_route' => '%s');\n", $name); + $code = substr_replace($code, 'return', $retOffset, 6); } $code .= " }\n"; diff --git a/vendor/symfony/routing/Matcher/RedirectableUrlMatcher.php b/vendor/symfony/routing/Matcher/RedirectableUrlMatcher.php index 900c59fa..3770a9c2 100644 --- a/vendor/symfony/routing/Matcher/RedirectableUrlMatcher.php +++ b/vendor/symfony/routing/Matcher/RedirectableUrlMatcher.php @@ -32,9 +32,9 @@ abstract class RedirectableUrlMatcher extends UrlMatcher implements Redirectable } try { - parent::match($pathinfo.'/'); + $parameters = parent::match($pathinfo.'/'); - return $this->redirect($pathinfo.'/', null); + return array_replace($parameters, $this->redirect($pathinfo.'/', isset($parameters['_route']) ? $parameters['_route'] : null)); } catch (ResourceNotFoundException $e2) { throw $e; } diff --git a/vendor/symfony/routing/Matcher/RequestMatcherInterface.php b/vendor/symfony/routing/Matcher/RequestMatcherInterface.php index b5def3d4..1eef778a 100644 --- a/vendor/symfony/routing/Matcher/RequestMatcherInterface.php +++ b/vendor/symfony/routing/Matcher/RequestMatcherInterface.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Routing\Matcher; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Routing\Exception\NoConfigurationException; use Symfony\Component\Routing\Exception\ResourceNotFoundException; use Symfony\Component\Routing\Exception\MethodNotAllowedException; @@ -28,10 +29,9 @@ interface RequestMatcherInterface * If the matcher can not find information, it must throw one of the exceptions documented * below. * - * @param Request $request The request to match - * * @return array An array of parameters * + * @throws NoConfigurationException If no routing configuration could be found * @throws ResourceNotFoundException If no matching resource could be found * @throws MethodNotAllowedException If a matching resource was found but the request method is not allowed */ diff --git a/vendor/symfony/routing/Matcher/UrlMatcher.php b/vendor/symfony/routing/Matcher/UrlMatcher.php index 62bb74a8..3cba7e66 100644 --- a/vendor/symfony/routing/Matcher/UrlMatcher.php +++ b/vendor/symfony/routing/Matcher/UrlMatcher.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Routing\Matcher; use Symfony\Component\Routing\Exception\MethodNotAllowedException; +use Symfony\Component\Routing\Exception\NoConfigurationException; use Symfony\Component\Routing\Exception\ResourceNotFoundException; use Symfony\Component\Routing\RouteCollection; use Symfony\Component\Routing\RequestContext; @@ -31,21 +32,9 @@ class UrlMatcher implements UrlMatcherInterface, RequestMatcherInterface const REQUIREMENT_MISMATCH = 1; const ROUTE_MATCH = 2; - /** - * @var RequestContext - */ protected $context; - - /** - * @var array - */ protected $allow = array(); - - /** - * @var RouteCollection - */ protected $routes; - protected $request; protected $expressionLanguage; @@ -54,10 +43,6 @@ class UrlMatcher implements UrlMatcherInterface, RequestMatcherInterface */ protected $expressionLanguageProviders = array(); - /** - * @param RouteCollection $routes A RouteCollection instance - * @param RequestContext $context The context - */ public function __construct(RouteCollection $routes, RequestContext $context) { $this->routes = $routes; @@ -91,6 +76,10 @@ class UrlMatcher implements UrlMatcherInterface, RequestMatcherInterface return $ret; } + if (0 === count($this->routes) && '/' === $pathinfo) { + throw new NoConfigurationException(); + } + throw 0 < count($this->allow) ? new MethodNotAllowedException(array_unique($this->allow)) : new ResourceNotFoundException(sprintf('No routes found for "%s".', $pathinfo)); @@ -123,6 +112,7 @@ class UrlMatcher implements UrlMatcherInterface, RequestMatcherInterface * * @return array An array of parameters * + * @throws NoConfigurationException If no routing configuration could be found * @throws ResourceNotFoundException If the resource could not be found * @throws MethodNotAllowedException If the resource was found but the request method is not allowed */ @@ -161,15 +151,11 @@ class UrlMatcher implements UrlMatcherInterface, RequestMatcherInterface $status = $this->handleRouteRequirements($pathinfo, $name, $route); - if (self::ROUTE_MATCH === $status[0]) { - return $status[1]; - } - if (self::REQUIREMENT_MISMATCH === $status[0]) { continue; } - return $this->getAttributes($route, $name, array_replace($matches, $hostMatches)); + return $this->getAttributes($route, $name, array_replace($matches, $hostMatches, isset($status[1]) ? $status[1] : array())); } } diff --git a/vendor/symfony/routing/Matcher/UrlMatcherInterface.php b/vendor/symfony/routing/Matcher/UrlMatcherInterface.php index af38662f..2c7c3135 100644 --- a/vendor/symfony/routing/Matcher/UrlMatcherInterface.php +++ b/vendor/symfony/routing/Matcher/UrlMatcherInterface.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Routing\Matcher; +use Symfony\Component\Routing\Exception\NoConfigurationException; use Symfony\Component\Routing\RequestContextAwareInterface; use Symfony\Component\Routing\Exception\ResourceNotFoundException; use Symfony\Component\Routing\Exception\MethodNotAllowedException; @@ -32,6 +33,7 @@ interface UrlMatcherInterface extends RequestContextAwareInterface * * @return array An array of parameters * + * @throws NoConfigurationException If no routing configuration could be found * @throws ResourceNotFoundException If the resource could not be found * @throws MethodNotAllowedException If the resource was found but the request method is not allowed */ diff --git a/vendor/symfony/routing/RequestContext.php b/vendor/symfony/routing/RequestContext.php index d522189c..d62a7766 100644 --- a/vendor/symfony/routing/RequestContext.php +++ b/vendor/symfony/routing/RequestContext.php @@ -31,10 +31,6 @@ class RequestContext private $httpPort; private $httpsPort; private $queryString; - - /** - * @var array - */ private $parameters = array(); /** @@ -62,8 +58,6 @@ class RequestContext /** * Updates the RequestContext information based on a HttpFoundation Request. * - * @param Request $request A Request instance - * * @return $this */ public function fromRequest(Request $request) diff --git a/vendor/symfony/routing/RequestContextAwareInterface.php b/vendor/symfony/routing/RequestContextAwareInterface.php index ebb0ef46..df5b9fcd 100644 --- a/vendor/symfony/routing/RequestContextAwareInterface.php +++ b/vendor/symfony/routing/RequestContextAwareInterface.php @@ -15,8 +15,6 @@ interface RequestContextAwareInterface { /** * Sets the request context. - * - * @param RequestContext $context The context */ public function setContext(RequestContext $context); diff --git a/vendor/symfony/routing/Route.php b/vendor/symfony/routing/Route.php index dd4eb840..cd50ac82 100644 --- a/vendor/symfony/routing/Route.php +++ b/vendor/symfony/routing/Route.php @@ -19,40 +19,14 @@ namespace Symfony\Component\Routing; */ class Route implements \Serializable { - /** - * @var string - */ private $path = '/'; - - /** - * @var string - */ private $host = ''; - - /** - * @var string[] - */ private $schemes = array(); - - /** - * @var string[] - */ private $methods = array(); - - /** - * @var array - */ private $defaults = array(); - - /** - * @var array - */ private $requirements = array(); - - /** - * @var array - */ private $options = array(); + private $condition = ''; /** * @var null|CompiledRoute @@ -60,11 +34,8 @@ class Route implements \Serializable private $compiled; /** - * @var string - */ - private $condition = ''; - - /** + * Constructor. + * * Available options: * * * compiler_class: A class name able to compile this route instance (RouteCompiler by default) diff --git a/vendor/symfony/routing/RouteCollection.php b/vendor/symfony/routing/RouteCollection.php index f8b18084..feabf234 100644 --- a/vendor/symfony/routing/RouteCollection.php +++ b/vendor/symfony/routing/RouteCollection.php @@ -116,8 +116,6 @@ class RouteCollection implements \IteratorAggregate, \Countable /** * Adds a route collection at the end of the current set by appending all * routes of the added collection. - * - * @param RouteCollection $collection A RouteCollection instance */ public function addCollection(RouteCollection $collection) { @@ -128,7 +126,9 @@ class RouteCollection implements \IteratorAggregate, \Countable $this->routes[$name] = $route; } - $this->resources = array_merge($this->resources, $collection->getResources()); + foreach ($collection->getResources() as $resource) { + $this->addResource($resource); + } } /** @@ -262,16 +262,19 @@ class RouteCollection implements \IteratorAggregate, \Countable */ public function getResources() { - return array_unique($this->resources); + return array_values($this->resources); } /** - * Adds a resource for this collection. - * - * @param ResourceInterface $resource A resource instance + * Adds a resource for this collection. If the resource already exists + * it is not added. */ public function addResource(ResourceInterface $resource) { - $this->resources[] = $resource; + $key = (string) $resource; + + if (!isset($this->resources[$key])) { + $this->resources[$key] = $resource; + } } } diff --git a/vendor/symfony/routing/RouteCollectionBuilder.php b/vendor/symfony/routing/RouteCollectionBuilder.php index 54bd86b7..e8a9a165 100644 --- a/vendor/symfony/routing/RouteCollectionBuilder.php +++ b/vendor/symfony/routing/RouteCollectionBuilder.php @@ -38,9 +38,6 @@ class RouteCollectionBuilder private $methods; private $resources = array(); - /** - * @param LoaderInterface $loader - */ public function __construct(LoaderInterface $loader = null) { $this->loader = $loader; @@ -79,11 +76,11 @@ class RouteCollectionBuilder foreach ($collection->getResources() as $resource) { $builder->addResource($resource); } - - // mount into this builder - $this->mount($prefix, $builder); } + // mount into this builder + $this->mount($prefix, $builder); + return $builder; } @@ -318,10 +315,10 @@ class RouteCollectionBuilder $routeCollection->addCollection($subCollection); } + } - foreach ($this->resources as $resource) { - $routeCollection->addResource($resource); - } + foreach ($this->resources as $resource) { + $routeCollection->addResource($resource); } return $routeCollection; diff --git a/vendor/symfony/routing/RouteCompiler.php b/vendor/symfony/routing/RouteCompiler.php index fc6a182b..9b5526f3 100644 --- a/vendor/symfony/routing/RouteCompiler.php +++ b/vendor/symfony/routing/RouteCompiler.php @@ -233,9 +233,6 @@ class RouteCompiler implements RouteCompilerInterface /** * Determines the longest static prefix possible for a route. * - * @param Route $route - * @param array $tokens - * * @return string The leading static part of a route's path */ private static function determineStaticPrefix(Route $route, array $tokens) diff --git a/vendor/symfony/routing/RouteCompilerInterface.php b/vendor/symfony/routing/RouteCompilerInterface.php index e6f8ee6d..ddfa7ca4 100644 --- a/vendor/symfony/routing/RouteCompilerInterface.php +++ b/vendor/symfony/routing/RouteCompilerInterface.php @@ -21,8 +21,6 @@ interface RouteCompilerInterface /** * Compiles the current route instance. * - * @param Route $route A Route instance - * * @return CompiledRoute A CompiledRoute instance * * @throws \LogicException If the Route cannot be compiled because the diff --git a/vendor/symfony/routing/Router.php b/vendor/symfony/routing/Router.php index e93cd65c..0de92185 100644 --- a/vendor/symfony/routing/Router.php +++ b/vendor/symfony/routing/Router.php @@ -226,8 +226,6 @@ class Router implements RouterInterface, RequestMatcherInterface /** * Sets the ConfigCache factory to use. - * - * @param ConfigCacheFactoryInterface $configCacheFactory The factory to use */ public function setConfigCacheFactory(ConfigCacheFactoryInterface $configCacheFactory) { diff --git a/vendor/symfony/routing/Tests/CompiledRouteTest.php b/vendor/symfony/routing/Tests/CompiledRouteTest.php index c5531795..5bec7bbd 100644 --- a/vendor/symfony/routing/Tests/CompiledRouteTest.php +++ b/vendor/symfony/routing/Tests/CompiledRouteTest.php @@ -18,7 +18,7 @@ class CompiledRouteTest extends TestCase { public function testAccessors() { - $compiled = new CompiledRoute('prefix', 'regex', array('tokens'), array(), array(), array(), array(), array('variables')); + $compiled = new CompiledRoute('prefix', 'regex', array('tokens'), array(), null, array(), array(), array('variables')); $this->assertEquals('prefix', $compiled->getStaticPrefix(), '__construct() takes a static prefix as its second argument'); $this->assertEquals('regex', $compiled->getRegex(), '__construct() takes a regexp as its third argument'); $this->assertEquals(array('tokens'), $compiled->getTokens(), '__construct() takes an array of tokens as its fourth argument'); diff --git a/vendor/symfony/routing/Tests/Fixtures/OtherAnnotatedClasses/AnonymousClassInTrait.php b/vendor/symfony/routing/Tests/Fixtures/OtherAnnotatedClasses/AnonymousClassInTrait.php new file mode 100644 index 00000000..de878956 --- /dev/null +++ b/vendor/symfony/routing/Tests/Fixtures/OtherAnnotatedClasses/AnonymousClassInTrait.php @@ -0,0 +1,24 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Routing\Tests\Fixtures\OtherAnnotatedClasses; + +trait AnonymousClassInTrait +{ + public function test() + { + return new class() { + public function foo() + { + } + }; + } +} diff --git a/vendor/symfony/routing/Tests/Fixtures/controller/import__controller.xml b/vendor/symfony/routing/Tests/Fixtures/controller/import__controller.xml new file mode 100644 index 00000000..bbe727d4 --- /dev/null +++ b/vendor/symfony/routing/Tests/Fixtures/controller/import__controller.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<routes xmlns="http://symfony.com/schema/routing" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://symfony.com/schema/routing + http://symfony.com/schema/routing/routing-1.0.xsd"> + + <import resource="routing.xml"> + <default key="_controller">FrameworkBundle:Template:template</default> + </import> +</routes> diff --git a/vendor/symfony/routing/Tests/Fixtures/controller/import__controller.yml b/vendor/symfony/routing/Tests/Fixtures/controller/import__controller.yml new file mode 100644 index 00000000..4240b74d --- /dev/null +++ b/vendor/symfony/routing/Tests/Fixtures/controller/import__controller.yml @@ -0,0 +1,4 @@ +_static: + resource: routing.yml + defaults: + _controller: FrameworkBundle:Template:template diff --git a/vendor/symfony/routing/Tests/Fixtures/controller/import_controller.xml b/vendor/symfony/routing/Tests/Fixtures/controller/import_controller.xml new file mode 100644 index 00000000..378b9ca1 --- /dev/null +++ b/vendor/symfony/routing/Tests/Fixtures/controller/import_controller.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<routes xmlns="http://symfony.com/schema/routing" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://symfony.com/schema/routing + http://symfony.com/schema/routing/routing-1.0.xsd"> + + <import resource="routing.xml" controller="FrameworkBundle:Template:template" /> +</routes> diff --git a/vendor/symfony/routing/Tests/Fixtures/controller/import_controller.yml b/vendor/symfony/routing/Tests/Fixtures/controller/import_controller.yml new file mode 100644 index 00000000..1a71c62b --- /dev/null +++ b/vendor/symfony/routing/Tests/Fixtures/controller/import_controller.yml @@ -0,0 +1,3 @@ +_static: + resource: routing.yml + controller: FrameworkBundle:Template:template diff --git a/vendor/symfony/routing/Tests/Fixtures/controller/import_override_defaults.xml b/vendor/symfony/routing/Tests/Fixtures/controller/import_override_defaults.xml new file mode 100644 index 00000000..e3c755a4 --- /dev/null +++ b/vendor/symfony/routing/Tests/Fixtures/controller/import_override_defaults.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<routes xmlns="http://symfony.com/schema/routing" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://symfony.com/schema/routing + http://symfony.com/schema/routing/routing-1.0.xsd"> + + <import resource="routing.xml" controller="FrameworkBundle:Template:template"> + <default key="_controller">AppBundle:Blog:index</default> + </import> +</routes> diff --git a/vendor/symfony/routing/Tests/Fixtures/controller/import_override_defaults.yml b/vendor/symfony/routing/Tests/Fixtures/controller/import_override_defaults.yml new file mode 100644 index 00000000..db1ab3cb --- /dev/null +++ b/vendor/symfony/routing/Tests/Fixtures/controller/import_override_defaults.yml @@ -0,0 +1,5 @@ +_static: + resource: routing.yml + controller: FrameworkBundle:Template:template + defaults: + _controller: AppBundle:Homepage:show diff --git a/vendor/symfony/routing/Tests/Fixtures/controller/override_defaults.xml b/vendor/symfony/routing/Tests/Fixtures/controller/override_defaults.xml new file mode 100644 index 00000000..f47c57b3 --- /dev/null +++ b/vendor/symfony/routing/Tests/Fixtures/controller/override_defaults.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<routes xmlns="http://symfony.com/schema/routing" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://symfony.com/schema/routing + http://symfony.com/schema/routing/routing-1.0.xsd"> + + <route id="app_blog" path="/blog" controller="AppBundle:Homepage:show"> + <default key="_controller">AppBundle:Blog:index</default> + </route> +</routes> diff --git a/vendor/symfony/routing/Tests/Fixtures/controller/override_defaults.yml b/vendor/symfony/routing/Tests/Fixtures/controller/override_defaults.yml new file mode 100644 index 00000000..00a2c0e9 --- /dev/null +++ b/vendor/symfony/routing/Tests/Fixtures/controller/override_defaults.yml @@ -0,0 +1,5 @@ +app_blog: + path: /blog + controller: AppBundle:Homepage:show + defaults: + _controller: AppBundle:Blog:index diff --git a/vendor/symfony/routing/Tests/Fixtures/controller/routing.xml b/vendor/symfony/routing/Tests/Fixtures/controller/routing.xml new file mode 100644 index 00000000..6420138a --- /dev/null +++ b/vendor/symfony/routing/Tests/Fixtures/controller/routing.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<routes xmlns="http://symfony.com/schema/routing" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://symfony.com/schema/routing + http://symfony.com/schema/routing/routing-1.0.xsd"> + + <route id="app_homepage" path="/" controller="AppBundle:Homepage:show" /> + + <route id="app_blog" path="/blog"> + <default key="_controller">AppBundle:Blog:list</default> + </route> + + <route id="app_logout" path="/logout" /> +</routes> diff --git a/vendor/symfony/routing/Tests/Fixtures/controller/routing.yml b/vendor/symfony/routing/Tests/Fixtures/controller/routing.yml new file mode 100644 index 00000000..cb71ec3b --- /dev/null +++ b/vendor/symfony/routing/Tests/Fixtures/controller/routing.yml @@ -0,0 +1,11 @@ +app_homepage: + path: / + controller: AppBundle:Homepage:show + +app_blog: + path: /blog + defaults: + _controller: AppBundle:Blog:list + +app_logout: + path: /logout diff --git a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher0.php b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher0.php new file mode 100644 index 00000000..839c7d13 --- /dev/null +++ b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher0.php @@ -0,0 +1,39 @@ +<?php + +use Symfony\Component\Routing\Exception\MethodNotAllowedException; +use Symfony\Component\Routing\Exception\ResourceNotFoundException; +use Symfony\Component\Routing\RequestContext; + +/** + * This class has been auto-generated + * by the Symfony Routing Component. + */ +class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher +{ + public function __construct(RequestContext $context) + { + $this->context = $context; + } + + public function match($rawPathinfo) + { + $allow = array(); + $pathinfo = rawurldecode($rawPathinfo); + $trimmedPathinfo = rtrim($pathinfo, '/'); + $context = $this->context; + $request = $this->request; + $requestMethod = $canonicalMethod = $context->getMethod(); + $scheme = $context->getScheme(); + + if ('HEAD' === $requestMethod) { + $canonicalMethod = 'GET'; + } + + + if ('/' === $pathinfo) { + throw new Symfony\Component\Routing\Exception\NoConfigurationException(); + } + + throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException(); + } +} diff --git a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher1.php b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher1.php index 51fd29e8..5d7dca8e 100644 --- a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher1.php +++ b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher1.php @@ -15,10 +15,10 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher $this->context = $context; } - public function match($pathinfo) + public function match($rawPathinfo) { $allow = array(); - $pathinfo = rawurldecode($pathinfo); + $pathinfo = rawurldecode($rawPathinfo); $trimmedPathinfo = rtrim($pathinfo, '/'); $context = $this->context; $request = $this->request; diff --git a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher2.php b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher2.php index 008f7c3a..49ce082a 100644 --- a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher2.php +++ b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher2.php @@ -15,10 +15,10 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec $this->context = $context; } - public function match($pathinfo) + public function match($rawPathinfo) { $allow = array(); - $pathinfo = rawurldecode($pathinfo); + $pathinfo = rawurldecode($rawPathinfo); $trimmedPathinfo = rtrim($pathinfo, '/'); $context = $this->context; $request = $this->request; @@ -82,22 +82,24 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec // baz3 if ('/test/baz3' === $trimmedPathinfo) { + $ret = array('_route' => 'baz3'); if (substr($pathinfo, -1) !== '/') { - return $this->redirect($pathinfo.'/', 'baz3'); + return array_replace($ret, $this->redirect($rawPathinfo.'/', 'baz3')); } - return array('_route' => 'baz3'); + return $ret; } } // baz4 if (preg_match('#^/test/(?P<foo>[^/]++)/?$#s', $pathinfo, $matches)) { + $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'baz4')), array ()); if (substr($pathinfo, -1) !== '/') { - return $this->redirect($pathinfo.'/', 'baz4'); + return array_replace($ret, $this->redirect($rawPathinfo.'/', 'baz4')); } - return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz4')), array ()); + return $ret; } // baz5 @@ -176,11 +178,12 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec // hey if ('/multi/hey' === $trimmedPathinfo) { + $ret = array('_route' => 'hey'); if (substr($pathinfo, -1) !== '/') { - return $this->redirect($pathinfo.'/', 'hey'); + return array_replace($ret, $this->redirect($rawPathinfo.'/', 'hey')); } - return array('_route' => 'hey'); + return $ret; } // overridden2 @@ -321,22 +324,24 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec // secure if ('/secure' === $pathinfo) { + $ret = array('_route' => 'secure'); $requiredSchemes = array ( 'https' => 0,); if (!isset($requiredSchemes[$scheme])) { - return $this->redirect($pathinfo, 'secure', key($requiredSchemes)); + return array_replace($ret, $this->redirect($rawPathinfo, 'secure', key($requiredSchemes))); } - return array('_route' => 'secure'); + return $ret; } // nonsecure if ('/nonsecure' === $pathinfo) { + $ret = array('_route' => 'nonsecure'); $requiredSchemes = array ( 'http' => 0,); if (!isset($requiredSchemes[$scheme])) { - return $this->redirect($pathinfo, 'nonsecure', key($requiredSchemes)); + return array_replace($ret, $this->redirect($rawPathinfo, 'nonsecure', key($requiredSchemes))); } - return array('_route' => 'nonsecure'); + return $ret; } throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException(); diff --git a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher3.php b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher3.php index c982a454..ae549563 100644 --- a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher3.php +++ b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher3.php @@ -15,10 +15,10 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher $this->context = $context; } - public function match($pathinfo) + public function match($rawPathinfo) { $allow = array(); - $pathinfo = rawurldecode($pathinfo); + $pathinfo = rawurldecode($rawPathinfo); $trimmedPathinfo = rtrim($pathinfo, '/'); $context = $this->context; $request = $this->request; diff --git a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher4.php b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher4.php index 6aefd693..50da489f 100644 --- a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher4.php +++ b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher4.php @@ -15,10 +15,10 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher $this->context = $context; } - public function match($pathinfo) + public function match($rawPathinfo) { $allow = array(); - $pathinfo = rawurldecode($pathinfo); + $pathinfo = rawurldecode($rawPathinfo); $trimmedPathinfo = rtrim($pathinfo, '/'); $context = $this->context; $request = $this->request; diff --git a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher5.php b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher5.php index 1884df1c..51be5b0b 100644 --- a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher5.php +++ b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher5.php @@ -15,10 +15,10 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec $this->context = $context; } - public function match($pathinfo) + public function match($rawPathinfo) { $allow = array(); - $pathinfo = rawurldecode($pathinfo); + $pathinfo = rawurldecode($rawPathinfo); $trimmedPathinfo = rtrim($pathinfo, '/'); $context = $this->context; $request = $this->request; @@ -56,29 +56,32 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec if (0 === strpos($pathinfo, '/a')) { // a_fourth if ('/a/44' === $trimmedPathinfo) { + $ret = array('_route' => 'a_fourth'); if (substr($pathinfo, -1) !== '/') { - return $this->redirect($pathinfo.'/', 'a_fourth'); + return array_replace($ret, $this->redirect($rawPathinfo.'/', 'a_fourth')); } - return array('_route' => 'a_fourth'); + return $ret; } // a_fifth if ('/a/55' === $trimmedPathinfo) { + $ret = array('_route' => 'a_fifth'); if (substr($pathinfo, -1) !== '/') { - return $this->redirect($pathinfo.'/', 'a_fifth'); + return array_replace($ret, $this->redirect($rawPathinfo.'/', 'a_fifth')); } - return array('_route' => 'a_fifth'); + return $ret; } // a_sixth if ('/a/66' === $trimmedPathinfo) { + $ret = array('_route' => 'a_sixth'); if (substr($pathinfo, -1) !== '/') { - return $this->redirect($pathinfo.'/', 'a_sixth'); + return array_replace($ret, $this->redirect($rawPathinfo.'/', 'a_sixth')); } - return array('_route' => 'a_sixth'); + return $ret; } } @@ -91,29 +94,32 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec if (0 === strpos($pathinfo, '/nested/group')) { // nested_a if ('/nested/group/a' === $trimmedPathinfo) { + $ret = array('_route' => 'nested_a'); if (substr($pathinfo, -1) !== '/') { - return $this->redirect($pathinfo.'/', 'nested_a'); + return array_replace($ret, $this->redirect($rawPathinfo.'/', 'nested_a')); } - return array('_route' => 'nested_a'); + return $ret; } // nested_b if ('/nested/group/b' === $trimmedPathinfo) { + $ret = array('_route' => 'nested_b'); if (substr($pathinfo, -1) !== '/') { - return $this->redirect($pathinfo.'/', 'nested_b'); + return array_replace($ret, $this->redirect($rawPathinfo.'/', 'nested_b')); } - return array('_route' => 'nested_b'); + return $ret; } // nested_c if ('/nested/group/c' === $trimmedPathinfo) { + $ret = array('_route' => 'nested_c'); if (substr($pathinfo, -1) !== '/') { - return $this->redirect($pathinfo.'/', 'nested_c'); + return array_replace($ret, $this->redirect($rawPathinfo.'/', 'nested_c')); } - return array('_route' => 'nested_c'); + return $ret; } } @@ -121,29 +127,32 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec elseif (0 === strpos($pathinfo, '/slashed/group')) { // slashed_a if ('/slashed/group' === $trimmedPathinfo) { + $ret = array('_route' => 'slashed_a'); if (substr($pathinfo, -1) !== '/') { - return $this->redirect($pathinfo.'/', 'slashed_a'); + return array_replace($ret, $this->redirect($rawPathinfo.'/', 'slashed_a')); } - return array('_route' => 'slashed_a'); + return $ret; } // slashed_b if ('/slashed/group/b' === $trimmedPathinfo) { + $ret = array('_route' => 'slashed_b'); if (substr($pathinfo, -1) !== '/') { - return $this->redirect($pathinfo.'/', 'slashed_b'); + return array_replace($ret, $this->redirect($rawPathinfo.'/', 'slashed_b')); } - return array('_route' => 'slashed_b'); + return $ret; } // slashed_c if ('/slashed/group/c' === $trimmedPathinfo) { + $ret = array('_route' => 'slashed_c'); if (substr($pathinfo, -1) !== '/') { - return $this->redirect($pathinfo.'/', 'slashed_c'); + return array_replace($ret, $this->redirect($rawPathinfo.'/', 'slashed_c')); } - return array('_route' => 'slashed_c'); + return $ret; } } diff --git a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher6.php b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher6.php index bb9d80b5..93352569 100644 --- a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher6.php +++ b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher6.php @@ -15,10 +15,10 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher $this->context = $context; } - public function match($pathinfo) + public function match($rawPathinfo) { $allow = array(); - $pathinfo = rawurldecode($pathinfo); + $pathinfo = rawurldecode($rawPathinfo); $trimmedPathinfo = rtrim($pathinfo, '/'); $context = $this->context; $request = $this->request; diff --git a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher7.php b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher7.php index 404d462e..bceee6f3 100644 --- a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher7.php +++ b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher7.php @@ -15,10 +15,10 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec $this->context = $context; } - public function match($pathinfo) + public function match($rawPathinfo) { $allow = array(); - $pathinfo = rawurldecode($pathinfo); + $pathinfo = rawurldecode($rawPathinfo); $trimmedPathinfo = rtrim($pathinfo, '/'); $context = $this->context; $request = $this->request; @@ -33,11 +33,12 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec if (0 === strpos($pathinfo, '/trailing/simple')) { // simple_trailing_slash_no_methods if ('/trailing/simple/no-methods' === $trimmedPathinfo) { + $ret = array('_route' => 'simple_trailing_slash_no_methods'); if (substr($pathinfo, -1) !== '/') { - return $this->redirect($pathinfo.'/', 'simple_trailing_slash_no_methods'); + return array_replace($ret, $this->redirect($rawPathinfo.'/', 'simple_trailing_slash_no_methods')); } - return array('_route' => 'simple_trailing_slash_no_methods'); + return $ret; } // simple_trailing_slash_GET_method @@ -47,11 +48,12 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec goto not_simple_trailing_slash_GET_method; } + $ret = array('_route' => 'simple_trailing_slash_GET_method'); if (substr($pathinfo, -1) !== '/') { - return $this->redirect($pathinfo.'/', 'simple_trailing_slash_GET_method'); + return array_replace($ret, $this->redirect($rawPathinfo.'/', 'simple_trailing_slash_GET_method')); } - return array('_route' => 'simple_trailing_slash_GET_method'); + return $ret; } not_simple_trailing_slash_GET_method: @@ -62,11 +64,12 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec goto not_simple_trailing_slash_HEAD_method; } + $ret = array('_route' => 'simple_trailing_slash_HEAD_method'); if (substr($pathinfo, -1) !== '/') { - return $this->redirect($pathinfo.'/', 'simple_trailing_slash_HEAD_method'); + return array_replace($ret, $this->redirect($rawPathinfo.'/', 'simple_trailing_slash_HEAD_method')); } - return array('_route' => 'simple_trailing_slash_HEAD_method'); + return $ret; } not_simple_trailing_slash_HEAD_method: @@ -86,11 +89,12 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec elseif (0 === strpos($pathinfo, '/trailing/regex')) { // regex_trailing_slash_no_methods if (0 === strpos($pathinfo, '/trailing/regex/no-methods') && preg_match('#^/trailing/regex/no\\-methods/(?P<param>[^/]++)/?$#s', $pathinfo, $matches)) { + $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_no_methods')), array ()); if (substr($pathinfo, -1) !== '/') { - return $this->redirect($pathinfo.'/', 'regex_trailing_slash_no_methods'); + return array_replace($ret, $this->redirect($rawPathinfo.'/', 'regex_trailing_slash_no_methods')); } - return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_no_methods')), array ()); + return $ret; } // regex_trailing_slash_GET_method @@ -100,11 +104,12 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec goto not_regex_trailing_slash_GET_method; } + $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_GET_method')), array ()); if (substr($pathinfo, -1) !== '/') { - return $this->redirect($pathinfo.'/', 'regex_trailing_slash_GET_method'); + return array_replace($ret, $this->redirect($rawPathinfo.'/', 'regex_trailing_slash_GET_method')); } - return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_GET_method')), array ()); + return $ret; } not_regex_trailing_slash_GET_method: @@ -115,11 +120,12 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec goto not_regex_trailing_slash_HEAD_method; } + $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_HEAD_method')), array ()); if (substr($pathinfo, -1) !== '/') { - return $this->redirect($pathinfo.'/', 'regex_trailing_slash_HEAD_method'); + return array_replace($ret, $this->redirect($rawPathinfo.'/', 'regex_trailing_slash_HEAD_method')); } - return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_HEAD_method')), array ()); + return $ret; } not_regex_trailing_slash_HEAD_method: diff --git a/vendor/symfony/routing/Tests/Fixtures/php_dsl.php b/vendor/symfony/routing/Tests/Fixtures/php_dsl.php new file mode 100644 index 00000000..04f6d7ed --- /dev/null +++ b/vendor/symfony/routing/Tests/Fixtures/php_dsl.php @@ -0,0 +1,21 @@ +<?php + +namespace Symfony\Component\Routing\Loader\Configurator; + +return function (RoutingConfigurator $routes) { + $routes + ->add('foo', '/foo') + ->condition('abc') + ->options(array('utf8' => true)) + ->add('buz', 'zub') + ->controller('foo:act'); + + $routes->import('php_dsl_sub.php') + ->prefix('/sub') + ->requirements(array('id' => '\d+')); + + $routes->add('ouf', '/ouf') + ->schemes(array('https')) + ->methods(array('GET')) + ->defaults(array('id' => 0)); +}; diff --git a/vendor/symfony/routing/Tests/Fixtures/php_dsl_sub.php b/vendor/symfony/routing/Tests/Fixtures/php_dsl_sub.php new file mode 100644 index 00000000..9eb444de --- /dev/null +++ b/vendor/symfony/routing/Tests/Fixtures/php_dsl_sub.php @@ -0,0 +1,14 @@ +<?php + +namespace Symfony\Component\Routing\Loader\Configurator; + +return function (RoutingConfigurator $routes) { + $add = $routes->collection('c_') + ->prefix('pub'); + + $add('bar', '/bar'); + + $add->collection('pub_') + ->host('host') + ->add('buz', 'buz'); +}; diff --git a/vendor/symfony/routing/Tests/Generator/UrlGeneratorTest.php b/vendor/symfony/routing/Tests/Generator/UrlGeneratorTest.php index e334e437..68add771 100644 --- a/vendor/symfony/routing/Tests/Generator/UrlGeneratorTest.php +++ b/vendor/symfony/routing/Tests/Generator/UrlGeneratorTest.php @@ -478,6 +478,38 @@ class UrlGeneratorTest extends TestCase $this->assertSame('//EN.FooBar.com/app.php/', $generator->generate('test', array('locale' => 'EN'), UrlGeneratorInterface::NETWORK_PATH)); } + public function testDefaultHostIsUsedWhenContextHostIsEmpty() + { + $routes = $this->getRoutes('test', new Route('/route', array('domain' => 'my.fallback.host'), array('domain' => '.+'), array(), '{domain}', array('http'))); + + $generator = $this->getGenerator($routes); + $generator->getContext()->setHost(''); + + $this->assertSame('http://my.fallback.host/app.php/route', $generator->generate('test', array(), UrlGeneratorInterface::ABSOLUTE_URL)); + } + + public function testDefaultHostIsUsedWhenContextHostIsEmptyAndSchemeIsNot() + { + $routes = $this->getRoutes('test', new Route('/route', array('domain' => 'my.fallback.host'), array('domain' => '.+'), array(), '{domain}', array('http', 'https'))); + + $generator = $this->getGenerator($routes); + $generator->getContext()->setHost(''); + $generator->getContext()->setScheme('https'); + + $this->assertSame('https://my.fallback.host/app.php/route', $generator->generate('test', array(), UrlGeneratorInterface::ABSOLUTE_URL)); + } + + public function testAbsoluteUrlFallbackToRelativeIfHostIsEmptyAndSchemeIsNot() + { + $routes = $this->getRoutes('test', new Route('/route', array(), array(), array(), '', array('http', 'https'))); + + $generator = $this->getGenerator($routes); + $generator->getContext()->setHost(''); + $generator->getContext()->setScheme('https'); + + $this->assertSame('/app.php/route', $generator->generate('test', array(), UrlGeneratorInterface::ABSOLUTE_URL)); + } + public function testGenerateNetworkPath() { $routes = $this->getRoutes('test', new Route('/{name}', array(), array(), array(), '{locale}.example.com', array('http'))); diff --git a/vendor/symfony/routing/Tests/Loader/AnnotationClassLoaderTest.php b/vendor/symfony/routing/Tests/Loader/AnnotationClassLoaderTest.php index bf2ab4ac..70db1ccd 100644 --- a/vendor/symfony/routing/Tests/Loader/AnnotationClassLoaderTest.php +++ b/vendor/symfony/routing/Tests/Loader/AnnotationClassLoaderTest.php @@ -149,6 +149,7 @@ class AnnotationClassLoaderTest extends AbstractAnnotationLoaderTest public function testClassRouteLoad() { $classRouteData = array( + 'name' => 'prefix_', 'path' => '/prefix', 'schemes' => array('https'), 'methods' => array('GET'), @@ -173,7 +174,7 @@ class AnnotationClassLoaderTest extends AbstractAnnotationLoaderTest ; $routeCollection = $this->loader->load('Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BarClass'); - $route = $routeCollection->get($methodRouteData['name']); + $route = $routeCollection->get($classRouteData['name'].$methodRouteData['name']); $this->assertSame($classRouteData['path'].$methodRouteData['path'], $route->getPath(), '->load concatenates class and method route path'); $this->assertEquals(array_merge($classRouteData['schemes'], $methodRouteData['schemes']), $route->getSchemes(), '->load merges class and method route schemes'); @@ -240,7 +241,7 @@ class AnnotationClassLoaderTest extends AbstractAnnotationLoaderTest $this->assertNull($route, '->load ignores class route'); - $route = $routeCollection->get($methodRouteData['name']); + $route = $routeCollection->get($classRouteData['name'].$methodRouteData['name']); $this->assertSame($classRouteData['path'].$methodRouteData['path'], $route->getPath(), '->load concatenates class and method route path'); $this->assertEquals(array_merge($classRouteData['schemes'], $methodRouteData['schemes']), $route->getSchemes(), '->load merges class and method route schemes'); diff --git a/vendor/symfony/routing/Tests/Loader/AnnotationDirectoryLoaderTest.php b/vendor/symfony/routing/Tests/Loader/AnnotationDirectoryLoaderTest.php index 78cec4be..1e8ee394 100644 --- a/vendor/symfony/routing/Tests/Loader/AnnotationDirectoryLoaderTest.php +++ b/vendor/symfony/routing/Tests/Loader/AnnotationDirectoryLoaderTest.php @@ -69,6 +69,24 @@ class AnnotationDirectoryLoaderTest extends AbstractAnnotationLoaderTest $this->assertFalse($this->loader->supports($fixturesDir, 'foo'), '->supports() checks the resource type if specified'); } + public function testItSupportsAnyAnnotation() + { + $this->assertTrue($this->loader->supports(__DIR__.'/../Fixtures/even-with-not-existing-folder', 'annotation')); + } + + public function testLoadFileIfLocatedResourceIsFile() + { + $this->reader->expects($this->exactly(1))->method('getClassAnnotation'); + + $this->reader + ->expects($this->any()) + ->method('getMethodAnnotations') + ->will($this->returnValue(array())) + ; + + $this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses/FooClass.php'); + } + private function expectAnnotationsToBeReadFrom(array $classes) { $this->reader->expects($this->exactly(count($classes))) diff --git a/vendor/symfony/routing/Tests/Loader/AnnotationFileLoaderTest.php b/vendor/symfony/routing/Tests/Loader/AnnotationFileLoaderTest.php index 5d54f9f9..7f1d5765 100644 --- a/vendor/symfony/routing/Tests/Loader/AnnotationFileLoaderTest.php +++ b/vendor/symfony/routing/Tests/Loader/AnnotationFileLoaderTest.php @@ -67,6 +67,17 @@ class AnnotationFileLoaderTest extends AbstractAnnotationLoaderTest $this->loader->load(__DIR__.'/../Fixtures/OtherAnnotatedClasses/VariadicClass.php'); } + /** + * @requires PHP 7.0 + */ + public function testLoadAnonymousClass() + { + $this->reader->expects($this->never())->method('getClassAnnotation'); + $this->reader->expects($this->never())->method('getMethodAnnotations'); + + $this->loader->load(__DIR__.'/../Fixtures/OtherAnnotatedClasses/AnonymousClassInTrait.php'); + } + public function testSupports() { $fixture = __DIR__.'/../Fixtures/annotated.php'; diff --git a/vendor/symfony/routing/Tests/Loader/PhpFileLoaderTest.php b/vendor/symfony/routing/Tests/Loader/PhpFileLoaderTest.php index bda64236..608d84ed 100644 --- a/vendor/symfony/routing/Tests/Loader/PhpFileLoaderTest.php +++ b/vendor/symfony/routing/Tests/Loader/PhpFileLoaderTest.php @@ -13,7 +13,10 @@ namespace Symfony\Component\Routing\Tests\Loader; use PHPUnit\Framework\TestCase; use Symfony\Component\Config\FileLocator; +use Symfony\Component\Config\Resource\FileResource; use Symfony\Component\Routing\Loader\PhpFileLoader; +use Symfony\Component\Routing\Route; +use Symfony\Component\Routing\RouteCollection; class PhpFileLoaderTest extends TestCase { @@ -80,4 +83,38 @@ class PhpFileLoaderTest extends TestCase (string) $fileResource ); } + + public function testRoutingConfigurator() + { + $locator = new FileLocator(array(__DIR__.'/../Fixtures')); + $loader = new PhpFileLoader($locator); + $routeCollection = $loader->load('php_dsl.php'); + + $expectedCollection = new RouteCollection(); + + $expectedCollection->add('foo', (new Route('/foo')) + ->setOptions(array('utf8' => true)) + ->setCondition('abc') + ); + $expectedCollection->add('buz', (new Route('/zub')) + ->setDefaults(array('_controller' => 'foo:act')) + ); + $expectedCollection->add('c_bar', (new Route('/sub/pub/bar')) + ->setRequirements(array('id' => '\d+')) + ); + $expectedCollection->add('c_pub_buz', (new Route('/sub/pub/buz')) + ->setHost('host') + ->setRequirements(array('id' => '\d+')) + ); + $expectedCollection->add('ouf', (new Route('/ouf')) + ->setSchemes(array('https')) + ->setMethods(array('GET')) + ->setDefaults(array('id' => 0)) + ); + + $expectedCollection->addResource(new FileResource(realpath(__DIR__.'/../Fixtures/php_dsl_sub.php'))); + $expectedCollection->addResource(new FileResource(realpath(__DIR__.'/../Fixtures/php_dsl.php'))); + + $this->assertEquals($expectedCollection, $routeCollection); + } } diff --git a/vendor/symfony/routing/Tests/Loader/XmlFileLoaderTest.php b/vendor/symfony/routing/Tests/Loader/XmlFileLoaderTest.php index d24ec79a..221434b0 100644 --- a/vendor/symfony/routing/Tests/Loader/XmlFileLoaderTest.php +++ b/vendor/symfony/routing/Tests/Loader/XmlFileLoaderTest.php @@ -287,4 +287,78 @@ class XmlFileLoaderTest extends TestCase $route->getDefault('map') ); } + + public function testLoadRouteWithControllerAttribute() + { + $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/controller'))); + $routeCollection = $loader->load('routing.xml'); + + $route = $routeCollection->get('app_homepage'); + + $this->assertSame('AppBundle:Homepage:show', $route->getDefault('_controller')); + } + + public function testLoadRouteWithoutControllerAttribute() + { + $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/controller'))); + $routeCollection = $loader->load('routing.xml'); + + $route = $routeCollection->get('app_logout'); + + $this->assertNull($route->getDefault('_controller')); + } + + public function testLoadRouteWithControllerSetInDefaults() + { + $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/controller'))); + $routeCollection = $loader->load('routing.xml'); + + $route = $routeCollection->get('app_blog'); + + $this->assertSame('AppBundle:Blog:list', $route->getDefault('_controller')); + } + + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessageRegExp /The routing file "[^"]*" must not specify both the "controller" attribute and the defaults key "_controller" for "app_blog"/ + */ + public function testOverrideControllerInDefaults() + { + $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/controller'))); + $loader->load('override_defaults.xml'); + } + + /** + * @dataProvider provideFilesImportingRoutesWithControllers + */ + public function testImportRouteWithController($file) + { + $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/controller'))); + $routeCollection = $loader->load($file); + + $route = $routeCollection->get('app_homepage'); + $this->assertSame('FrameworkBundle:Template:template', $route->getDefault('_controller')); + + $route = $routeCollection->get('app_blog'); + $this->assertSame('FrameworkBundle:Template:template', $route->getDefault('_controller')); + + $route = $routeCollection->get('app_logout'); + $this->assertSame('FrameworkBundle:Template:template', $route->getDefault('_controller')); + } + + public function provideFilesImportingRoutesWithControllers() + { + yield array('import_controller.xml'); + yield array('import__controller.xml'); + } + + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessageRegExp /The routing file "[^"]*" must not specify both the "controller" attribute and the defaults key "_controller" for the "import" tag/ + */ + public function testImportWithOverriddenController() + { + $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/controller'))); + $loader->load('import_override_defaults.xml'); + } } diff --git a/vendor/symfony/routing/Tests/Loader/YamlFileLoaderTest.php b/vendor/symfony/routing/Tests/Loader/YamlFileLoaderTest.php index 8342c266..1f7fd438 100644 --- a/vendor/symfony/routing/Tests/Loader/YamlFileLoaderTest.php +++ b/vendor/symfony/routing/Tests/Loader/YamlFileLoaderTest.php @@ -108,4 +108,78 @@ class YamlFileLoaderTest extends TestCase $this->assertSame('context.getMethod() == "POST"', $route->getCondition()); } } + + public function testLoadRouteWithControllerAttribute() + { + $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/controller'))); + $routeCollection = $loader->load('routing.yml'); + + $route = $routeCollection->get('app_homepage'); + + $this->assertSame('AppBundle:Homepage:show', $route->getDefault('_controller')); + } + + public function testLoadRouteWithoutControllerAttribute() + { + $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/controller'))); + $routeCollection = $loader->load('routing.yml'); + + $route = $routeCollection->get('app_logout'); + + $this->assertNull($route->getDefault('_controller')); + } + + public function testLoadRouteWithControllerSetInDefaults() + { + $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/controller'))); + $routeCollection = $loader->load('routing.yml'); + + $route = $routeCollection->get('app_blog'); + + $this->assertSame('AppBundle:Blog:list', $route->getDefault('_controller')); + } + + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessageRegExp /The routing file "[^"]*" must not specify both the "controller" key and the defaults key "_controller" for "app_blog"/ + */ + public function testOverrideControllerInDefaults() + { + $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/controller'))); + $loader->load('override_defaults.yml'); + } + + /** + * @dataProvider provideFilesImportingRoutesWithControllers + */ + public function testImportRouteWithController($file) + { + $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/controller'))); + $routeCollection = $loader->load($file); + + $route = $routeCollection->get('app_homepage'); + $this->assertSame('FrameworkBundle:Template:template', $route->getDefault('_controller')); + + $route = $routeCollection->get('app_blog'); + $this->assertSame('FrameworkBundle:Template:template', $route->getDefault('_controller')); + + $route = $routeCollection->get('app_logout'); + $this->assertSame('FrameworkBundle:Template:template', $route->getDefault('_controller')); + } + + public function provideFilesImportingRoutesWithControllers() + { + yield array('import_controller.yml'); + yield array('import__controller.yml'); + } + + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessageRegExp /The routing file "[^"]*" must not specify both the "controller" key and the defaults key "_controller" for "_static"/ + */ + public function testImportWithOverriddenController() + { + $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/controller'))); + $loader->load('import_override_defaults.yml'); + } } diff --git a/vendor/symfony/routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php b/vendor/symfony/routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php index 4fb65f4a..e4c18c47 100644 --- a/vendor/symfony/routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php +++ b/vendor/symfony/routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php @@ -13,11 +13,39 @@ namespace Symfony\Component\Routing\Tests\Matcher\Dumper; use PHPUnit\Framework\TestCase; use Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper; +use Symfony\Component\Routing\Matcher\RedirectableUrlMatcherInterface; +use Symfony\Component\Routing\Matcher\UrlMatcher; +use Symfony\Component\Routing\RequestContext; use Symfony\Component\Routing\Route; use Symfony\Component\Routing\RouteCollection; class PhpMatcherDumperTest extends TestCase { + /** + * @var string + */ + private $matcherClass; + + /** + * @var string + */ + private $dumpPath; + + protected function setUp() + { + parent::setUp(); + + $this->matcherClass = uniqid('ProjectUrlMatcher'); + $this->dumpPath = sys_get_temp_dir().DIRECTORY_SEPARATOR.'php_matcher.'.$this->matcherClass.'.php'; + } + + protected function tearDown() + { + parent::tearDown(); + + @unlink($this->dumpPath); + } + /** * @expectedException \LogicException */ @@ -36,6 +64,23 @@ class PhpMatcherDumperTest extends TestCase $dumper->dump(); } + public function testRedirectPreservesUrlEncoding() + { + $collection = new RouteCollection(); + $collection->add('foo', new Route('/foo:bar/')); + + $class = $this->generateDumpedMatcher($collection, true); + + $matcher = $this->getMockBuilder($class) + ->setMethods(array('redirect')) + ->setConstructorArgs(array(new RequestContext())) + ->getMock(); + + $matcher->expects($this->once())->method('redirect')->with('/foo%3Abar/', 'foo')->willReturn(array()); + + $matcher->match('/foo%3Abar'); + } + /** * @dataProvider getRouteCollections */ @@ -374,6 +419,7 @@ class PhpMatcherDumperTest extends TestCase $trailingSlashCollection->add('regex_not_trailing_slash_POST_method', new Route('/not-trailing/regex/post-method/{param}', array(), array(), array(), '', array(), array('POST'))); return array( + array(new RouteCollection(), 'url_matcher0.php', array()), array($collection, 'url_matcher1.php', array()), array($redirectCollection, 'url_matcher2.php', array('base_class' => 'Symfony\Component\Routing\Tests\Fixtures\RedirectableUrlMatcher')), array($rootprefixCollection, 'url_matcher3.php', array()), @@ -383,4 +429,31 @@ class PhpMatcherDumperTest extends TestCase array($trailingSlashCollection, 'url_matcher7.php', array('base_class' => 'Symfony\Component\Routing\Tests\Fixtures\RedirectableUrlMatcher')), ); } + + /** + * @param $dumper + */ + private function generateDumpedMatcher(RouteCollection $collection, $redirectableStub = false) + { + $options = array('class' => $this->matcherClass); + + if ($redirectableStub) { + $options['base_class'] = '\Symfony\Component\Routing\Tests\Matcher\Dumper\RedirectableUrlMatcherStub'; + } + + $dumper = new PhpMatcherDumper($collection); + $code = $dumper->dump($options); + + file_put_contents($this->dumpPath, $code); + include $this->dumpPath; + + return $this->matcherClass; + } +} + +abstract class RedirectableUrlMatcherStub extends UrlMatcher implements RedirectableUrlMatcherInterface +{ + public function redirect($path, $route, $scheme = null) + { + } } diff --git a/vendor/symfony/routing/Tests/Matcher/RedirectableUrlMatcherTest.php b/vendor/symfony/routing/Tests/Matcher/RedirectableUrlMatcherTest.php index ba4c6e97..0948e002 100644 --- a/vendor/symfony/routing/Tests/Matcher/RedirectableUrlMatcherTest.php +++ b/vendor/symfony/routing/Tests/Matcher/RedirectableUrlMatcherTest.php @@ -24,7 +24,7 @@ class RedirectableUrlMatcherTest extends TestCase $coll->add('foo', new Route('/foo/')); $matcher = $this->getMockForAbstractClass('Symfony\Component\Routing\Matcher\RedirectableUrlMatcher', array($coll, new RequestContext())); - $matcher->expects($this->once())->method('redirect'); + $matcher->expects($this->once())->method('redirect')->will($this->returnValue(array())); $matcher->match('/foo'); } @@ -65,8 +65,47 @@ class RedirectableUrlMatcherTest extends TestCase $matcher = $this->getMockForAbstractClass('Symfony\Component\Routing\Matcher\RedirectableUrlMatcher', array($coll, new RequestContext())); $matcher ->expects($this->never()) + ->method('redirect'); + $matcher->match('/foo'); + } + + public function testSchemeRedirectWithParams() + { + $coll = new RouteCollection(); + $coll->add('foo', new Route('/foo/{bar}', array(), array(), array(), '', array('https'))); + + $matcher = $this->getMockForAbstractClass('Symfony\Component\Routing\Matcher\RedirectableUrlMatcher', array($coll, new RequestContext())); + $matcher + ->expects($this->once()) ->method('redirect') + ->with('/foo/baz', 'foo', 'https') + ->will($this->returnValue(array('redirect' => 'value'))) ; - $matcher->match('/foo'); + $this->assertEquals(array('_route' => 'foo', 'bar' => 'baz', 'redirect' => 'value'), $matcher->match('/foo/baz')); + } + + public function testSlashRedirectWithParams() + { + $coll = new RouteCollection(); + $coll->add('foo', new Route('/foo/{bar}/')); + + $matcher = $this->getMockForAbstractClass('Symfony\Component\Routing\Matcher\RedirectableUrlMatcher', array($coll, new RequestContext())); + $matcher + ->expects($this->once()) + ->method('redirect') + ->with('/foo/baz/', 'foo', null) + ->will($this->returnValue(array('redirect' => 'value'))) + ; + $this->assertEquals(array('_route' => 'foo', 'bar' => 'baz', 'redirect' => 'value'), $matcher->match('/foo/baz')); + } + + public function testRedirectPreservesUrlEncoding() + { + $coll = new RouteCollection(); + $coll->add('foo', new Route('/foo:bar/')); + + $matcher = $this->getMockForAbstractClass('Symfony\Component\Routing\Matcher\RedirectableUrlMatcher', array($coll, new RequestContext())); + $matcher->expects($this->once())->method('redirect')->with('/foo%3Abar/')->willReturn(array()); + $matcher->match('/foo%3Abar'); } } diff --git a/vendor/symfony/routing/Tests/Matcher/UrlMatcherTest.php b/vendor/symfony/routing/Tests/Matcher/UrlMatcherTest.php index 1eeb5d43..8545c2c2 100644 --- a/vendor/symfony/routing/Tests/Matcher/UrlMatcherTest.php +++ b/vendor/symfony/routing/Tests/Matcher/UrlMatcherTest.php @@ -427,4 +427,15 @@ class UrlMatcherTest extends TestCase $matcher = new UrlMatcher($coll, new RequestContext('', 'GET', 'en.example.com')); $this->assertEquals(array('_route' => 'foo', 'locale' => 'en'), $matcher->match('/')); } + + /** + * @expectedException \Symfony\Component\Routing\Exception\NoConfigurationException + */ + public function testNoConfiguration() + { + $coll = new RouteCollection(); + + $matcher = new UrlMatcher($coll, new RequestContext()); + $matcher->match('/'); + } } diff --git a/vendor/symfony/routing/Tests/RouteCollectionBuilderTest.php b/vendor/symfony/routing/Tests/RouteCollectionBuilderTest.php index 058a100d..f6af600b 100644 --- a/vendor/symfony/routing/Tests/RouteCollectionBuilderTest.php +++ b/vendor/symfony/routing/Tests/RouteCollectionBuilderTest.php @@ -12,7 +12,9 @@ namespace Symfony\Component\Routing\Tests; use PHPUnit\Framework\TestCase; +use Symfony\Component\Config\FileLocator; use Symfony\Component\Config\Resource\FileResource; +use Symfony\Component\Routing\Loader\YamlFileLoader; use Symfony\Component\Routing\Route; use Symfony\Component\Routing\RouteCollection; use Symfony\Component\Routing\RouteCollectionBuilder; @@ -59,7 +61,18 @@ class RouteCollectionBuilderTest extends TestCase $this->assertCount(1, $addedCollection->getResources()); // make sure the routes were imported into the top-level builder + $routeCollection = $routes->build(); $this->assertCount(1, $routes->build()); + $this->assertCount(1, $routeCollection->getResources()); + } + + public function testImportAddResources() + { + $routeCollectionBuilder = new RouteCollectionBuilder(new YamlFileLoader(new FileLocator(array(__DIR__.'/Fixtures/')))); + $routeCollectionBuilder->import('file_resource.yml'); + $routeCollection = $routeCollectionBuilder->build(); + + $this->assertCount(1, $routeCollection->getResources()); } /** @@ -322,4 +335,30 @@ class RouteCollectionBuilderTest extends TestCase // there are 2 routes (i.e. with non-conflicting names) $this->assertCount(3, $collection->all()); } + + public function testAddsThePrefixOnlyOnceWhenLoadingMultipleCollections() + { + $firstCollection = new RouteCollection(); + $firstCollection->add('a', new Route('/a')); + + $secondCollection = new RouteCollection(); + $secondCollection->add('b', new Route('/b')); + + $loader = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock(); + $loader->expects($this->any()) + ->method('supports') + ->will($this->returnValue(true)); + $loader + ->expects($this->any()) + ->method('load') + ->will($this->returnValue(array($firstCollection, $secondCollection))); + + $routeCollectionBuilder = new RouteCollectionBuilder($loader); + $routeCollectionBuilder->import('/directory/recurse/*', '/other/', 'glob'); + $routes = $routeCollectionBuilder->build()->all(); + + $this->assertEquals(2, count($routes)); + $this->assertEquals('/other/a', $routes['a']->getPath()); + $this->assertEquals('/other/b', $routes['b']->getPath()); + } } diff --git a/vendor/symfony/routing/composer.json b/vendor/symfony/routing/composer.json index bb4f6a55..2ad746ec 100644 --- a/vendor/symfony/routing/composer.json +++ b/vendor/symfony/routing/composer.json @@ -19,11 +19,11 @@ "php": "^5.5.9|>=7.0.8" }, "require-dev": { - "symfony/config": "~2.8|~3.0", - "symfony/http-foundation": "~2.8|~3.0", - "symfony/yaml": "~3.3", - "symfony/expression-language": "~2.8|~3.0", - "symfony/dependency-injection": "~3.3", + "symfony/config": "~2.8|~3.0|~4.0", + "symfony/http-foundation": "~2.8|~3.0|~4.0", + "symfony/yaml": "~3.4|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/dependency-injection": "~3.3|~4.0", "doctrine/annotations": "~1.0", "doctrine/common": "~2.2", "psr/log": "~1.0" @@ -31,7 +31,7 @@ "conflict": { "symfony/config": "<2.8", "symfony/dependency-injection": "<3.3", - "symfony/yaml": "<3.3" + "symfony/yaml": "<3.4" }, "suggest": { "symfony/http-foundation": "For using a Symfony Request object", @@ -50,7 +50,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } } } diff --git a/vendor/symfony/twig-bridge/AppVariable.php b/vendor/symfony/twig-bridge/AppVariable.php index e8e69d0e..54a785c0 100644 --- a/vendor/symfony/twig-bridge/AppVariable.php +++ b/vendor/symfony/twig-bridge/AppVariable.php @@ -156,10 +156,9 @@ class AppVariable */ public function getFlashes($types = null) { - // needed to avoid starting the session automatically when looking for flash messages try { $session = $this->getSession(); - if (null === $session || !$session->isStarted()) { + if (null === $session) { return array(); } } catch (\RuntimeException $e) { diff --git a/vendor/symfony/twig-bridge/CHANGELOG.md b/vendor/symfony/twig-bridge/CHANGELOG.md index b59d85ea..8d5d6f56 100644 --- a/vendor/symfony/twig-bridge/CHANGELOG.md +++ b/vendor/symfony/twig-bridge/CHANGELOG.md @@ -1,6 +1,16 @@ CHANGELOG ========= +3.4.0 +----- + + * added an `only` keyword to `form_theme` tag to disable usage of default themes when rendering a form + * deprecated `Symfony\Bridge\Twig\Form\TwigRenderer` + * deprecated `DebugCommand::set/getTwigEnvironment`. Pass an instance of + `Twig\Environment` as first argument of the constructor instead + * deprecated `LintCommand::set/getTwigEnvironment`. Pass an instance of + `Twig\Environment` as first argument of the constructor instead + 3.3.0 ----- diff --git a/vendor/symfony/twig-bridge/Command/DebugCommand.php b/vendor/symfony/twig-bridge/Command/DebugCommand.php index 010404c1..1e45cf4d 100644 --- a/vendor/symfony/twig-bridge/Command/DebugCommand.php +++ b/vendor/symfony/twig-bridge/Command/DebugCommand.php @@ -18,6 +18,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; use Twig\Environment; +use Twig\Loader\FilesystemLoader; /** * Lists twig functions, filters, globals and tests present in the current project. @@ -26,18 +27,35 @@ use Twig\Environment; */ class DebugCommand extends Command { + protected static $defaultName = 'debug:twig'; + private $twig; + private $projectDir; /** - * {@inheritdoc} + * @param Environment $twig + * @param string|null $projectDir */ - public function __construct($name = 'debug:twig') + public function __construct($twig = null, $projectDir = null) { - parent::__construct($name); + if (!$twig instanceof Environment) { + @trigger_error(sprintf('Passing a command name as the first argument of "%s" is deprecated since Symfony 3.4 and will be removed in 4.0. If the command was registered by convention, make it a service instead.', __METHOD__), E_USER_DEPRECATED); + + parent::__construct($twig); + + return; + } + + parent::__construct(); + + $this->twig = $twig; + $this->projectDir = $projectDir; } public function setTwigEnvironment(Environment $twig) { + @trigger_error(sprintf('Method "%s" is deprecated since Symfony 3.4 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED); + $this->twig = $twig; } @@ -46,6 +64,8 @@ class DebugCommand extends Command */ protected function getTwigEnvironment() { + @trigger_error(sprintf('Method "%s" is deprecated since Symfony 3.4 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED); + return $this->twig; } @@ -80,9 +100,17 @@ EOF protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); - $twig = $this->getTwigEnvironment(); - if (null === $twig) { + // BC to be removed in 4.0 + if (__CLASS__ !== get_class($this)) { + $r = new \ReflectionMethod($this, 'getTwigEnvironment'); + if (__CLASS__ !== $r->getDeclaringClass()->getName()) { + @trigger_error(sprintf('Usage of method "%s" is deprecated since Symfony 3.4 and will no longer be supported in 4.0. Construct the command with its required arguments instead.', get_class($this).'::getTwigEnvironment'), E_USER_DEPRECATED); + + $this->twig = $this->getTwigEnvironment(); + } + } + if (null === $this->twig) { throw new \RuntimeException('The Twig environment needs to be set.'); } @@ -91,11 +119,12 @@ EOF if ('json' === $input->getOption('format')) { $data = array(); foreach ($types as $type) { - foreach ($twig->{'get'.ucfirst($type)}() as $name => $entity) { + foreach ($this->twig->{'get'.ucfirst($type)}() as $name => $entity) { $data[$type][$name] = $this->getMetadata($type, $entity); } } $data['tests'] = array_keys($data['tests']); + $data['loader_paths'] = $this->getLoaderPaths(); $io->writeln(json_encode($data)); return 0; @@ -105,7 +134,7 @@ EOF foreach ($types as $index => $type) { $items = array(); - foreach ($twig->{'get'.ucfirst($type)}() as $name => $entity) { + foreach ($this->twig->{'get'.ucfirst($type)}() as $name => $entity) { if (!$filter || false !== strpos($name, $filter)) { $items[$name] = $name.$this->getPrettyMetadata($type, $entity); } @@ -121,9 +150,54 @@ EOF $io->listing($items); } + $rows = array(); + foreach ($this->getLoaderPaths() as $namespace => $paths) { + if (count($paths) > 1) { + $rows[] = array('', ''); + } + foreach ($paths as $path) { + $rows[] = array($namespace, '- '.$path); + $namespace = ''; + } + if (count($paths) > 1) { + $rows[] = array('', ''); + } + } + array_pop($rows); + $io->section('Loader Paths'); + $io->table(array('Namespace', 'Paths'), $rows); + return 0; } + private function getLoaderPaths() + { + if (!($loader = $this->twig->getLoader()) instanceof FilesystemLoader) { + return array(); + } + + $loaderPaths = array(); + foreach ($loader->getNamespaces() as $namespace) { + $paths = array_map(function ($path) { + if (null !== $this->projectDir && 0 === strpos($path, $this->projectDir)) { + $path = ltrim(substr($path, strlen($this->projectDir)), DIRECTORY_SEPARATOR); + } + + return $path; + }, $loader->getPaths($namespace)); + + if (FilesystemLoader::MAIN_NAMESPACE === $namespace) { + $namespace = '(None)'; + } else { + $namespace = '@'.$namespace; + } + + $loaderPaths[$namespace] = $paths; + } + + return $loaderPaths; + } + private function getMetadata($type, $entity) { if ('globals' === $type) { diff --git a/vendor/symfony/twig-bridge/Command/LintCommand.php b/vendor/symfony/twig-bridge/Command/LintCommand.php index 8c8dde41..afb1d1bf 100644 --- a/vendor/symfony/twig-bridge/Command/LintCommand.php +++ b/vendor/symfony/twig-bridge/Command/LintCommand.php @@ -31,18 +31,32 @@ use Twig\Source; */ class LintCommand extends Command { + protected static $defaultName = 'lint:twig'; + private $twig; /** - * {@inheritdoc} + * @param Environment $twig */ - public function __construct($name = 'lint:twig') + public function __construct($twig = null) { - parent::__construct($name); + if (!$twig instanceof Environment) { + @trigger_error(sprintf('Passing a command name as the first argument of "%s" is deprecated since Symfony 3.4 and will be removed in 4.0. If the command was registered by convention, make it a service instead.', __METHOD__), E_USER_DEPRECATED); + + parent::__construct($twig); + + return; + } + + parent::__construct(); + + $this->twig = $twig; } public function setTwigEnvironment(Environment $twig) { + @trigger_error(sprintf('Method "%s" is deprecated since Symfony 3.4 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED); + $this->twig = $twig; } @@ -51,6 +65,8 @@ class LintCommand extends Command */ protected function getTwigEnvironment() { + @trigger_error(sprintf('Method "%s" is deprecated since Symfony 3.4 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED); + return $this->twig; } @@ -86,7 +102,16 @@ EOF { $io = new SymfonyStyle($input, $output); - if (null === $twig = $this->getTwigEnvironment()) { + // BC to be removed in 4.0 + if (__CLASS__ !== get_class($this)) { + $r = new \ReflectionMethod($this, 'getTwigEnvironment'); + if (__CLASS__ !== $r->getDeclaringClass()->getName()) { + @trigger_error(sprintf('Usage of method "%s" is deprecated since Symfony 3.4 and will no longer be supported in 4.0. Construct the command with its required arguments instead.', get_class($this).'::getTwigEnvironment'), E_USER_DEPRECATED); + + $this->twig = $this->getTwigEnvironment(); + } + } + if (null === $this->twig) { throw new \RuntimeException('The Twig environment needs to be set.'); } @@ -102,20 +127,20 @@ EOF $template .= fread(STDIN, 1024); } - return $this->display($input, $output, $io, array($this->validate($twig, $template, uniqid('sf_', true)))); + return $this->display($input, $output, $io, array($this->validate($template, uniqid('sf_', true)))); } - $filesInfo = $this->getFilesInfo($twig, $filenames); + $filesInfo = $this->getFilesInfo($filenames); return $this->display($input, $output, $io, $filesInfo); } - private function getFilesInfo(Environment $twig, array $filenames) + private function getFilesInfo(array $filenames) { $filesInfo = array(); foreach ($filenames as $filename) { foreach ($this->findFiles($filename) as $file) { - $filesInfo[] = $this->validate($twig, file_get_contents($file), $file); + $filesInfo[] = $this->validate(file_get_contents($file), $file); } } @@ -133,19 +158,19 @@ EOF throw new \RuntimeException(sprintf('File or directory "%s" is not readable', $filename)); } - private function validate(Environment $twig, $template, $file) + private function validate($template, $file) { - $realLoader = $twig->getLoader(); + $realLoader = $this->twig->getLoader(); try { $temporaryLoader = new ArrayLoader(array((string) $file => $template)); - $twig->setLoader($temporaryLoader); - $nodeTree = $twig->parse($twig->tokenize(new Source($template, (string) $file))); - $twig->compile($nodeTree); - $twig->setLoader($realLoader); + $this->twig->setLoader($temporaryLoader); + $nodeTree = $this->twig->parse($this->twig->tokenize(new Source($template, (string) $file))); + $this->twig->compile($nodeTree); + $this->twig->setLoader($realLoader); } catch (Error $e) { - $twig->setLoader($realLoader); + $this->twig->setLoader($realLoader); - return array('template' => $template, 'file' => $file, 'valid' => false, 'exception' => $e); + return array('template' => $template, 'file' => $file, 'line' => $e->getTemplateLine(), 'valid' => false, 'exception' => $e); } return array('template' => $template, 'file' => $file, 'valid' => true); diff --git a/vendor/symfony/twig-bridge/DataCollector/TwigDataCollector.php b/vendor/symfony/twig-bridge/DataCollector/TwigDataCollector.php index f28c9242..ee48f39b 100644 --- a/vendor/symfony/twig-bridge/DataCollector/TwigDataCollector.php +++ b/vendor/symfony/twig-bridge/DataCollector/TwigDataCollector.php @@ -15,6 +15,7 @@ use Symfony\Component\HttpKernel\DataCollector\DataCollector; use Symfony\Component\HttpKernel\DataCollector\LateDataCollectorInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Twig\Environment; use Twig\Markup; use Twig\Profiler\Dumper\HtmlDumper; use Twig\Profiler\Profile; @@ -27,11 +28,13 @@ use Twig\Profiler\Profile; class TwigDataCollector extends DataCollector implements LateDataCollectorInterface { private $profile; + private $twig; private $computed; - public function __construct(Profile $profile) + public function __construct(Profile $profile, Environment $twig = null) { $this->profile = $profile; + $this->twig = $twig; } /** @@ -41,12 +44,46 @@ class TwigDataCollector extends DataCollector implements LateDataCollectorInterf { } + /** + * {@inheritdoc} + */ + public function reset() + { + $this->profile->reset(); + $this->computed = null; + $this->data = array(); + } + /** * {@inheritdoc} */ public function lateCollect() { $this->data['profile'] = serialize($this->profile); + $this->data['template_paths'] = array(); + + if (null === $this->twig) { + return; + } + + $templateFinder = function (Profile $profile) use (&$templateFinder) { + if ($profile->isTemplate()) { + try { + $template = $this->twig->load($name = $profile->getName()); + } catch (\Twig_Error_Loader $e) { + $template = null; + } + + if (null !== $template && '' !== $path = $template->getSourceContext()->getPath()) { + $this->data['template_paths'][$name] = $path; + } + } + + foreach ($profile as $p) { + $templateFinder($p); + } + }; + $templateFinder($this->profile); } public function getTime() @@ -59,6 +96,11 @@ class TwigDataCollector extends DataCollector implements LateDataCollectorInterf return $this->getComputedData('template_count'); } + public function getTemplatePaths() + { + return $this->data['template_paths']; + } + public function getTemplates() { return $this->getComputedData('templates'); diff --git a/vendor/symfony/twig-bridge/Extension/CodeExtension.php b/vendor/symfony/twig-bridge/Extension/CodeExtension.php index c2866abb..e4777248 100644 --- a/vendor/symfony/twig-bridge/Extension/CodeExtension.php +++ b/vendor/symfony/twig-bridge/Extension/CodeExtension.php @@ -70,9 +70,9 @@ class CodeExtension extends AbstractExtension list($class, $method) = explode('::', $method, 2); $result = sprintf('%s::%s()', $this->abbrClass($class), $method); } elseif ('Closure' === $method) { - $result = sprintf('<abbr title="%s">%s</abbr>', $method, $method); + $result = sprintf('<abbr title="%s">%1$s</abbr>', $method); } else { - $result = sprintf('<abbr title="%s">%s</abbr>()', $method, $method); + $result = sprintf('<abbr title="%s">%1$s</abbr>()', $method); } return $result; @@ -196,7 +196,7 @@ class CodeExtension extends AbstractExtension * @param string $file An absolute file path * @param int $line The line number * - * @return string A link of false + * @return string|false A link or false */ public function getFileLink($file, $line) { diff --git a/vendor/symfony/twig-bridge/Extension/DumpExtension.php b/vendor/symfony/twig-bridge/Extension/DumpExtension.php index 767163f8..2cc3f1a4 100644 --- a/vendor/symfony/twig-bridge/Extension/DumpExtension.php +++ b/vendor/symfony/twig-bridge/Extension/DumpExtension.php @@ -32,7 +32,7 @@ class DumpExtension extends AbstractExtension public function __construct(ClonerInterface $cloner, HtmlDumper $dumper = null) { $this->cloner = $cloner; - $this->dumper = $dumper ?: new HtmlDumper(); + $this->dumper = $dumper; } public function getFunctions() @@ -73,6 +73,7 @@ class DumpExtension extends AbstractExtension } $dump = fopen('php://memory', 'r+b'); + $this->dumper = $this->dumper ?: new HtmlDumper(); $this->dumper->setCharset($env->getCharset()); foreach ($vars as $value) { diff --git a/vendor/symfony/twig-bridge/Extension/FormExtension.php b/vendor/symfony/twig-bridge/Extension/FormExtension.php index 362879e4..e63203f3 100644 --- a/vendor/symfony/twig-bridge/Extension/FormExtension.php +++ b/vendor/symfony/twig-bridge/Extension/FormExtension.php @@ -15,6 +15,7 @@ use Symfony\Bridge\Twig\TokenParser\FormThemeTokenParser; use Symfony\Bridge\Twig\Form\TwigRendererInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\Form\ChoiceList\View\ChoiceView; +use Symfony\Component\Form\FormView; use Twig\Environment; use Twig\Extension\AbstractExtension; use Twig\Extension\InitRuntimeInterface; @@ -38,7 +39,7 @@ class FormExtension extends AbstractExtension implements InitRuntimeInterface public function __construct($renderer = null) { if ($renderer instanceof TwigRendererInterface) { - @trigger_error(sprintf('Passing a Twig Form Renderer to the "%s" constructor is deprecated since version 3.2 and won\'t be possible in 4.0. Pass the Twig\Environment to the TwigRendererEngine constructor instead.', static::class), E_USER_DEPRECATED); + @trigger_error(sprintf('Passing a Twig Form Renderer to the "%s" constructor is deprecated since Symfony 3.2 and won\'t be possible in 4.0. Pass the Twig\Environment to the TwigRendererEngine constructor instead.', static::class), E_USER_DEPRECATED); } elseif (null !== $renderer && !(is_array($renderer) && isset($renderer[0], $renderer[1]) && $renderer[0] instanceof ContainerInterface)) { throw new \InvalidArgumentException(sprintf('Passing any arguments the constructor of %s is reserved for internal use.', __CLASS__)); } @@ -54,7 +55,7 @@ class FormExtension extends AbstractExtension implements InitRuntimeInterface { if ($this->renderer instanceof TwigRendererInterface) { $this->renderer->setEnvironment($environment); - } elseif (null !== $this->renderer) { + } elseif (is_array($this->renderer)) { $this->renderer[2] = $environment; } } @@ -84,7 +85,7 @@ class FormExtension extends AbstractExtension implements InitRuntimeInterface new TwigFunction('form', null, array('node_class' => 'Symfony\Bridge\Twig\Node\RenderBlockNode', 'is_safe' => array('html'))), new TwigFunction('form_start', null, array('node_class' => 'Symfony\Bridge\Twig\Node\RenderBlockNode', 'is_safe' => array('html'))), new TwigFunction('form_end', null, array('node_class' => 'Symfony\Bridge\Twig\Node\RenderBlockNode', 'is_safe' => array('html'))), - new TwigFunction('csrf_token', array('Symfony\Bridge\Twig\Form\TwigRenderer', 'renderCsrfToken')), + new TwigFunction('csrf_token', array('Symfony\Component\Form\FormRenderer', 'renderCsrfToken')), ); } @@ -94,7 +95,7 @@ class FormExtension extends AbstractExtension implements InitRuntimeInterface public function getFilters() { return array( - new TwigFilter('humanize', array('Symfony\Bridge\Twig\Form\TwigRenderer', 'humanize')), + new TwigFilter('humanize', array('Symfony\Component\Form\FormRenderer', 'humanize')), ); } @@ -105,6 +106,7 @@ class FormExtension extends AbstractExtension implements InitRuntimeInterface { return array( new TwigTest('selectedchoice', 'Symfony\Bridge\Twig\Extension\twig_is_selected_choice'), + new TwigTest('rootform', 'Symfony\Bridge\Twig\Extension\twig_is_root_form'), ); } @@ -114,11 +116,11 @@ class FormExtension extends AbstractExtension implements InitRuntimeInterface public function __get($name) { if ('renderer' === $name) { - @trigger_error(sprintf('Using the "%s::$renderer" property is deprecated since version 3.2 as it will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED); + @trigger_error(sprintf('Using the "%s::$renderer" property is deprecated since Symfony 3.2 as it will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED); if (is_array($this->renderer)) { $renderer = $this->renderer[0]->get($this->renderer[1]); - if (isset($this->renderer[2])) { + if (isset($this->renderer[2]) && $renderer instanceof TwigRendererInterface) { $renderer->setEnvironment($this->renderer[2]); } $this->renderer = $renderer; @@ -134,7 +136,7 @@ class FormExtension extends AbstractExtension implements InitRuntimeInterface public function __set($name, $value) { if ('renderer' === $name) { - @trigger_error(sprintf('Using the "%s::$renderer" property is deprecated since version 3.2 as it will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED); + @trigger_error(sprintf('Using the "%s::$renderer" property is deprecated since Symfony 3.2 as it will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED); } $this->$name = $value; @@ -146,7 +148,7 @@ class FormExtension extends AbstractExtension implements InitRuntimeInterface public function __isset($name) { if ('renderer' === $name) { - @trigger_error(sprintf('Using the "%s::$renderer" property is deprecated since version 3.2 as it will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED); + @trigger_error(sprintf('Using the "%s::$renderer" property is deprecated since Symfony 3.2 as it will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED); } return isset($this->$name); @@ -158,7 +160,7 @@ class FormExtension extends AbstractExtension implements InitRuntimeInterface public function __unset($name) { if ('renderer' === $name) { - @trigger_error(sprintf('Using the "%s::$renderer" property is deprecated since version 3.2 as it will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED); + @trigger_error(sprintf('Using the "%s::$renderer" property is deprecated since Symfony 3.2 as it will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED); } unset($this->$name); @@ -192,3 +194,11 @@ function twig_is_selected_choice(ChoiceView $choice, $selectedValue) return $choice->value === $selectedValue; } + +/** + * @internal + */ +function twig_is_root_form(FormView $formView) +{ + return null === $formView->parent; +} diff --git a/vendor/symfony/twig-bridge/Extension/RoutingExtension.php b/vendor/symfony/twig-bridge/Extension/RoutingExtension.php index 97b1ea31..92a520ed 100644 --- a/vendor/symfony/twig-bridge/Extension/RoutingExtension.php +++ b/vendor/symfony/twig-bridge/Extension/RoutingExtension.php @@ -91,7 +91,7 @@ class RoutingExtension extends AbstractExtension * * @return array An array with the contexts the URL is safe * - * To be made @final in 3.4, and the type-hint be changed to "\Twig\Node\Node" in 4.0. + * @final since version 3.4, type-hint to be changed to "\Twig\Node\Node" in 4.0 */ public function isUrlGenerationSafe(\Twig_Node $argsNode) { diff --git a/vendor/symfony/twig-bridge/Extension/StopwatchExtension.php b/vendor/symfony/twig-bridge/Extension/StopwatchExtension.php index cb91ff42..48d99b8c 100644 --- a/vendor/symfony/twig-bridge/Extension/StopwatchExtension.php +++ b/vendor/symfony/twig-bridge/Extension/StopwatchExtension.php @@ -23,10 +23,6 @@ use Twig\Extension\AbstractExtension; class StopwatchExtension extends AbstractExtension { private $stopwatch; - - /** - * @var bool - */ private $enabled; public function __construct(Stopwatch $stopwatch = null, $enabled = true) diff --git a/vendor/symfony/twig-bridge/Extension/TranslationExtension.php b/vendor/symfony/twig-bridge/Extension/TranslationExtension.php index 5155169a..f1131c52 100644 --- a/vendor/symfony/twig-bridge/Extension/TranslationExtension.php +++ b/vendor/symfony/twig-bridge/Extension/TranslationExtension.php @@ -32,12 +32,8 @@ class TranslationExtension extends AbstractExtension private $translator; private $translationNodeVisitor; - public function __construct(TranslatorInterface $translator, NodeVisitorInterface $translationNodeVisitor = null) + public function __construct(TranslatorInterface $translator = null, NodeVisitorInterface $translationNodeVisitor = null) { - if (!$translationNodeVisitor) { - $translationNodeVisitor = new TranslationNodeVisitor(); - } - $this->translator = $translator; $this->translationNodeVisitor = $translationNodeVisitor; } @@ -84,21 +80,29 @@ class TranslationExtension extends AbstractExtension */ public function getNodeVisitors() { - return array($this->translationNodeVisitor, new TranslationDefaultDomainNodeVisitor()); + return array($this->getTranslationNodeVisitor(), new TranslationDefaultDomainNodeVisitor()); } public function getTranslationNodeVisitor() { - return $this->translationNodeVisitor; + return $this->translationNodeVisitor ?: $this->translationNodeVisitor = new TranslationNodeVisitor(); } public function trans($message, array $arguments = array(), $domain = null, $locale = null) { + if (null === $this->translator) { + return strtr($message, $arguments); + } + return $this->translator->trans($message, $arguments, $domain, $locale); } public function transchoice($message, $count, array $arguments = array(), $domain = null, $locale = null) { + if (null === $this->translator) { + return strtr($message, $arguments); + } + return $this->translator->transChoice($message, $count, array_merge(array('%count%' => $count), $arguments), $domain, $locale); } diff --git a/vendor/symfony/twig-bridge/Extension/WorkflowExtension.php b/vendor/symfony/twig-bridge/Extension/WorkflowExtension.php index 2d19857c..54c12f16 100644 --- a/vendor/symfony/twig-bridge/Extension/WorkflowExtension.php +++ b/vendor/symfony/twig-bridge/Extension/WorkflowExtension.php @@ -85,7 +85,7 @@ class WorkflowExtension extends AbstractExtension * Returns marked places. * * @param object $subject A subject - * @param string $placesNameOnly If true, returns only places name. If false returns the raw representation + * @param bool $placesNameOnly If true, returns only places name. If false returns the raw representation * @param string $name A workflow name * * @return string[]|int[] diff --git a/vendor/symfony/twig-bridge/Extension/YamlExtension.php b/vendor/symfony/twig-bridge/Extension/YamlExtension.php index 79418fb8..164b5383 100644 --- a/vendor/symfony/twig-bridge/Extension/YamlExtension.php +++ b/vendor/symfony/twig-bridge/Extension/YamlExtension.php @@ -44,7 +44,7 @@ class YamlExtension extends AbstractExtension if (defined('Symfony\Component\Yaml\Yaml::DUMP_OBJECT')) { if (is_bool($dumpObjects)) { - @trigger_error('Passing a boolean flag to toggle object support is deprecated since version 3.1 and will be removed in 4.0. Use the Yaml::DUMP_OBJECT flag instead.', E_USER_DEPRECATED); + @trigger_error('Passing a boolean flag to toggle object support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::DUMP_OBJECT flag instead.', E_USER_DEPRECATED); $flags = $dumpObjects ? Yaml::DUMP_OBJECT : 0; } else { diff --git a/vendor/symfony/twig-bridge/Form/TwigRenderer.php b/vendor/symfony/twig-bridge/Form/TwigRenderer.php index 9d28b8c2..b4cb7faa 100644 --- a/vendor/symfony/twig-bridge/Form/TwigRenderer.php +++ b/vendor/symfony/twig-bridge/Form/TwigRenderer.php @@ -15,8 +15,12 @@ use Symfony\Component\Form\FormRenderer; use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface; use Twig\Environment; +@trigger_error(sprintf('The %s class is deprecated since Symfony 3.4 and will be removed in 4.0. Use %s instead.', TwigRenderer::class, FormRenderer::class), E_USER_DEPRECATED); + /** * @author Bernhard Schussek <bschussek@gmail.com> + * + * @deprecated since version 3.4, to be removed in 4.0. Use Symfony\Component\Form\FormRenderer instead. */ class TwigRenderer extends FormRenderer implements TwigRendererInterface { diff --git a/vendor/symfony/twig-bridge/Form/TwigRendererEngine.php b/vendor/symfony/twig-bridge/Form/TwigRendererEngine.php index 7e375f45..711291db 100644 --- a/vendor/symfony/twig-bridge/Form/TwigRendererEngine.php +++ b/vendor/symfony/twig-bridge/Form/TwigRendererEngine.php @@ -34,7 +34,7 @@ class TwigRendererEngine extends AbstractRendererEngine implements TwigRendererE public function __construct(array $defaultThemes = array(), Environment $environment = null) { if (null === $environment) { - @trigger_error(sprintf('Not passing a Twig Environment as the second argument for "%s" constructor is deprecated since version 3.2 and won\'t be possible in 4.0.', static::class), E_USER_DEPRECATED); + @trigger_error(sprintf('Not passing a Twig Environment as the second argument for "%s" constructor is deprecated since Symfony 3.2 and won\'t be possible in 4.0.', static::class), E_USER_DEPRECATED); } parent::__construct($defaultThemes); @@ -49,7 +49,7 @@ class TwigRendererEngine extends AbstractRendererEngine implements TwigRendererE public function setEnvironment(Environment $environment) { if ($this->environment) { - @trigger_error(sprintf('The "%s()" method is deprecated since version 3.3 and will be removed in 4.0. Pass the Twig Environment as second argument of the constructor instead.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.3 and will be removed in 4.0. Pass the Twig Environment as second argument of the constructor instead.', __METHOD__), E_USER_DEPRECATED); } $this->environment = $environment; @@ -124,9 +124,11 @@ class TwigRendererEngine extends AbstractRendererEngine implements TwigRendererE // Check the default themes once we reach the root view without success if (!$view->parent) { - for ($i = count($this->defaultThemes) - 1; $i >= 0; --$i) { - $this->loadResourcesFromTheme($cacheKey, $this->defaultThemes[$i]); - // CONTINUE LOADING (see doc comment) + if (!isset($this->useDefaultThemes[$cacheKey]) || $this->useDefaultThemes[$cacheKey]) { + for ($i = count($this->defaultThemes) - 1; $i >= 0; --$i) { + $this->loadResourcesFromTheme($cacheKey, $this->defaultThemes[$i]); + // CONTINUE LOADING (see doc comment) + } } } diff --git a/vendor/symfony/twig-bridge/LICENSE b/vendor/symfony/twig-bridge/LICENSE index 17d16a13..21d7fb9e 100644 --- a/vendor/symfony/twig-bridge/LICENSE +++ b/vendor/symfony/twig-bridge/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2017 Fabien Potencier +Copyright (c) 2004-2018 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/symfony/twig-bridge/Node/FormThemeNode.php b/vendor/symfony/twig-bridge/Node/FormThemeNode.php index 06d2400c..8fcd9380 100644 --- a/vendor/symfony/twig-bridge/Node/FormThemeNode.php +++ b/vendor/symfony/twig-bridge/Node/FormThemeNode.php @@ -11,7 +11,10 @@ namespace Symfony\Bridge\Twig\Node; +use Symfony\Bridge\Twig\Form\TwigRenderer; +use Symfony\Component\Form\FormRenderer; use Twig\Compiler; +use Twig\Error\RuntimeError; use Twig\Node\Node; /** @@ -19,19 +22,30 @@ use Twig\Node\Node; */ class FormThemeNode extends Node { - public function __construct(Node $form, Node $resources, $lineno, $tag = null) + public function __construct(Node $form, Node $resources, $lineno, $tag = null, $only = false) { - parent::__construct(array('form' => $form, 'resources' => $resources), array(), $lineno, $tag); + parent::__construct(array('form' => $form, 'resources' => $resources), array('only' => (bool) $only), $lineno, $tag); } public function compile(Compiler $compiler) { + try { + $compiler->getEnvironment()->getRuntime(FormRenderer::class); + $renderer = FormRenderer::class; + } catch (RuntimeError $e) { + $renderer = TwigRenderer::class; + } + $compiler ->addDebugInfo($this) - ->write('$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->setTheme(') + ->write('$this->env->getRuntime(') + ->string($renderer) + ->raw(')->setTheme(') ->subcompile($this->getNode('form')) ->raw(', ') ->subcompile($this->getNode('resources')) + ->raw(', ') + ->raw(false === $this->getAttribute('only') ? 'true' : 'false') ->raw(");\n"); } } diff --git a/vendor/symfony/twig-bridge/Node/RenderBlockNode.php b/vendor/symfony/twig-bridge/Node/RenderBlockNode.php index 0698fd90..dc7d8607 100644 --- a/vendor/symfony/twig-bridge/Node/RenderBlockNode.php +++ b/vendor/symfony/twig-bridge/Node/RenderBlockNode.php @@ -28,7 +28,7 @@ class RenderBlockNode extends FunctionExpression { $compiler->addDebugInfo($this); $arguments = iterator_to_array($this->getNode('arguments')); - $compiler->write('$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->renderBlock('); + $compiler->write('$this->env->getRuntime(\'Symfony\Component\Form\FormRenderer\')->renderBlock('); if (isset($arguments[0])) { $compiler->subcompile($arguments[0]); diff --git a/vendor/symfony/twig-bridge/Node/SearchAndRenderBlockNode.php b/vendor/symfony/twig-bridge/Node/SearchAndRenderBlockNode.php index dcdba5c4..224e1d60 100644 --- a/vendor/symfony/twig-bridge/Node/SearchAndRenderBlockNode.php +++ b/vendor/symfony/twig-bridge/Node/SearchAndRenderBlockNode.php @@ -24,7 +24,7 @@ class SearchAndRenderBlockNode extends FunctionExpression public function compile(Compiler $compiler) { $compiler->addDebugInfo($this); - $compiler->raw('$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->searchAndRenderBlock('); + $compiler->raw('$this->env->getRuntime(\'Symfony\Component\Form\FormRenderer\')->searchAndRenderBlock('); preg_match('/_([^_]+)$/', $this->getAttribute('name'), $matches); diff --git a/vendor/symfony/twig-bridge/NodeVisitor/Scope.php b/vendor/symfony/twig-bridge/NodeVisitor/Scope.php index 1284cf52..1c3451bb 100644 --- a/vendor/symfony/twig-bridge/NodeVisitor/Scope.php +++ b/vendor/symfony/twig-bridge/NodeVisitor/Scope.php @@ -16,24 +16,10 @@ namespace Symfony\Bridge\Twig\NodeVisitor; */ class Scope { - /** - * @var Scope|null - */ private $parent; - - /** - * @var array - */ private $data = array(); - - /** - * @var bool - */ private $left = false; - /** - * @param Scope $parent - */ public function __construct(Scope $parent = null) { $this->parent = $parent; diff --git a/vendor/symfony/twig-bridge/NodeVisitor/TranslationDefaultDomainNodeVisitor.php b/vendor/symfony/twig-bridge/NodeVisitor/TranslationDefaultDomainNodeVisitor.php index c04ce13a..1a60e67a 100644 --- a/vendor/symfony/twig-bridge/NodeVisitor/TranslationDefaultDomainNodeVisitor.php +++ b/vendor/symfony/twig-bridge/NodeVisitor/TranslationDefaultDomainNodeVisitor.php @@ -30,9 +30,6 @@ use Twig\NodeVisitor\AbstractNodeVisitor; */ class TranslationDefaultDomainNodeVisitor extends AbstractNodeVisitor { - /** - * @var Scope - */ private $scope; public function __construct() diff --git a/vendor/symfony/twig-bridge/NodeVisitor/TranslationNodeVisitor.php b/vendor/symfony/twig-bridge/NodeVisitor/TranslationNodeVisitor.php index 01f230b9..1fbce9c6 100644 --- a/vendor/symfony/twig-bridge/NodeVisitor/TranslationNodeVisitor.php +++ b/vendor/symfony/twig-bridge/NodeVisitor/TranslationNodeVisitor.php @@ -123,8 +123,6 @@ class TranslationNodeVisitor extends AbstractNodeVisitor } /** - * @param Node $node - * * @return string|null */ private function getReadDomainFromNode(Node $node) diff --git a/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_3_horizontal_layout.html.twig b/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_3_horizontal_layout.html.twig index 5de20b1b..f0c4626d 100644 --- a/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_3_horizontal_layout.html.twig +++ b/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_3_horizontal_layout.html.twig @@ -8,14 +8,12 @@ {# Labels #} {% block form_label -%} -{% spaceless %} - {% if label is same as(false) %} + {%- if label is same as(false) -%} <div class="{{ block('form_label_class') }}"></div> - {% else %} - {% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ block('form_label_class'))|trim}) %} + {%- else -%} + {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ block('form_label_class'))|trim}) -%} {{- parent() -}} - {% endif %} -{% endspaceless %} + {%- endif -%} {%- endblock form_label %} {% block form_label_class -%} @@ -34,48 +32,34 @@ col-sm-2 {##}</div> {%- endblock form_row %} -{% block checkbox_row -%} - {{- block('checkbox_radio_row') -}} -{%- endblock checkbox_row %} - -{% block radio_row -%} - {{- block('checkbox_radio_row') -}} -{%- endblock radio_row %} - -{% block checkbox_radio_row -%} -{% spaceless %} - <div class="form-group{% if not valid %} has-error{% endif %}"> - <div class="{{ block('form_label_class') }}"></div> - <div class="{{ block('form_group_class') }}"> - {{ form_widget(form) }} - {{ form_errors(form) }} - </div> - </div> -{% endspaceless %} -{%- endblock checkbox_radio_row %} - {% block submit_row -%} -{% spaceless %} - <div class="form-group"> - <div class="{{ block('form_label_class') }}"></div> + <div class="form-group">{#--#} + <div class="{{ block('form_label_class') }}"></div>{#--#} <div class="{{ block('form_group_class') }}"> - {{ form_widget(form) }} - </div> + {{- form_widget(form) -}} + </div>{#--#} </div> -{% endspaceless %} -{% endblock submit_row %} +{%- endblock submit_row %} {% block reset_row -%} -{% spaceless %} - <div class="form-group"> - <div class="{{ block('form_label_class') }}"></div> + <div class="form-group">{#--#} + <div class="{{ block('form_label_class') }}"></div>{#--#} <div class="{{ block('form_group_class') }}"> - {{ form_widget(form) }} - </div> + {{- form_widget(form) -}} + </div>{#--#} </div> -{% endspaceless %} -{% endblock reset_row %} +{%- endblock reset_row %} {% block form_group_class -%} col-sm-10 {%- endblock form_group_class %} + +{% block checkbox_row -%} + <div class="form-group{% if not valid %} has-error{% endif %}">{#--#} + <div class="{{ block('form_label_class') }}"></div>{#--#} + <div class="{{ block('form_group_class') }}"> + {{- form_widget(form) -}} + {{- form_errors(form) -}} + </div>{#--#} + </div> +{%- endblock checkbox_row %} \ No newline at end of file diff --git a/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_3_layout.html.twig b/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_3_layout.html.twig index f2fe8bf3..0e198aa5 100644 --- a/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_3_layout.html.twig +++ b/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_3_layout.html.twig @@ -1,4 +1,4 @@ -{% use "form_div_layout.html.twig" %} +{% use "bootstrap_base_layout.html.twig" %} {# Widgets #} @@ -9,146 +9,10 @@ {{- parent() -}} {%- endblock form_widget_simple %} -{% block textarea_widget -%} - {% set attr = attr|merge({class: (attr.class|default('') ~ ' form-control')|trim}) %} - {{- parent() -}} -{%- endblock textarea_widget %} - {% block button_widget -%} - {% set attr = attr|merge({class: (attr.class|default('btn-default') ~ ' btn')|trim}) %} - {{- parent() -}} -{%- endblock %} - -{% block money_widget -%} - <div class="input-group"> - {% set append = money_pattern starts with '{{' %} - {% if not append %} - <span class="input-group-addon">{{ money_pattern|replace({ '{{ widget }}':''}) }}</span> - {% endif %} - {{- block('form_widget_simple') -}} - {% if append %} - <span class="input-group-addon">{{ money_pattern|replace({ '{{ widget }}':''}) }}</span> - {% endif %} - </div> -{%- endblock money_widget %} - -{% block percent_widget -%} - <div class="input-group"> - {{- block('form_widget_simple') -}} - <span class="input-group-addon">%</span> - </div> -{%- endblock percent_widget %} - -{% block datetime_widget -%} - {% if widget == 'single_text' %} - {{- block('form_widget_simple') -}} - {% else -%} - {% set attr = attr|merge({class: (attr.class|default('') ~ ' form-inline')|trim}) -%} - <div {{ block('widget_container_attributes') }}> - {{- form_errors(form.date) -}} - {{- form_errors(form.time) -}} - {{- form_widget(form.date, { datetime: true } ) -}} - {{- form_widget(form.time, { datetime: true } ) -}} - </div> - {%- endif %} -{%- endblock datetime_widget %} - -{% block date_widget -%} - {% if widget == 'single_text' %} - {{- block('form_widget_simple') -}} - {% else -%} - {% set attr = attr|merge({class: (attr.class|default('') ~ ' form-inline')|trim}) -%} - {% if datetime is not defined or not datetime -%} - <div {{ block('widget_container_attributes') -}}> - {%- endif %} - {{- date_pattern|replace({ - '{{ year }}': form_widget(form.year), - '{{ month }}': form_widget(form.month), - '{{ day }}': form_widget(form.day), - })|raw -}} - {% if datetime is not defined or not datetime -%} - </div> - {%- endif -%} - {% endif %} -{%- endblock date_widget %} - -{% block time_widget -%} - {% if widget == 'single_text' %} - {{- block('form_widget_simple') -}} - {% else -%} - {% set attr = attr|merge({class: (attr.class|default('') ~ ' form-inline')|trim}) -%} - {% if datetime is not defined or false == datetime -%} - <div {{ block('widget_container_attributes') -}}> - {%- endif -%} - {{- form_widget(form.hour) }}{% if with_minutes %}:{{ form_widget(form.minute) }}{% endif %}{% if with_seconds %}:{{ form_widget(form.second) }}{% endif %} - {% if datetime is not defined or false == datetime -%} - </div> - {%- endif -%} - {% endif %} -{%- endblock time_widget %} - -{%- block dateinterval_widget -%} - {%- if widget == 'single_text' -%} - {{- block('form_widget_simple') -}} - {%- else -%} - {%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-inline')|trim}) -%} - <div {{ block('widget_container_attributes') }}> - {{- form_errors(form) -}} - <div class="table-responsive"> - <table class="table {{ table_class|default('table-bordered table-condensed table-striped') }}"> - <thead> - <tr> - {%- if with_years %}<th>{{ form_label(form.years) }}</th>{% endif -%} - {%- if with_months %}<th>{{ form_label(form.months) }}</th>{% endif -%} - {%- if with_weeks %}<th>{{ form_label(form.weeks) }}</th>{% endif -%} - {%- if with_days %}<th>{{ form_label(form.days) }}</th>{% endif -%} - {%- if with_hours %}<th>{{ form_label(form.hours) }}</th>{% endif -%} - {%- if with_minutes %}<th>{{ form_label(form.minutes) }}</th>{% endif -%} - {%- if with_seconds %}<th>{{ form_label(form.seconds) }}</th>{% endif -%} - </tr> - </thead> - <tbody> - <tr> - {%- if with_years %}<td>{{ form_widget(form.years) }}</td>{% endif -%} - {%- if with_months %}<td>{{ form_widget(form.months) }}</td>{% endif -%} - {%- if with_weeks %}<td>{{ form_widget(form.weeks) }}</td>{% endif -%} - {%- if with_days %}<td>{{ form_widget(form.days) }}</td>{% endif -%} - {%- if with_hours %}<td>{{ form_widget(form.hours) }}</td>{% endif -%} - {%- if with_minutes %}<td>{{ form_widget(form.minutes) }}</td>{% endif -%} - {%- if with_seconds %}<td>{{ form_widget(form.seconds) }}</td>{% endif -%} - </tr> - </tbody> - </table> - </div> - {%- if with_invert %}{{ form_widget(form.invert) }}{% endif -%} - </div> - {%- endif -%} -{%- endblock dateinterval_widget -%} - -{% block choice_widget_collapsed -%} - {% set attr = attr|merge({class: (attr.class|default('') ~ ' form-control')|trim}) %} + {%- set attr = attr|merge({class: (attr.class|default('btn-default') ~ ' btn')|trim}) -%} {{- parent() -}} -{%- endblock %} - -{% block choice_widget_expanded -%} - {% if '-inline' in label_attr.class|default('') -%} - {%- for child in form %} - {{- form_widget(child, { - parent_label_class: label_attr.class|default(''), - translation_domain: choice_translation_domain, - }) -}} - {% endfor -%} - {%- else -%} - <div {{ block('widget_container_attributes') }}> - {%- for child in form %} - {{- form_widget(child, { - parent_label_class: label_attr.class|default(''), - translation_domain: choice_translation_domain, - }) -}} - {% endfor -%} - </div> - {%- endif %} -{%- endblock choice_widget_expanded %} +{%- endblock button_widget %} {% block checkbox_widget -%} {%- set parent_label_class = parent_label_class|default(label_attr.class|default('')) -%} @@ -158,18 +22,18 @@ <div class="checkbox"> {{- form_label(form, null, { widget: parent() }) -}} </div> - {%- endif %} + {%- endif -%} {%- endblock checkbox_widget %} {% block radio_widget -%} {%- set parent_label_class = parent_label_class|default(label_attr.class|default('')) -%} - {% if 'radio-inline' in parent_label_class %} + {%- if 'radio-inline' in parent_label_class -%} {{- form_label(form, null, { widget: parent() }) -}} - {% else -%} + {%- else -%} <div class="radio"> {{- form_label(form, null, { widget: parent() }) -}} </div> - {%- endif %} + {%- endif -%} {%- endblock radio_widget %} {# Labels #} @@ -186,37 +50,41 @@ {% endblock %} {% block checkbox_label -%} + {%- set label_attr = label_attr|merge({'for': id}) -%} + {{- block('checkbox_radio_label') -}} {%- endblock checkbox_label %} {% block radio_label -%} + {%- set label_attr = label_attr|merge({'for': id}) -%} + {{- block('checkbox_radio_label') -}} {%- endblock radio_label %} -{% block checkbox_radio_label %} +{% block checkbox_radio_label -%} {# Do not display the label if widget is not defined in order to prevent double label rendering #} - {% if widget is defined %} - {% if required %} - {% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' required')|trim}) %} - {% endif %} - {% if parent_label_class is defined %} - {% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ parent_label_class)|trim}) %} - {% endif %} - {% if label is not same as(false) and label is empty %} + {%- if widget is defined -%} + {%- if required -%} + {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' required')|trim}) -%} + {%- endif -%} + {%- if parent_label_class is defined -%} + {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ parent_label_class)|trim}) -%} + {%- endif -%} + {%- if label is not same as(false) and label is empty -%} {%- if label_format is not empty -%} - {% set label = label_format|replace({ + {%- set label = label_format|replace({ '%name%': name, '%id%': id, - }) %} + }) -%} {%- else -%} {% set label = name|humanize %} {%- endif -%} - {% endif %} + {%- endif -%} <label{% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}> {{- widget|raw }} {{ label is not same as(false) ? (translation_domain is same as(false) ? label : label|trans({}, translation_domain)) -}} </label> - {% endif %} -{% endblock checkbox_radio_label %} + {%- endif -%} +{%- endblock checkbox_radio_label %} {# Rows #} @@ -272,12 +140,12 @@ {% block form_errors -%} {% if errors|length > 0 -%} - {% if form.parent %}<span class="help-block">{% else %}<div class="alert alert-danger">{% endif %} + {% if form is not rootform %}<span class="help-block">{% else %}<div class="alert alert-danger">{% endif %} <ul class="list-unstyled"> {%- for error in errors -%} <li><span class="glyphicon glyphicon-exclamation-sign"></span> {{ error.message }}</li> {%- endfor -%} </ul> - {% if form.parent %}</span>{% else %}</div>{% endif %} + {% if form is not rootform %}</span>{% else %}</div>{% endif %} {%- endif %} {%- endblock form_errors %} diff --git a/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_4_horizontal_layout.html.twig b/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_4_horizontal_layout.html.twig new file mode 100644 index 00000000..e236d12c --- /dev/null +++ b/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_4_horizontal_layout.html.twig @@ -0,0 +1,79 @@ +{% use "bootstrap_4_layout.html.twig" %} + +{# Labels #} + +{% block form_label -%} + {%- if label is same as(false) -%} + <div class="{{ block('form_label_class') }}"></div> + {%- else -%} + {%- if expanded is not defined or not expanded -%} + {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' col-form-label')|trim}) -%} + {%- endif -%} + {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ block('form_label_class'))|trim}) -%} + {{- parent() -}} + {%- endif -%} +{%- endblock form_label %} + +{% block form_label_class -%} +col-sm-2 +{%- endblock form_label_class %} + +{# Rows #} + +{% block form_row -%} + {%- if expanded is defined and expanded -%} + {{ block('fieldset_form_row') }} + {%- else -%} + <div class="form-group row{% if (not compound or force_error|default(false)) and not valid %} is-invalid{% endif %}"> + {{- form_label(form) -}} + <div class="{{ block('form_group_class') }}"> + {{- form_widget(form) -}} + {{- form_errors(form) -}} + </div> + {##}</div> + {%- endif -%} +{%- endblock form_row %} + +{% block fieldset_form_row -%} + <fieldset class="form-group"> + <div class="row{% if (not compound or force_error|default(false)) and not valid %} is-invalid{% endif %}"> + {{- form_label(form) -}} + <div class="{{ block('form_group_class') }}"> + {{- form_widget(form) -}} + {{- form_errors(form) -}} + </div> + </div> +{##}</fieldset> +{%- endblock fieldset_form_row %} + +{% block submit_row -%} + <div class="form-group row">{#--#} + <div class="{{ block('form_label_class') }}"></div>{#--#} + <div class="{{ block('form_group_class') }}"> + {{- form_widget(form) -}} + </div>{#--#} + </div> +{%- endblock submit_row %} + +{% block reset_row -%} + <div class="form-group row">{#--#} + <div class="{{ block('form_label_class') }}"></div>{#--#} + <div class="{{ block('form_group_class') }}"> + {{- form_widget(form) -}} + </div>{#--#} + </div> +{%- endblock reset_row %} + +{% block form_group_class -%} +col-sm-10 +{%- endblock form_group_class %} + +{% block checkbox_row -%} + <div class="form-group row">{#--#} + <div class="{{ block('form_label_class') }}"></div>{#--#} + <div class="{{ block('form_group_class') }}"> + {{- form_widget(form) -}} + {{- form_errors(form) -}} + </div>{#--#} + </div> +{%- endblock checkbox_row %} diff --git a/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_4_layout.html.twig b/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_4_layout.html.twig new file mode 100644 index 00000000..15413f1c --- /dev/null +++ b/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_4_layout.html.twig @@ -0,0 +1,188 @@ +{% use "bootstrap_base_layout.html.twig" %} + +{# Widgets #} + +{% block money_widget -%} + {% if not valid %} + {% set group_class = ' form-control is-invalid' %} + {% set valid = true %} + {% endif %} + {{- parent() -}} +{%- endblock money_widget %} + +{% block datetime_widget -%} + {%- if widget != 'single_text' and not valid -%} + {% set attr = attr|merge({class: (attr.class|default('') ~ ' form-control is-invalid')|trim}) -%} + {% set valid = true %} + {%- endif -%} + {{- parent() -}} +{%- endblock datetime_widget %} + +{% block date_widget -%} + {%- if widget != 'single_text' and not valid -%} + {% set attr = attr|merge({class: (attr.class|default('') ~ ' form-control is-invalid')|trim}) -%} + {% set valid = true %} + {%- endif -%} + {{- parent() -}} +{%- endblock date_widget %} + +{% block time_widget -%} + {%- if widget != 'single_text' and not valid -%} + {% set attr = attr|merge({class: (attr.class|default('') ~ ' form-control is-invalid')|trim}) -%} + {% set valid = true %} + {%- endif -%} + {{- parent() -}} +{%- endblock time_widget %} + +{% block dateinterval_widget -%} + {%- if widget != 'single_text' and not valid -%} + {% set attr = attr|merge({class: (attr.class|default('') ~ ' form-control is-invalid')|trim}) -%} + {% set valid = true %} + {%- endif -%} + {{- parent() -}} +{%- endblock dateinterval_widget %} + +{% block percent_widget -%} + <div class="input-group{{ not valid ? ' form-control is-invalid' }}"> + {% set valid = true %} + {{- block('form_widget_simple') -}} + <span class="input-group-addon">%</span> + </div> +{%- endblock percent_widget %} + +{% block form_widget_simple -%} + {% if type is not defined or type != 'hidden' %} + {%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-control' ~ (type|default('') == 'file' ? '-file' : ''))|trim}) -%} + {% endif %} + {{- parent() -}} +{%- endblock form_widget_simple %} + +{%- block widget_attributes -%} + {%- if not valid %} + {% set attr = attr|merge({class: (attr.class|default('') ~ ' form-control is-invalid')|trim}) %} + {% endif -%} + {{ parent() }} +{%- endblock widget_attributes -%} + +{% block button_widget -%} + {%- set attr = attr|merge({class: (attr.class|default('btn-secondary') ~ ' btn')|trim}) -%} + {{- parent() -}} +{%- endblock button_widget %} + +{% block checkbox_widget -%} + {%- set parent_label_class = parent_label_class|default(label_attr.class|default('')) -%} + {%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-check-input')|trim}) -%} + {% if 'checkbox-inline' in parent_label_class %} + {{- form_label(form, null, { widget: parent() }) -}} + {% elseif 'form-check-inline' in parent_label_class %} + <div class="form-check{{ not valid ? ' form-control is-invalid' }} form-check-inline"> + {{- form_label(form, null, { widget: parent() }) -}} + </div> + {% else -%} + <div class="form-check{{ not valid ? ' form-control is-invalid' }}"> + {{- form_label(form, null, { widget: parent() }) -}} + </div> + {%- endif -%} +{%- endblock checkbox_widget %} + +{% block radio_widget -%} + {%- set parent_label_class = parent_label_class|default(label_attr.class|default('')) -%} + {%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-check-input')|trim}) -%} + {%- if 'radio-inline' in parent_label_class -%} + {{- form_label(form, null, { widget: parent() }) -}} + {%- else -%} + <div class="form-check{{ not valid ? ' form-control is-invalid' }}"> + {{- form_label(form, null, { widget: parent() }) -}} + </div> + {%- endif -%} +{%- endblock radio_widget %} + +{% block choice_widget_expanded -%} + {% if '-inline' in label_attr.class|default('') -%} + {%- for child in form %} + {{- form_widget(child, { + parent_label_class: label_attr.class|default(''), + translation_domain: choice_translation_domain, + valid: valid, + }) -}} + {% endfor -%} + {%- else -%} + {%- if not valid -%} + {%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-control is-invalid')|trim}) %} + {%- endif -%} + <div {{ block('widget_container_attributes') }}> + {%- for child in form %} + {{- form_widget(child, { + parent_label_class: label_attr.class|default(''), + translation_domain: choice_translation_domain, + valid: true, + }) -}} + {% endfor -%} + </div> + {%- endif %} +{%- endblock choice_widget_expanded %} + +{# Labels #} + +{% block form_label -%} + {%- if compound is defined and compound -%} + {%- set element = 'legend' -%} + {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' col-form-legend')|trim}) -%} + {%- else -%} + {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' form-control-label')|trim}) -%} + {%- endif -%} + {{- parent() -}} +{%- endblock form_label %} + +{% block checkbox_radio_label -%} + {#- Do not display the label if widget is not defined in order to prevent double label rendering -#} + {%- if widget is defined -%} + {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' form-check-label')|trim}) -%} + {%- if required -%} + {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' required')|trim}) -%} + {%- endif -%} + {%- if parent_label_class is defined -%} + {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ parent_label_class)|trim}) -%} + {%- endif -%} + {%- if label is not same as(false) and label is empty -%} + {%- if label_format is not empty -%} + {%- set label = label_format|replace({ + '%name%': name, + '%id%': id, + }) -%} + {%- else -%} + {%- set label = name|humanize -%} + {%- endif -%} + {%- endif -%} + <label{% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}> + {{- widget|raw }} {{ label is not same as(false) ? (translation_domain is same as(false) ? label : label|trans({}, translation_domain)) -}} + </label> + {%- endif -%} +{%- endblock checkbox_radio_label %} + +{# Rows #} + +{% block form_row -%} + {%- if compound is defined and compound -%} + {%- set element = 'fieldset' -%} + {%- endif -%} + <{{ element|default('div') }} class="form-group"> + {{- form_label(form) -}} + {{- form_widget(form) -}} + {{- form_errors(form) -}} + </{{ element|default('div') }}> +{%- endblock form_row %} + +{# Errors #} + +{% block form_errors -%} + {%- if errors|length > 0 -%} + <div class="{% if form is not rootform %}invalid-feedback{% else %}alert alert-danger{% endif %}"> + <ul class="list-unstyled mb-0"> + {%- for error in errors -%} + <li>{{ error.message }}</li> + {%- endfor -%} + </ul> + </div> + {%- endif %} +{%- endblock form_errors %} diff --git a/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_base_layout.html.twig b/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_base_layout.html.twig new file mode 100644 index 00000000..d5797822 --- /dev/null +++ b/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_base_layout.html.twig @@ -0,0 +1,188 @@ +{% use "form_div_layout.html.twig" %} + +{# Widgets #} + +{% block textarea_widget -%} + {% set attr = attr|merge({class: (attr.class|default('') ~ ' form-control')|trim}) %} + {{- parent() -}} +{%- endblock textarea_widget %} + +{% block money_widget -%} + {% set prepend = not (money_pattern starts with '{{') %} + {% set append = not (money_pattern ends with '}}') %} + {% if prepend or append %} + <div class="input-group{{ group_class|default('') }}"> + {% if prepend %} + <span class="input-group-addon">{{ money_pattern|replace({ '{{ widget }}':''}) }}</span> + {% endif %} + {{- block('form_widget_simple') -}} + {% if append %} + <span class="input-group-addon">{{ money_pattern|replace({ '{{ widget }}':''}) }}</span> + {% endif %} + </div> + {% else %} + {{- block('form_widget_simple') -}} + {% endif %} +{%- endblock money_widget %} + +{% block percent_widget -%} + <div class="input-group"> + {{- block('form_widget_simple') -}} + <span class="input-group-addon">%</span> + </div> +{%- endblock percent_widget %} + +{% block datetime_widget -%} + {%- if widget == 'single_text' -%} + {{- block('form_widget_simple') -}} + {%- else -%} + {% set attr = attr|merge({class: (attr.class|default('') ~ ' form-inline')|trim}) -%} + <div {{ block('widget_container_attributes') }}> + {{- form_errors(form.date) -}} + {{- form_errors(form.time) -}} + {{- form_widget(form.date, { datetime: true } ) -}} + {{- form_widget(form.time, { datetime: true } ) -}} + </div> + {%- endif -%} +{%- endblock datetime_widget %} + +{% block date_widget -%} + {%- if widget == 'single_text' -%} + {{- block('form_widget_simple') -}} + {%- else -%} + {%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-inline')|trim}) -%} + {%- if datetime is not defined or not datetime -%} + <div {{ block('widget_container_attributes') -}}> + {%- endif %} + {{- date_pattern|replace({ + '{{ year }}': form_widget(form.year), + '{{ month }}': form_widget(form.month), + '{{ day }}': form_widget(form.day), + })|raw -}} + {%- if datetime is not defined or not datetime -%} + </div> + {%- endif -%} + {%- endif -%} +{%- endblock date_widget %} + +{% block time_widget -%} + {%- if widget == 'single_text' -%} + {{- block('form_widget_simple') -}} + {%- else -%} + {%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-inline')|trim}) -%} + {%- if datetime is not defined or false == datetime -%} + <div {{ block('widget_container_attributes') -}}> + {%- endif -%} + {{- form_widget(form.hour) }}{% if with_minutes %}:{{ form_widget(form.minute) }}{% endif %}{% if with_seconds %}:{{ form_widget(form.second) }}{% endif %} + {%- if datetime is not defined or false == datetime -%} + </div> + {%- endif -%} + {%- endif -%} +{%- endblock time_widget %} + +{%- block dateinterval_widget -%} + {%- if widget == 'single_text' -%} + {{- block('form_widget_simple') -}} + {%- else -%} + {%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-inline')|trim}) -%} + <div {{ block('widget_container_attributes') }}> + {{- form_errors(form) -}} + <div class="table-responsive"> + <table class="table {{ table_class|default('table-bordered table-condensed table-striped') }}"> + <thead> + <tr> + {%- if with_years %}<th>{{ form_label(form.years) }}</th>{% endif -%} + {%- if with_months %}<th>{{ form_label(form.months) }}</th>{% endif -%} + {%- if with_weeks %}<th>{{ form_label(form.weeks) }}</th>{% endif -%} + {%- if with_days %}<th>{{ form_label(form.days) }}</th>{% endif -%} + {%- if with_hours %}<th>{{ form_label(form.hours) }}</th>{% endif -%} + {%- if with_minutes %}<th>{{ form_label(form.minutes) }}</th>{% endif -%} + {%- if with_seconds %}<th>{{ form_label(form.seconds) }}</th>{% endif -%} + </tr> + </thead> + <tbody> + <tr> + {%- if with_years %}<td>{{ form_widget(form.years) }}</td>{% endif -%} + {%- if with_months %}<td>{{ form_widget(form.months) }}</td>{% endif -%} + {%- if with_weeks %}<td>{{ form_widget(form.weeks) }}</td>{% endif -%} + {%- if with_days %}<td>{{ form_widget(form.days) }}</td>{% endif -%} + {%- if with_hours %}<td>{{ form_widget(form.hours) }}</td>{% endif -%} + {%- if with_minutes %}<td>{{ form_widget(form.minutes) }}</td>{% endif -%} + {%- if with_seconds %}<td>{{ form_widget(form.seconds) }}</td>{% endif -%} + </tr> + </tbody> + </table> + </div> + {%- if with_invert %}{{ form_widget(form.invert) }}{% endif -%} + </div> + {%- endif -%} +{%- endblock dateinterval_widget -%} + +{% block choice_widget_collapsed -%} + {%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-control')|trim}) -%} + {{- parent() -}} +{%- endblock choice_widget_collapsed %} + +{% block choice_widget_expanded -%} + {%- if '-inline' in label_attr.class|default('') -%} + {%- for child in form %} + {{- form_widget(child, { + parent_label_class: label_attr.class|default(''), + translation_domain: choice_translation_domain, + }) -}} + {% endfor -%} + {%- else -%} + <div {{ block('widget_container_attributes') }}> + {%- for child in form %} + {{- form_widget(child, { + parent_label_class: label_attr.class|default(''), + translation_domain: choice_translation_domain, + }) -}} + {%- endfor -%} + </div> + {%- endif -%} +{%- endblock choice_widget_expanded %} + +{# Labels #} + +{% block choice_label -%} + {# remove the checkbox-inline and radio-inline class, it's only useful for embed labels #} + {%- set label_attr = label_attr|merge({class: label_attr.class|default('')|replace({'checkbox-inline': '', 'radio-inline': ''})|trim}) -%} + {{- block('form_label') -}} +{% endblock choice_label %} + +{% block checkbox_label -%} + {{- block('checkbox_radio_label') -}} +{%- endblock checkbox_label %} + +{% block radio_label -%} + {{- block('checkbox_radio_label') -}} +{%- endblock radio_label %} + +{# Rows #} + +{% block button_row -%} + <div class="form-group"> + {{- form_widget(form) -}} + </div> +{%- endblock button_row %} + +{% block choice_row -%} + {%- set force_error = true -%} + {{- block('form_row') -}} +{%- endblock choice_row %} + +{% block date_row -%} + {%- set force_error = true -%} + {{- block('form_row') -}} +{%- endblock date_row %} + +{% block time_row -%} + {%- set force_error = true -%} + {{- block('form_row') -}} +{%- endblock time_row %} + +{% block datetime_row -%} + {%- set force_error = true -%} + {{- block('form_row') -}} +{%- endblock datetime_row %} diff --git a/vendor/symfony/twig-bridge/Resources/views/Form/form_div_layout.html.twig b/vendor/symfony/twig-bridge/Resources/views/Form/form_div_layout.html.twig index 3d8afe2c..f85aad1c 100644 --- a/vendor/symfony/twig-bridge/Resources/views/Form/form_div_layout.html.twig +++ b/vendor/symfony/twig-bridge/Resources/views/Form/form_div_layout.html.twig @@ -15,7 +15,7 @@ {%- block form_widget_compound -%} <div {{ block('widget_container_attributes') }}> - {%- if form.parent is empty -%} + {%- if form is rootform -%} {{ form_errors(form) }} {%- endif -%} {{- block('form_rows') -}} @@ -222,6 +222,8 @@ '%name%': name, '%id%': id, }) %} + {%- elseif label is same as(false) -%} + {% set translation_domain = false %} {%- else -%} {% set label = name|humanize %} {%- endif -%} @@ -239,6 +241,16 @@ {{ block('button_widget') }} {%- endblock reset_widget -%} +{%- block tel_widget -%} + {%- set type = type|default('tel') -%} + {{ block('form_widget_simple') }} +{%- endblock tel_widget -%} + +{%- block color_widget -%} + {%- set type = type|default('color') -%} + {{ block('form_widget_simple') }} +{%- endblock color_widget -%} + {# Labels #} {%- block form_label -%} @@ -259,7 +271,7 @@ {% set label = name|humanize %} {%- endif -%} {%- endif -%} - <label{% if label_attr %}{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}{% endif %}>{{ translation_domain is same as(false) ? label : label|trans({}, translation_domain) }}</label> + <{{ element|default('label') }}{% if label_attr %}{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}{% endif %}>{{ translation_domain is same as(false) ? label : label|trans({}, translation_domain) }}</{{ element|default('label') }}> {%- endif -%} {%- endblock form_label -%} @@ -337,9 +349,9 @@ {% if not child.rendered %} {{- form_row(child) -}} {% endif %} - {%- endfor %} + {%- endfor -%} - {% if not form.methodRendered and form.parent is null %} + {% if not form.methodRendered and form is rootform %} {%- do form.setMethodRendered() -%} {% set method = method|upper %} {%- if method in ["GET", "POST"] -%} @@ -351,7 +363,7 @@ {%- if form_method != method -%} <input type="hidden" name="_method" value="{{ method }}" /> {%- endif -%} - {% endif %} + {% endif -%} {% endblock form_rest %} {# Support #} diff --git a/vendor/symfony/twig-bridge/Resources/views/Form/form_table_layout.html.twig b/vendor/symfony/twig-bridge/Resources/views/Form/form_table_layout.html.twig index c7b3a436..39274c6c 100644 --- a/vendor/symfony/twig-bridge/Resources/views/Form/form_table_layout.html.twig +++ b/vendor/symfony/twig-bridge/Resources/views/Form/form_table_layout.html.twig @@ -31,7 +31,7 @@ {%- block form_widget_compound -%} <table {{ block('widget_container_attributes') }}> - {%- if form.parent is empty and errors|length > 0 -%} + {%- if form is rootform and errors|length > 0 -%} <tr> <td colspan="2"> {{- form_errors(form) -}} diff --git a/vendor/symfony/twig-bridge/Resources/views/Form/foundation_5_layout.html.twig b/vendor/symfony/twig-bridge/Resources/views/Form/foundation_5_layout.html.twig index dc7bec9f..3035689c 100644 --- a/vendor/symfony/twig-bridge/Resources/views/Form/foundation_5_layout.html.twig +++ b/vendor/symfony/twig-bridge/Resources/views/Form/foundation_5_layout.html.twig @@ -20,7 +20,7 @@ {% block button_widget -%} {% set attr = attr|merge({class: (attr.class|default('') ~ ' button')|trim}) %} {{- parent() -}} -{%- endblock %} +{%- endblock button_widget %} {% block money_widget -%} <div class="row collapse"> @@ -228,7 +228,7 @@ {# remove the checkbox-inline and radio-inline class, it's only useful for embed labels #} {% set label_attr = label_attr|merge({class: label_attr.class|default('')|replace({'checkbox-inline': '', 'radio-inline': ''})|trim}) %} {{- block('form_label') -}} -{%- endblock %} +{%- endblock choice_label %} {% block checkbox_label -%} {{- block('checkbox_radio_label') -}} @@ -318,11 +318,11 @@ {% block form_errors -%} {% if errors|length > 0 -%} - {% if form.parent %}<small class="error">{% else %}<div data-alert class="alert-box alert">{% endif %} + {% if form is not rootform %}<small class="error">{% else %}<div data-alert class="alert-box alert">{% endif %} {%- for error in errors -%} {{ error.message }} {% if not loop.last %}, {% endif %} {%- endfor -%} - {% if form.parent %}</small>{% else %}</div>{% endif %} + {% if form is not rootform %}</small>{% else %}</div>{% endif %} {%- endif %} {%- endblock form_errors %} diff --git a/vendor/symfony/twig-bridge/Tests/AppVariableTest.php b/vendor/symfony/twig-bridge/Tests/AppVariableTest.php index 2a97c269..27eca0c4 100644 --- a/vendor/symfony/twig-bridge/Tests/AppVariableTest.php +++ b/vendor/symfony/twig-bridge/Tests/AppVariableTest.php @@ -45,10 +45,14 @@ class AppVariableTest extends TestCase $this->assertEquals('dev', $this->appVariable->getEnvironment()); } + /** + * @runInSeparateProcess + */ public function testGetSession() { + $session = $this->getMockBuilder(Session::class)->disableOriginalConstructor()->getMock(); $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock(); - $request->method('getSession')->willReturn($session = new Session()); + $request->method('getSession')->willReturn($session); $this->setRequestStack($request); @@ -165,16 +169,18 @@ class AppVariableTest extends TestCase $this->assertEquals(array(), $this->appVariable->getFlashes()); } + /** + * @runInSeparateProcess + */ public function testGetFlashesWithNoSessionStarted() { - $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock(); - $request->method('getSession')->willReturn(new Session()); - - $this->setRequestStack($request); - - $this->assertEquals(array(), $this->appVariable->getFlashes()); + $flashMessages = $this->setFlashMessages(false); + $this->assertEquals($flashMessages, $this->appVariable->getFlashes()); } + /** + * @runInSeparateProcess + */ public function testGetFlashes() { $flashMessages = $this->setFlashMessages(); @@ -247,7 +253,7 @@ class AppVariableTest extends TestCase $token->method('getUser')->willReturn($user); } - private function setFlashMessages() + private function setFlashMessages($sessionHasStarted = true) { $flashMessages = array( 'notice' => array('Notice #1 message'), @@ -257,8 +263,8 @@ class AppVariableTest extends TestCase $flashBag = new FlashBag(); $flashBag->initialize($flashMessages); - $session = $this->getMockBuilder('Symfony\Component\HttpFoundation\Session\Session')->getMock(); - $session->method('isStarted')->willReturn(true); + $session = $this->getMockBuilder('Symfony\Component\HttpFoundation\Session\Session')->disableOriginalConstructor()->getMock(); + $session->method('isStarted')->willReturn($sessionHasStarted); $session->method('getFlashBag')->willReturn($flashBag); $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock(); diff --git a/vendor/symfony/twig-bridge/Tests/Command/LintCommandTest.php b/vendor/symfony/twig-bridge/Tests/Command/LintCommandTest.php index ef7698c3..9ef18640 100644 --- a/vendor/symfony/twig-bridge/Tests/Command/LintCommandTest.php +++ b/vendor/symfony/twig-bridge/Tests/Command/LintCommandTest.php @@ -68,15 +68,30 @@ class LintCommandTest extends TestCase $this->assertRegExp('/ERROR in \S+ \(line /', trim($tester->getDisplay())); } + /** + * @group legacy + * @expectedDeprecation Passing a command name as the first argument of "Symfony\Bridge\Twig\Command\LintCommand::__construct" is deprecated since Symfony 3.4 and will be removed in 4.0. If the command was registered by convention, make it a service instead. + * @expectedException \RuntimeException + * @expectedExceptionMessage The Twig environment needs to be set. + */ + public function testLegacyLintCommand() + { + $command = new LintCommand(); + + $application = new Application(); + $application->add($command); + $command = $application->find('lint:twig'); + + $tester = new CommandTester($command); + $tester->execute(array()); + } + /** * @return CommandTester */ private function createCommandTester() { - $twig = new Environment(new FilesystemLoader()); - - $command = new LintCommand(); - $command->setTwigEnvironment($twig); + $command = new LintCommand(new Environment(new FilesystemLoader())); $application = new Application(); $application->add($command); diff --git a/vendor/symfony/twig-bridge/Tests/Extension/FormExtensionBootstrap3HorizontalLayoutTest.php b/vendor/symfony/twig-bridge/Tests/Extension/FormExtensionBootstrap3HorizontalLayoutTest.php index eb53b128..e5ee8903 100644 --- a/vendor/symfony/twig-bridge/Tests/Extension/FormExtensionBootstrap3HorizontalLayoutTest.php +++ b/vendor/symfony/twig-bridge/Tests/Extension/FormExtensionBootstrap3HorizontalLayoutTest.php @@ -12,11 +12,11 @@ namespace Symfony\Bridge\Twig\Tests\Extension; use Symfony\Bridge\Twig\Extension\FormExtension; -use Symfony\Bridge\Twig\Form\TwigRenderer; use Symfony\Bridge\Twig\Form\TwigRendererEngine; use Symfony\Bridge\Twig\Extension\TranslationExtension; use Symfony\Bridge\Twig\Tests\Extension\Fixtures\StubTranslator; use Symfony\Bridge\Twig\Tests\Extension\Fixtures\StubFilesystemLoader; +use Symfony\Component\Form\FormRenderer; use Symfony\Component\Form\FormView; use Symfony\Component\Form\Tests\AbstractBootstrap3HorizontalLayoutTest; use Twig\Environment; @@ -29,6 +29,9 @@ class FormExtensionBootstrap3HorizontalLayoutTest extends AbstractBootstrap3Hori 'choice_attr', ); + /** + * @var FormRenderer + */ private $renderer; protected function setUp() @@ -48,7 +51,7 @@ class FormExtensionBootstrap3HorizontalLayoutTest extends AbstractBootstrap3Hori 'bootstrap_3_horizontal_layout.html.twig', 'custom_widgets.html.twig', ), $environment); - $this->renderer = new TwigRenderer($rendererEngine, $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock()); + $this->renderer = new FormRenderer($rendererEngine, $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock()); $this->registerTwigRuntimeLoader($environment, $this->renderer); } @@ -96,8 +99,8 @@ class FormExtensionBootstrap3HorizontalLayoutTest extends AbstractBootstrap3Hori return (string) $this->renderer->renderBlock($view, 'form_end', $vars); } - protected function setTheme(FormView $view, array $themes) + protected function setTheme(FormView $view, array $themes, $useDefaultThemes = true) { - $this->renderer->setTheme($view, $themes); + $this->renderer->setTheme($view, $themes, $useDefaultThemes); } } diff --git a/vendor/symfony/twig-bridge/Tests/Extension/FormExtensionBootstrap3LayoutTest.php b/vendor/symfony/twig-bridge/Tests/Extension/FormExtensionBootstrap3LayoutTest.php index 03d9c98f..5e872b83 100644 --- a/vendor/symfony/twig-bridge/Tests/Extension/FormExtensionBootstrap3LayoutTest.php +++ b/vendor/symfony/twig-bridge/Tests/Extension/FormExtensionBootstrap3LayoutTest.php @@ -12,11 +12,11 @@ namespace Symfony\Bridge\Twig\Tests\Extension; use Symfony\Bridge\Twig\Extension\FormExtension; -use Symfony\Bridge\Twig\Form\TwigRenderer; use Symfony\Bridge\Twig\Form\TwigRendererEngine; use Symfony\Bridge\Twig\Extension\TranslationExtension; use Symfony\Bridge\Twig\Tests\Extension\Fixtures\StubTranslator; use Symfony\Bridge\Twig\Tests\Extension\Fixtures\StubFilesystemLoader; +use Symfony\Component\Form\FormRenderer; use Symfony\Component\Form\FormView; use Symfony\Component\Form\Tests\AbstractBootstrap3LayoutTest; use Twig\Environment; @@ -25,6 +25,9 @@ class FormExtensionBootstrap3LayoutTest extends AbstractBootstrap3LayoutTest { use RuntimeLoaderProvider; + /** + * @var FormRenderer + */ private $renderer; protected function setUp() @@ -44,7 +47,7 @@ class FormExtensionBootstrap3LayoutTest extends AbstractBootstrap3LayoutTest 'bootstrap_3_layout.html.twig', 'custom_widgets.html.twig', ), $environment); - $this->renderer = new TwigRenderer($rendererEngine, $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock()); + $this->renderer = new FormRenderer($rendererEngine, $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock()); $this->registerTwigRuntimeLoader($environment, $this->renderer); } @@ -116,8 +119,8 @@ class FormExtensionBootstrap3LayoutTest extends AbstractBootstrap3LayoutTest return (string) $this->renderer->renderBlock($view, 'form_end', $vars); } - protected function setTheme(FormView $view, array $themes) + protected function setTheme(FormView $view, array $themes, $useDefaultThemes = true) { - $this->renderer->setTheme($view, $themes); + $this->renderer->setTheme($view, $themes, $useDefaultThemes); } } diff --git a/vendor/symfony/twig-bridge/Tests/Extension/FormExtensionBootstrap4HorizontalLayoutTest.php b/vendor/symfony/twig-bridge/Tests/Extension/FormExtensionBootstrap4HorizontalLayoutTest.php new file mode 100644 index 00000000..063edd88 --- /dev/null +++ b/vendor/symfony/twig-bridge/Tests/Extension/FormExtensionBootstrap4HorizontalLayoutTest.php @@ -0,0 +1,107 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\Tests\Extension; + +use Symfony\Bridge\Twig\Extension\FormExtension; +use Symfony\Bridge\Twig\Form\TwigRendererEngine; +use Symfony\Bridge\Twig\Extension\TranslationExtension; +use Symfony\Bridge\Twig\Tests\Extension\Fixtures\StubTranslator; +use Symfony\Bridge\Twig\Tests\Extension\Fixtures\StubFilesystemLoader; +use Symfony\Component\Form\FormRenderer; +use Symfony\Component\Form\FormView; +use Symfony\Component\Form\Tests\AbstractBootstrap4HorizontalLayoutTest; + +/** + * Class providing test cases for the Bootstrap 4 Twig form theme. + * + * @author Hidde Wieringa <hidde@hiddewieringa.nl> + */ +class FormExtensionBootstrap4HorizontalLayoutTest extends AbstractBootstrap4HorizontalLayoutTest +{ + use RuntimeLoaderProvider; + + protected $testableFeatures = array( + 'choice_attr', + ); + + private $renderer; + + protected function setUp() + { + parent::setUp(); + + $loader = new StubFilesystemLoader(array( + __DIR__.'/../../Resources/views/Form', + __DIR__.'/Fixtures/templates/form', + )); + + $environment = new \Twig_Environment($loader, array('strict_variables' => true)); + $environment->addExtension(new TranslationExtension(new StubTranslator())); + $environment->addExtension(new FormExtension()); + + $rendererEngine = new TwigRendererEngine(array( + 'bootstrap_4_horizontal_layout.html.twig', + 'custom_widgets.html.twig', + ), $environment); + $this->renderer = new FormRenderer($rendererEngine, $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock()); + $this->registerTwigRuntimeLoader($environment, $this->renderer); + } + + protected function renderForm(FormView $view, array $vars = array()) + { + return (string) $this->renderer->renderBlock($view, 'form', $vars); + } + + protected function renderLabel(FormView $view, $label = null, array $vars = array()) + { + if (null !== $label) { + $vars += array('label' => $label); + } + + return (string) $this->renderer->searchAndRenderBlock($view, 'label', $vars); + } + + protected function renderErrors(FormView $view) + { + return (string) $this->renderer->searchAndRenderBlock($view, 'errors'); + } + + protected function renderWidget(FormView $view, array $vars = array()) + { + return (string) $this->renderer->searchAndRenderBlock($view, 'widget', $vars); + } + + protected function renderRow(FormView $view, array $vars = array()) + { + return (string) $this->renderer->searchAndRenderBlock($view, 'row', $vars); + } + + protected function renderRest(FormView $view, array $vars = array()) + { + return (string) $this->renderer->searchAndRenderBlock($view, 'rest', $vars); + } + + protected function renderStart(FormView $view, array $vars = array()) + { + return (string) $this->renderer->renderBlock($view, 'form_start', $vars); + } + + protected function renderEnd(FormView $view, array $vars = array()) + { + return (string) $this->renderer->renderBlock($view, 'form_end', $vars); + } + + protected function setTheme(FormView $view, array $themes, $useDefaultThemes = true) + { + $this->renderer->setTheme($view, $themes, $useDefaultThemes); + } +} diff --git a/vendor/symfony/twig-bridge/Tests/Extension/FormExtensionBootstrap4LayoutTest.php b/vendor/symfony/twig-bridge/Tests/Extension/FormExtensionBootstrap4LayoutTest.php new file mode 100644 index 00000000..d3822ee7 --- /dev/null +++ b/vendor/symfony/twig-bridge/Tests/Extension/FormExtensionBootstrap4LayoutTest.php @@ -0,0 +1,129 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\Tests\Extension; + +use Symfony\Bridge\Twig\Extension\FormExtension; +use Symfony\Bridge\Twig\Form\TwigRendererEngine; +use Symfony\Bridge\Twig\Extension\TranslationExtension; +use Symfony\Bridge\Twig\Tests\Extension\Fixtures\StubTranslator; +use Symfony\Bridge\Twig\Tests\Extension\Fixtures\StubFilesystemLoader; +use Symfony\Component\Form\FormRenderer; +use Symfony\Component\Form\FormView; +use Symfony\Component\Form\Tests\AbstractBootstrap4LayoutTest; + +/** + * Class providing test cases for the Bootstrap 4 horizontal Twig form theme. + * + * @author Hidde Wieringa <hidde@hiddewieringa.nl> + */ +class FormExtensionBootstrap4LayoutTest extends AbstractBootstrap4LayoutTest +{ + use RuntimeLoaderProvider; + /** + * @var FormRenderer; + */ + private $renderer; + + protected function setUp() + { + parent::setUp(); + + $loader = new StubFilesystemLoader(array( + __DIR__.'/../../Resources/views/Form', + __DIR__.'/Fixtures/templates/form', + )); + + $environment = new \Twig_Environment($loader, array('strict_variables' => true)); + $environment->addExtension(new TranslationExtension(new StubTranslator())); + $environment->addExtension(new FormExtension()); + + $rendererEngine = new TwigRendererEngine(array( + 'bootstrap_4_layout.html.twig', + 'custom_widgets.html.twig', + ), $environment); + $this->renderer = new FormRenderer($rendererEngine, $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock()); + $this->registerTwigRuntimeLoader($environment, $this->renderer); + } + + public function testStartTagHasNoActionAttributeWhenActionIsEmpty() + { + $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, array( + 'method' => 'get', + 'action' => '', + )); + + $html = $this->renderStart($form->createView()); + + $this->assertSame('<form name="form" method="get">', $html); + } + + public function testStartTagHasActionAttributeWhenActionIsZero() + { + $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, array( + 'method' => 'get', + 'action' => '0', + )); + + $html = $this->renderStart($form->createView()); + + $this->assertSame('<form name="form" method="get" action="0">', $html); + } + + protected function renderForm(FormView $view, array $vars = array()) + { + return (string) $this->renderer->renderBlock($view, 'form', $vars); + } + + protected function renderLabel(FormView $view, $label = null, array $vars = array()) + { + if (null !== $label) { + $vars += array('label' => $label); + } + + return (string) $this->renderer->searchAndRenderBlock($view, 'label', $vars); + } + + protected function renderErrors(FormView $view) + { + return (string) $this->renderer->searchAndRenderBlock($view, 'errors'); + } + + protected function renderWidget(FormView $view, array $vars = array()) + { + return (string) $this->renderer->searchAndRenderBlock($view, 'widget', $vars); + } + + protected function renderRow(FormView $view, array $vars = array()) + { + return (string) $this->renderer->searchAndRenderBlock($view, 'row', $vars); + } + + protected function renderRest(FormView $view, array $vars = array()) + { + return (string) $this->renderer->searchAndRenderBlock($view, 'rest', $vars); + } + + protected function renderStart(FormView $view, array $vars = array()) + { + return (string) $this->renderer->renderBlock($view, 'form_start', $vars); + } + + protected function renderEnd(FormView $view, array $vars = array()) + { + return (string) $this->renderer->renderBlock($view, 'form_end', $vars); + } + + protected function setTheme(FormView $view, array $themes, $useDefaultThemes = true) + { + $this->renderer->setTheme($view, $themes, $useDefaultThemes); + } +} diff --git a/vendor/symfony/twig-bridge/Tests/Extension/FormExtensionDivLayoutTest.php b/vendor/symfony/twig-bridge/Tests/Extension/FormExtensionDivLayoutTest.php index 27a8ee3c..22a1413f 100644 --- a/vendor/symfony/twig-bridge/Tests/Extension/FormExtensionDivLayoutTest.php +++ b/vendor/symfony/twig-bridge/Tests/Extension/FormExtensionDivLayoutTest.php @@ -12,12 +12,12 @@ namespace Symfony\Bridge\Twig\Tests\Extension; use Symfony\Bridge\Twig\Extension\FormExtension; -use Symfony\Bridge\Twig\Form\TwigRenderer; use Symfony\Bridge\Twig\Form\TwigRendererEngine; use Symfony\Bridge\Twig\Extension\TranslationExtension; use Symfony\Bridge\Twig\Tests\Extension\Fixtures\StubTranslator; use Symfony\Bridge\Twig\Tests\Extension\Fixtures\StubFilesystemLoader; use Symfony\Component\Form\ChoiceList\View\ChoiceView; +use Symfony\Component\Form\FormRenderer; use Symfony\Component\Form\FormView; use Symfony\Component\Form\Tests\AbstractDivLayoutTest; use Twig\Environment; @@ -26,6 +26,9 @@ class FormExtensionDivLayoutTest extends AbstractDivLayoutTest { use RuntimeLoaderProvider; + /** + * @var FormRenderer + */ private $renderer; protected function setUp() @@ -48,7 +51,7 @@ class FormExtensionDivLayoutTest extends AbstractDivLayoutTest 'form_div_layout.html.twig', 'custom_widgets.html.twig', ), $environment); - $this->renderer = new TwigRenderer($rendererEngine, $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock()); + $this->renderer = new FormRenderer($rendererEngine, $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock()); $this->registerTwigRuntimeLoader($environment, $this->renderer); } @@ -146,6 +149,22 @@ class FormExtensionDivLayoutTest extends AbstractDivLayoutTest $this->assertSame('<form name="form" method="get" action="0">', $html); } + public function isRootFormProvider() + { + return array( + array(true, new FormView()), + array(false, new FormView(new FormView())), + ); + } + + /** + * @dataProvider isRootFormProvider + */ + public function testIsRootForm($expected, FormView $formView) + { + $this->assertSame($expected, \Symfony\Bridge\Twig\Extension\twig_is_root_form($formView)); + } + protected function renderForm(FormView $view, array $vars = array()) { return (string) $this->renderer->renderBlock($view, 'form', $vars); @@ -190,9 +209,9 @@ class FormExtensionDivLayoutTest extends AbstractDivLayoutTest return (string) $this->renderer->renderBlock($view, 'form_end', $vars); } - protected function setTheme(FormView $view, array $themes) + protected function setTheme(FormView $view, array $themes, $useDefaultThemes = true) { - $this->renderer->setTheme($view, $themes); + $this->renderer->setTheme($view, $themes, $useDefaultThemes); } public static function themeBlockInheritanceProvider() diff --git a/vendor/symfony/twig-bridge/Tests/Extension/FormExtensionTableLayoutTest.php b/vendor/symfony/twig-bridge/Tests/Extension/FormExtensionTableLayoutTest.php index f0509366..5119480d 100644 --- a/vendor/symfony/twig-bridge/Tests/Extension/FormExtensionTableLayoutTest.php +++ b/vendor/symfony/twig-bridge/Tests/Extension/FormExtensionTableLayoutTest.php @@ -11,8 +11,8 @@ namespace Symfony\Bridge\Twig\Tests\Extension; +use Symfony\Component\Form\FormRenderer; use Symfony\Component\Form\FormView; -use Symfony\Bridge\Twig\Form\TwigRenderer; use Symfony\Bridge\Twig\Form\TwigRendererEngine; use Symfony\Bridge\Twig\Extension\FormExtension; use Symfony\Bridge\Twig\Extension\TranslationExtension; @@ -25,6 +25,9 @@ class FormExtensionTableLayoutTest extends AbstractTableLayoutTest { use RuntimeLoaderProvider; + /** + * @var FormRenderer + */ private $renderer; protected function setUp() @@ -45,7 +48,7 @@ class FormExtensionTableLayoutTest extends AbstractTableLayoutTest 'form_table_layout.html.twig', 'custom_widgets.html.twig', ), $environment); - $this->renderer = new TwigRenderer($rendererEngine, $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock()); + $this->renderer = new FormRenderer($rendererEngine, $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock()); $this->registerTwigRuntimeLoader($environment, $this->renderer); } @@ -117,8 +120,8 @@ class FormExtensionTableLayoutTest extends AbstractTableLayoutTest return (string) $this->renderer->renderBlock($view, 'form_end', $vars); } - protected function setTheme(FormView $view, array $themes) + protected function setTheme(FormView $view, array $themes, $useDefaultThemes = true) { - $this->renderer->setTheme($view, $themes); + $this->renderer->setTheme($view, $themes, $useDefaultThemes); } } diff --git a/vendor/symfony/twig-bridge/Tests/Extension/FormExtensionTest.php b/vendor/symfony/twig-bridge/Tests/Extension/FormExtensionTest.php new file mode 100644 index 00000000..a4d73507 --- /dev/null +++ b/vendor/symfony/twig-bridge/Tests/Extension/FormExtensionTest.php @@ -0,0 +1,76 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\Tests\Extension; + +use PHPUnit\Framework\TestCase; +use Symfony\Bridge\Twig\Extension\FormExtension; +use Symfony\Bridge\Twig\Form\TwigRendererInterface; +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\Form\FormRendererInterface; +use Twig\Environment; + +/** + * @group legacy + */ +class FormExtensionTest extends TestCase +{ + /** + * @dataProvider rendererDataProvider + */ + public function testInitRuntimeAndAccessRenderer($rendererConstructor, $expectedAccessedRenderer) + { + $extension = new FormExtension($rendererConstructor); + $extension->initRuntime($this->getMockBuilder(Environment::class)->disableOriginalConstructor()->getMock()); + $this->assertSame($expectedAccessedRenderer, $extension->renderer); + } + + /** + * @dataProvider rendererDataProvider + */ + public function testAccessRendererAndInitRuntime($rendererConstructor, $expectedAccessedRenderer) + { + $extension = new FormExtension($rendererConstructor); + $this->assertSame($expectedAccessedRenderer, $extension->renderer); + $extension->initRuntime($this->getMockBuilder(Environment::class)->disableOriginalConstructor()->getMock()); + } + + public function rendererDataProvider() + { + $twigRenderer = $this->getMockBuilder(TwigRendererInterface::class)->getMock(); + $twigRenderer->expects($this->once()) + ->method('setEnvironment'); + + yield array($twigRenderer, $twigRenderer); + + $twigRenderer = $this->getMockBuilder(TwigRendererInterface::class)->getMock(); + $twigRenderer->expects($this->once()) + ->method('setEnvironment'); + + $container = $this->getMockBuilder(ContainerInterface::class)->getMock(); + $container->expects($this->once()) + ->method('get') + ->with('service_id') + ->willReturn($twigRenderer); + + yield array(array($container, 'service_id'), $twigRenderer); + + $formRenderer = $this->getMockBuilder(FormRendererInterface::class)->getMock(); + + $container = $this->getMockBuilder(ContainerInterface::class)->getMock(); + $container->expects($this->once()) + ->method('get') + ->with('service_id') + ->willReturn($formRenderer); + + yield array(array($container, 'service_id'), $formRenderer); + } +} diff --git a/vendor/symfony/twig-bridge/Tests/Extension/RuntimeLoaderProvider.php b/vendor/symfony/twig-bridge/Tests/Extension/RuntimeLoaderProvider.php index 90db2c5d..4934bef8 100644 --- a/vendor/symfony/twig-bridge/Tests/Extension/RuntimeLoaderProvider.php +++ b/vendor/symfony/twig-bridge/Tests/Extension/RuntimeLoaderProvider.php @@ -11,16 +11,16 @@ namespace Symfony\Bridge\Twig\Tests\Extension; -use Symfony\Bridge\Twig\Form\TwigRenderer; +use Symfony\Component\Form\FormRenderer; use Twig\Environment; trait RuntimeLoaderProvider { - protected function registerTwigRuntimeLoader(Environment $environment, TwigRenderer $renderer) + protected function registerTwigRuntimeLoader(Environment $environment, FormRenderer $renderer) { $loader = $this->getMockBuilder('Twig\RuntimeLoader\RuntimeLoaderInterface')->getMock(); $loader->expects($this->any())->method('load')->will($this->returnValueMap(array( - array('Symfony\Bridge\Twig\Form\TwigRenderer', $renderer), + array('Symfony\Component\Form\FormRenderer', $renderer), ))); $environment->addRuntimeLoader($loader); } diff --git a/vendor/symfony/twig-bridge/Tests/Extension/TranslationExtensionTest.php b/vendor/symfony/twig-bridge/Tests/Extension/TranslationExtensionTest.php index 36016d7f..88a39b1e 100644 --- a/vendor/symfony/twig-bridge/Tests/Extension/TranslationExtensionTest.php +++ b/vendor/symfony/twig-bridge/Tests/Extension/TranslationExtensionTest.php @@ -14,7 +14,6 @@ namespace Symfony\Bridge\Twig\Tests\Extension; use PHPUnit\Framework\TestCase; use Symfony\Bridge\Twig\Extension\TranslationExtension; use Symfony\Component\Translation\Translator; -use Symfony\Component\Translation\MessageSelector; use Symfony\Component\Translation\Loader\ArrayLoader; use Twig\Environment; use Twig\Loader\ArrayLoader as TwigArrayLoader; @@ -37,7 +36,7 @@ class TranslationExtensionTest extends TestCase echo $template."\n"; $loader = new TwigArrayLoader(array('index' => $template)); $twig = new Environment($loader, array('debug' => true, 'cache' => false)); - $twig->addExtension(new TranslationExtension(new Translator('en', new MessageSelector()))); + $twig->addExtension(new TranslationExtension(new Translator('en'))); echo $twig->compile($twig->parse($twig->tokenize($twig->getLoader()->getSourceContext('index'))))."\n\n"; $this->assertEquals($expected, $this->getTemplate($template)->render($variables)); @@ -89,18 +88,35 @@ class TranslationExtensionTest extends TestCase array('{% trans into "fr"%}Hello{% endtrans %}', 'Hello'), // transchoice - array('{% transchoice count from "messages" %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', - 'There is no apples', array('count' => 0)), - array('{% transchoice count %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', - 'There is 5 apples', array('count' => 5)), - array('{% transchoice count %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples (%name%){% endtranschoice %}', - 'There is 5 apples (Symfony)', array('count' => 5, 'name' => 'Symfony')), - array('{% transchoice count with { \'%name%\': \'Symfony\' } %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples (%name%){% endtranschoice %}', - 'There is 5 apples (Symfony)', array('count' => 5)), - array('{% transchoice count into "fr"%}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', - 'There is no apples', array('count' => 0)), - array('{% transchoice 5 into "fr"%}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', - 'There is 5 apples'), + array( + '{% transchoice count from "messages" %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', + 'There is no apples', + array('count' => 0), + ), + array( + '{% transchoice count %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', + 'There is 5 apples', + array('count' => 5), + ), + array( + '{% transchoice count %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples (%name%){% endtranschoice %}', + 'There is 5 apples (Symfony)', + array('count' => 5, 'name' => 'Symfony'), + ), + array( + '{% transchoice count with { \'%name%\': \'Symfony\' } %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples (%name%){% endtranschoice %}', + 'There is 5 apples (Symfony)', + array('count' => 5), + ), + array( + '{% transchoice count into "fr"%}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', + 'There is no apples', + array('count' => 0), + ), + array( + '{% transchoice 5 into "fr"%}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', + 'There is 5 apples', + ), // trans filter array('{{ "Hello"|trans }}', 'Hello'), @@ -139,7 +155,7 @@ class TranslationExtensionTest extends TestCase ', ); - $translator = new Translator('en', new MessageSelector()); + $translator = new Translator('en'); $translator->addLoader('array', new ArrayLoader()); $translator->addResource('array', array('foo' => 'foo (messages)'), 'en'); $translator->addResource('array', array('foo' => 'foo (custom)'), 'en', 'custom'); @@ -172,7 +188,7 @@ class TranslationExtensionTest extends TestCase ', ); - $translator = new Translator('en', new MessageSelector()); + $translator = new Translator('en'); $translator->addLoader('array', new ArrayLoader()); $translator->addResource('array', array('foo' => 'foo (messages)'), 'en'); $translator->addResource('array', array('foo' => 'foo (custom)'), 'en', 'custom'); @@ -187,7 +203,7 @@ class TranslationExtensionTest extends TestCase protected function getTemplate($template, $translator = null) { if (null === $translator) { - $translator = new Translator('en', new MessageSelector()); + $translator = new Translator('en'); } if (is_array($template)) { diff --git a/vendor/symfony/twig-bridge/Tests/Extension/WorkflowExtensionTest.php b/vendor/symfony/twig-bridge/Tests/Extension/WorkflowExtensionTest.php index 60934c1c..2adf12d9 100644 --- a/vendor/symfony/twig-bridge/Tests/Extension/WorkflowExtensionTest.php +++ b/vendor/symfony/twig-bridge/Tests/Extension/WorkflowExtensionTest.php @@ -25,10 +25,6 @@ class WorkflowExtensionTest extends TestCase protected function setUp() { - if (!class_exists(Workflow::class)) { - $this->markTestSkipped('The Workflow component is needed to run tests for this extension.'); - } - $places = array('ordered', 'waiting_for_payment', 'processed'); $transitions = array( new Transition('t1', 'ordered', 'waiting_for_payment'), diff --git a/vendor/symfony/twig-bridge/Tests/Node/FormThemeTest.php b/vendor/symfony/twig-bridge/Tests/Node/FormThemeTest.php index c40fcbdc..1f7f6322 100644 --- a/vendor/symfony/twig-bridge/Tests/Node/FormThemeTest.php +++ b/vendor/symfony/twig-bridge/Tests/Node/FormThemeTest.php @@ -13,6 +13,9 @@ namespace Symfony\Bridge\Twig\Tests\Node; use PHPUnit\Framework\TestCase; use Symfony\Bridge\Twig\Node\FormThemeNode; +use Symfony\Bridge\Twig\Tests\Extension\RuntimeLoaderProvider; +use Symfony\Component\Form\FormRenderer; +use Symfony\Component\Form\FormRendererEngineInterface; use Twig\Compiler; use Twig\Environment; use Twig\Node\Expression\ArrayExpression; @@ -22,6 +25,8 @@ use Twig\Node\Node; class FormThemeTest extends TestCase { + use RuntimeLoaderProvider; + public function testConstructor() { $form = new NameExpression('form', 0); @@ -34,6 +39,7 @@ class FormThemeTest extends TestCase $this->assertEquals($form, $node->getNode('form')); $this->assertEquals($resources, $node->getNode('resources')); + $this->assertFalse($node->getAttribute('only')); } public function testCompile() @@ -48,11 +54,24 @@ class FormThemeTest extends TestCase $node = new FormThemeNode($form, $resources, 0); - $compiler = new Compiler(new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock())); + $environment = new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock()); + $formRenderer = new FormRenderer($this->getMockBuilder(FormRendererEngineInterface::class)->getMock()); + $this->registerTwigRuntimeLoader($environment, $formRenderer); + $compiler = new Compiler($environment); + + $this->assertEquals( + sprintf( + '$this->env->getRuntime("Symfony\\\\Component\\\\Form\\\\FormRenderer")->setTheme(%s, array(0 => "tpl1", 1 => "tpl2"), true);', + $this->getVariableGetter('form') + ), + trim($compiler->compile($node)->getSource()) + ); + + $node = new FormThemeNode($form, $resources, 0, null, true); $this->assertEquals( sprintf( - '$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->setTheme(%s, array(0 => "tpl1", 1 => "tpl2"));', + '$this->env->getRuntime("Symfony\\\\Component\\\\Form\\\\FormRenderer")->setTheme(%s, array(0 => "tpl1", 1 => "tpl2"), false);', $this->getVariableGetter('form') ), trim($compiler->compile($node)->getSource()) @@ -64,7 +83,17 @@ class FormThemeTest extends TestCase $this->assertEquals( sprintf( - '$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->setTheme(%s, "tpl1");', + '$this->env->getRuntime("Symfony\\\\Component\\\\Form\\\\FormRenderer")->setTheme(%s, "tpl1", true);', + $this->getVariableGetter('form') + ), + trim($compiler->compile($node)->getSource()) + ); + + $node = new FormThemeNode($form, $resources, 0, null, true); + + $this->assertEquals( + sprintf( + '$this->env->getRuntime("Symfony\\\\Component\\\\Form\\\\FormRenderer")->setTheme(%s, "tpl1", false);', $this->getVariableGetter('form') ), trim($compiler->compile($node)->getSource()) @@ -74,9 +103,9 @@ class FormThemeTest extends TestCase protected function getVariableGetter($name) { if (\PHP_VERSION_ID >= 70000) { - return sprintf('($context["%s"] ?? null)', $name, $name); + return sprintf('($context["%s"] ?? null)', $name); } - return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name); + return sprintf('(isset($context["%s"]) ? $context["%1$s"] : null)', $name); } } diff --git a/vendor/symfony/twig-bridge/Tests/Node/SearchAndRenderBlockNodeTest.php b/vendor/symfony/twig-bridge/Tests/Node/SearchAndRenderBlockNodeTest.php index fe91422a..4f66406a 100644 --- a/vendor/symfony/twig-bridge/Tests/Node/SearchAndRenderBlockNodeTest.php +++ b/vendor/symfony/twig-bridge/Tests/Node/SearchAndRenderBlockNodeTest.php @@ -35,7 +35,7 @@ class SearchAndRenderBlockNodeTest extends TestCase $this->assertEquals( sprintf( - '$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->searchAndRenderBlock(%s, \'widget\')', + '$this->env->getRuntime(\'Symfony\Component\Form\FormRenderer\')->searchAndRenderBlock(%s, \'widget\')', $this->getVariableGetter('form') ), trim($compiler->compile($node)->getSource()) @@ -58,7 +58,7 @@ class SearchAndRenderBlockNodeTest extends TestCase $this->assertEquals( sprintf( - '$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->searchAndRenderBlock(%s, \'widget\', array("foo" => "bar"))', + '$this->env->getRuntime(\'Symfony\Component\Form\FormRenderer\')->searchAndRenderBlock(%s, \'widget\', array("foo" => "bar"))', $this->getVariableGetter('form') ), trim($compiler->compile($node)->getSource()) @@ -78,7 +78,7 @@ class SearchAndRenderBlockNodeTest extends TestCase $this->assertEquals( sprintf( - '$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->searchAndRenderBlock(%s, \'label\', array("label" => "my label"))', + '$this->env->getRuntime(\'Symfony\Component\Form\FormRenderer\')->searchAndRenderBlock(%s, \'label\', array("label" => "my label"))', $this->getVariableGetter('form') ), trim($compiler->compile($node)->getSource()) @@ -100,7 +100,7 @@ class SearchAndRenderBlockNodeTest extends TestCase // Otherwise the default label is overwritten with null. $this->assertEquals( sprintf( - '$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->searchAndRenderBlock(%s, \'label\')', + '$this->env->getRuntime(\'Symfony\Component\Form\FormRenderer\')->searchAndRenderBlock(%s, \'label\')', $this->getVariableGetter('form') ), trim($compiler->compile($node)->getSource()) @@ -122,7 +122,7 @@ class SearchAndRenderBlockNodeTest extends TestCase // Otherwise the default label is overwritten with null. $this->assertEquals( sprintf( - '$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->searchAndRenderBlock(%s, \'label\')', + '$this->env->getRuntime(\'Symfony\Component\Form\FormRenderer\')->searchAndRenderBlock(%s, \'label\')', $this->getVariableGetter('form') ), trim($compiler->compile($node)->getSource()) @@ -141,7 +141,7 @@ class SearchAndRenderBlockNodeTest extends TestCase $this->assertEquals( sprintf( - '$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->searchAndRenderBlock(%s, \'label\')', + '$this->env->getRuntime(\'Symfony\Component\Form\FormRenderer\')->searchAndRenderBlock(%s, \'label\')', $this->getVariableGetter('form') ), trim($compiler->compile($node)->getSource()) @@ -168,7 +168,7 @@ class SearchAndRenderBlockNodeTest extends TestCase // https://github.com/symfony/symfony/issues/5029 $this->assertEquals( sprintf( - '$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->searchAndRenderBlock(%s, \'label\', array("foo" => "bar"))', + '$this->env->getRuntime(\'Symfony\Component\Form\FormRenderer\')->searchAndRenderBlock(%s, \'label\', array("foo" => "bar"))', $this->getVariableGetter('form') ), trim($compiler->compile($node)->getSource()) @@ -194,7 +194,7 @@ class SearchAndRenderBlockNodeTest extends TestCase $this->assertEquals( sprintf( - '$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->searchAndRenderBlock(%s, \'label\', array("foo" => "bar", "label" => "value in argument"))', + '$this->env->getRuntime(\'Symfony\Component\Form\FormRenderer\')->searchAndRenderBlock(%s, \'label\', array("foo" => "bar", "label" => "value in argument"))', $this->getVariableGetter('form') ), trim($compiler->compile($node)->getSource()) @@ -225,7 +225,7 @@ class SearchAndRenderBlockNodeTest extends TestCase // https://github.com/symfony/symfony/issues/5029 $this->assertEquals( sprintf( - '$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->searchAndRenderBlock(%s, \'label\', (twig_test_empty($_label_ = ((true) ? (null) : (null))) ? array() : array("label" => $_label_)))', + '$this->env->getRuntime(\'Symfony\Component\Form\FormRenderer\')->searchAndRenderBlock(%s, \'label\', (twig_test_empty($_label_ = ((true) ? (null) : (null))) ? array() : array("label" => $_label_)))', $this->getVariableGetter('form') ), trim($compiler->compile($node)->getSource()) @@ -262,7 +262,7 @@ class SearchAndRenderBlockNodeTest extends TestCase // https://github.com/symfony/symfony/issues/5029 $this->assertEquals( sprintf( - '$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->searchAndRenderBlock(%s, \'label\', array("foo" => "bar", "label" => "value in attributes") + (twig_test_empty($_label_ = ((true) ? (null) : (null))) ? array() : array("label" => $_label_)))', + '$this->env->getRuntime(\'Symfony\Component\Form\FormRenderer\')->searchAndRenderBlock(%s, \'label\', array("foo" => "bar", "label" => "value in attributes") + (twig_test_empty($_label_ = ((true) ? (null) : (null))) ? array() : array("label" => $_label_)))', $this->getVariableGetter('form') ), trim($compiler->compile($node)->getSource()) @@ -272,9 +272,9 @@ class SearchAndRenderBlockNodeTest extends TestCase protected function getVariableGetter($name) { if (\PHP_VERSION_ID >= 70000) { - return sprintf('($context["%s"] ?? null)', $name, $name); + return sprintf('($context["%s"] ?? null)', $name); } - return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name); + return sprintf('(isset($context["%s"]) ? $context["%1$s"] : null)', $name); } } diff --git a/vendor/symfony/twig-bridge/Tests/Node/TransNodeTest.php b/vendor/symfony/twig-bridge/Tests/Node/TransNodeTest.php index 56b2770d..4c873862 100644 --- a/vendor/symfony/twig-bridge/Tests/Node/TransNodeTest.php +++ b/vendor/symfony/twig-bridge/Tests/Node/TransNodeTest.php @@ -45,22 +45,22 @@ class TransNodeTest extends TestCase protected function getVariableGetterWithoutStrictCheck($name) { if (\PHP_VERSION_ID >= 70000) { - return sprintf('($context["%s"] ?? null)', $name, $name); + return sprintf('($context["%s"] ?? null)', $name); } - return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name); + return sprintf('(isset($context["%s"]) ? $context["%1$s"] : null)', $name); } protected function getVariableGetterWithStrictCheck($name) { if (Environment::MAJOR_VERSION >= 2) { - return sprintf('(isset($context["%s"]) || array_key_exists("%s", $context) ? $context["%s"] : (function () { throw new Twig_Error_Runtime(\'Variable "%s" does not exist.\', 0, $this->getSourceContext()); })())', $name, $name, $name, $name); + return sprintf('(isset($context["%s"]) || array_key_exists("%1$s", $context) ? $context["%1$s"] : (function () { throw new Twig_Error_Runtime(\'Variable "%1$s" does not exist.\', 0, $this->getSourceContext()); })())', $name); } if (\PHP_VERSION_ID >= 70000) { - return sprintf('($context["%s"] ?? $this->getContext($context, "%s"))', $name, $name, $name); + return sprintf('($context["%s"] ?? $this->getContext($context, "%1$s"))', $name); } - return sprintf('(isset($context["%s"]) ? $context["%s"] : $this->getContext($context, "%s"))', $name, $name, $name); + return sprintf('(isset($context["%s"]) ? $context["%1$s"] : $this->getContext($context, "%1$s"))', $name); } } diff --git a/vendor/symfony/twig-bridge/Tests/TokenParser/FormThemeTokenParserTest.php b/vendor/symfony/twig-bridge/Tests/TokenParser/FormThemeTokenParserTest.php index 0972b15e..cd9a34ca 100644 --- a/vendor/symfony/twig-bridge/Tests/TokenParser/FormThemeTokenParserTest.php +++ b/vendor/symfony/twig-bridge/Tests/TokenParser/FormThemeTokenParserTest.php @@ -100,6 +100,21 @@ class FormThemeTokenParserTest extends TestCase 'form_theme' ), ), + array( + '{% form_theme form with ["tpl1", "tpl2"] only %}', + new FormThemeNode( + new NameExpression('form', 1), + new ArrayExpression(array( + new ConstantExpression(0, 1), + new ConstantExpression('tpl1', 1), + new ConstantExpression(1, 1), + new ConstantExpression('tpl2', 1), + ), 1), + 1, + 'form_theme', + true + ), + ), ); } } diff --git a/vendor/symfony/twig-bridge/TokenParser/FormThemeTokenParser.php b/vendor/symfony/twig-bridge/TokenParser/FormThemeTokenParser.php index 12c25418..2388cc56 100644 --- a/vendor/symfony/twig-bridge/TokenParser/FormThemeTokenParser.php +++ b/vendor/symfony/twig-bridge/TokenParser/FormThemeTokenParser.php @@ -27,8 +27,6 @@ class FormThemeTokenParser extends AbstractTokenParser /** * Parses a token and returns a node. * - * @param Token $token - * * @return Node */ public function parse(Token $token) @@ -37,10 +35,15 @@ class FormThemeTokenParser extends AbstractTokenParser $stream = $this->parser->getStream(); $form = $this->parser->getExpressionParser()->parseExpression(); + $only = false; if ($this->parser->getStream()->test(Token::NAME_TYPE, 'with')) { $this->parser->getStream()->next(); $resources = $this->parser->getExpressionParser()->parseExpression(); + + if ($this->parser->getStream()->nextIf(Token::NAME_TYPE, 'only')) { + $only = true; + } } else { $resources = new ArrayExpression(array(), $stream->getCurrent()->getLine()); do { @@ -50,7 +53,7 @@ class FormThemeTokenParser extends AbstractTokenParser $stream->expect(Token::BLOCK_END_TYPE); - return new FormThemeNode($form, $resources, $lineno, $this->getTag()); + return new FormThemeNode($form, $resources, $lineno, $this->getTag(), $only); } /** diff --git a/vendor/symfony/twig-bridge/TokenParser/TransChoiceTokenParser.php b/vendor/symfony/twig-bridge/TokenParser/TransChoiceTokenParser.php index 2b4a9f3f..5261d7ad 100644 --- a/vendor/symfony/twig-bridge/TokenParser/TransChoiceTokenParser.php +++ b/vendor/symfony/twig-bridge/TokenParser/TransChoiceTokenParser.php @@ -29,8 +29,6 @@ class TransChoiceTokenParser extends TransTokenParser /** * Parses a token and returns a node. * - * @param Token $token - * * @return Node * * @throws SyntaxError diff --git a/vendor/symfony/twig-bridge/TokenParser/TransDefaultDomainTokenParser.php b/vendor/symfony/twig-bridge/TokenParser/TransDefaultDomainTokenParser.php index 4096a011..ee546e05 100644 --- a/vendor/symfony/twig-bridge/TokenParser/TransDefaultDomainTokenParser.php +++ b/vendor/symfony/twig-bridge/TokenParser/TransDefaultDomainTokenParser.php @@ -26,8 +26,6 @@ class TransDefaultDomainTokenParser extends AbstractTokenParser /** * Parses a token and returns a node. * - * @param Token $token - * * @return Node */ public function parse(Token $token) diff --git a/vendor/symfony/twig-bridge/TokenParser/TransTokenParser.php b/vendor/symfony/twig-bridge/TokenParser/TransTokenParser.php index 848a0807..76c8dc06 100644 --- a/vendor/symfony/twig-bridge/TokenParser/TransTokenParser.php +++ b/vendor/symfony/twig-bridge/TokenParser/TransTokenParser.php @@ -30,8 +30,6 @@ class TransTokenParser extends AbstractTokenParser /** * Parses a token and returns a node. * - * @param Token $token - * * @return Node * * @throws SyntaxError diff --git a/vendor/symfony/twig-bridge/Translation/TwigExtractor.php b/vendor/symfony/twig-bridge/Translation/TwigExtractor.php index bd35fe5a..db388ab7 100644 --- a/vendor/symfony/twig-bridge/Translation/TwigExtractor.php +++ b/vendor/symfony/twig-bridge/Translation/TwigExtractor.php @@ -42,11 +42,6 @@ class TwigExtractor extends AbstractFileExtractor implements ExtractorInterface */ private $prefix = ''; - /** - * The twig environment. - * - * @var Environment - */ private $twig; public function __construct(Environment $twig) diff --git a/vendor/symfony/twig-bridge/UndefinedCallableHandler.php b/vendor/symfony/twig-bridge/UndefinedCallableHandler.php new file mode 100644 index 00000000..77c78ce3 --- /dev/null +++ b/vendor/symfony/twig-bridge/UndefinedCallableHandler.php @@ -0,0 +1,76 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig; + +use Twig\Error\SyntaxError; + +/** + * @internal + */ +class UndefinedCallableHandler +{ + private static $filterComponents = array( + 'humanize' => 'form', + 'trans' => 'translation', + 'transchoice' => 'translation', + 'yaml_encode' => 'yaml', + 'yaml_dump' => 'yaml', + ); + + private static $functionComponents = array( + 'asset' => 'asset', + 'asset_version' => 'asset', + 'dump' => 'debug-bundle', + 'expression' => 'expression-language', + 'form_widget' => 'form', + 'form_errors' => 'form', + 'form_label' => 'form', + 'form_row' => 'form', + 'form_rest' => 'form', + 'form' => 'form', + 'form_start' => 'form', + 'form_end' => 'form', + 'csrf_token' => 'form', + 'logout_url' => 'security-http', + 'logout_path' => 'security-http', + 'is_granted' => 'security-core', + 'link' => 'web-link', + 'preload' => 'web-link', + 'dns_prefetch' => 'web-link', + 'preconnect' => 'web-link', + 'prefetch' => 'web-link', + 'prerender' => 'web-link', + 'workflow_can' => 'workflow', + 'workflow_transitions' => 'workflow', + 'workflow_has_marked_place' => 'workflow', + 'workflow_marked_places' => 'workflow', + ); + + public static function onUndefinedFilter($name) + { + if (!isset(self::$filterComponents[$name])) { + return false; + } + + // Twig will append the source context to the message, so that it will end up being like "[...] Unknown filter "%s" in foo.html.twig on line 123." + throw new SyntaxError(sprintf('Did you forget to run "composer require symfony/%s"? Unknown filter "%s".', self::$filterComponents[$name], $name)); + } + + public static function onUndefinedFunction($name) + { + if (!isset(self::$functionComponents[$name])) { + return false; + } + + throw new SyntaxError(sprintf('Did you forget to run "composer require symfony/%s"? Unknown function "%s".', self::$functionComponents[$name], $name)); + } +} diff --git a/vendor/symfony/twig-bridge/composer.json b/vendor/symfony/twig-bridge/composer.json index e00e3dc7..aea0d10a 100644 --- a/vendor/symfony/twig-bridge/composer.json +++ b/vendor/symfony/twig-bridge/composer.json @@ -17,29 +17,32 @@ ], "require": { "php": "^5.5.9|>=7.0.8", - "twig/twig": "~1.34|~2.4" + "twig/twig": "^1.35|^2.4.4" }, "require-dev": { - "fig/link-util": "^1.0", - "symfony/asset": "~2.8|~3.0", - "symfony/finder": "~2.8|~3.0", - "symfony/form": "^3.2.10|^3.3.3", - "symfony/http-kernel": "~3.2", + "symfony/asset": "~2.8|~3.0|~4.0", + "symfony/dependency-injection": "~2.8|~3.0|~4.0", + "symfony/finder": "~2.8|~3.0|~4.0", + "symfony/form": "~3.4|~4.0", + "symfony/http-foundation": "^3.3.11|~4.0", + "symfony/http-kernel": "~3.2|~4.0", "symfony/polyfill-intl-icu": "~1.0", - "symfony/routing": "~2.8|~3.0", - "symfony/templating": "~2.8|~3.0", - "symfony/translation": "~2.8|~3.0", - "symfony/yaml": "~2.8|~3.0", - "symfony/security": "~2.8|~3.0", + "symfony/routing": "~2.8|~3.0|~4.0", + "symfony/templating": "~2.8|~3.0|~4.0", + "symfony/translation": "~2.8|~3.0|~4.0", + "symfony/yaml": "~2.8|~3.0|~4.0", + "symfony/security": "~2.8|~3.0|~4.0", "symfony/security-acl": "~2.8|~3.0", - "symfony/stopwatch": "~2.8|~3.0", - "symfony/console": "~2.8|~3.0", - "symfony/var-dumper": "~2.8.10|~3.1.4|~3.2", - "symfony/expression-language": "~2.8|~3.0", - "symfony/web-link": "~3.3" + "symfony/stopwatch": "~2.8|~3.0|~4.0", + "symfony/console": "~3.4|~4.0", + "symfony/var-dumper": "~2.8.10|~3.1.4|~3.2|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/web-link": "~3.3|~4.0", + "symfony/workflow": "~3.3|~4.0" }, "conflict": { - "symfony/form": "<3.2.10|~3.3,<3.3.3" + "symfony/form": "<3.4", + "symfony/console": "<3.4" }, "suggest": { "symfony/finder": "", @@ -65,7 +68,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } } } -- GitLab