requires HHVM 3.9+');
+ }
+
+ // The typechecker recurses the whole tree, so it makes sure
+ // that everything in fixtures/ is valid when this runs.
+
+ $output = array();
+ $exit_code = null;
+ exec(
+ 'hh_server --check '.escapeshellarg(__DIR__.'/../../').' 2>&1',
+ $output,
+ $exit_code
+ );
+ if ($exit_code === self::SERVER_ALREADY_RUNNING_CODE) {
+ $this->assertTrue(
+ $recurse,
+ "Typechecker still running after running hh_client stop"
+ );
+ // Server already running - 3.10 => 3.11 regression:
+ // https://github.com/facebook/hhvm/issues/6646
+ exec('hh_client stop 2>/dev/null');
+ $this->testTypechecks(/* recurse = */ false);
+ return;
+
+ }
+ $this->assertSame(0, $exit_code, implode("\n", $output));
+ }
+}
diff --git a/samples/server/petstore-security-test/slim/vendor/nikic/fast-route/test/HackTypechecker/fixtures/all_options.php b/samples/server/petstore-security-test/slim/vendor/nikic/fast-route/test/HackTypechecker/fixtures/all_options.php
new file mode 100644
index 0000000000..05a9af231b
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/nikic/fast-route/test/HackTypechecker/fixtures/all_options.php
@@ -0,0 +1,29 @@
+ {},
+ shape(
+ 'routeParser' => \FastRoute\RouteParser\Std::class,
+ 'dataGenerator' => \FastRoute\DataGenerator\GroupCountBased::class,
+ 'dispatcher' => \FastRoute\Dispatcher\GroupCountBased::class,
+ 'routeCollector' => \FastRoute\RouteCollector::class,
+ ),
+ );
+}
+
+function all_options_cached(): \FastRoute\Dispatcher {
+ return \FastRoute\cachedDispatcher(
+ $collector ==> {},
+ shape(
+ 'routeParser' => \FastRoute\RouteParser\Std::class,
+ 'dataGenerator' => \FastRoute\DataGenerator\GroupCountBased::class,
+ 'dispatcher' => \FastRoute\Dispatcher\GroupCountBased::class,
+ 'routeCollector' => \FastRoute\RouteCollector::class,
+ 'cacheFile' => '/dev/null',
+ 'cacheDisabled' => false,
+ ),
+ );
+}
diff --git a/samples/server/petstore-security-test/slim/vendor/nikic/fast-route/test/HackTypechecker/fixtures/empty_options.php b/samples/server/petstore-security-test/slim/vendor/nikic/fast-route/test/HackTypechecker/fixtures/empty_options.php
new file mode 100644
index 0000000000..61eb54190d
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/nikic/fast-route/test/HackTypechecker/fixtures/empty_options.php
@@ -0,0 +1,11 @@
+ {}, shape());
+}
+
+function empty_options_cached(): \FastRoute\Dispatcher {
+ return \FastRoute\cachedDispatcher($collector ==> {}, shape());
+}
diff --git a/samples/server/petstore-security-test/slim/vendor/nikic/fast-route/test/HackTypechecker/fixtures/no_options.php b/samples/server/petstore-security-test/slim/vendor/nikic/fast-route/test/HackTypechecker/fixtures/no_options.php
new file mode 100644
index 0000000000..44b5422f58
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/nikic/fast-route/test/HackTypechecker/fixtures/no_options.php
@@ -0,0 +1,11 @@
+ {});
+}
+
+function no_options_cached(): \FastRoute\Dispatcher {
+ return \FastRoute\cachedDispatcher($collector ==> {});
+}
diff --git a/samples/server/petstore-security-test/slim/vendor/nikic/fast-route/test/RouteParser/StdTest.php b/samples/server/petstore-security-test/slim/vendor/nikic/fast-route/test/RouteParser/StdTest.php
new file mode 100644
index 0000000000..41f194ba8b
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/nikic/fast-route/test/RouteParser/StdTest.php
@@ -0,0 +1,147 @@
+parse($routeString);
+ $this->assertSame($expectedRouteDatas, $routeDatas);
+ }
+
+ /** @dataProvider provideTestParseError */
+ public function testParseError($routeString, $expectedExceptionMessage) {
+ $parser = new Std();
+ $this->setExpectedException('FastRoute\\BadRouteException', $expectedExceptionMessage);
+ $parser->parse($routeString);
+ }
+
+ public function provideTestParse() {
+ return [
+ [
+ '/test',
+ [
+ ['/test'],
+ ]
+ ],
+ [
+ '/test/{param}',
+ [
+ ['/test/', ['param', '[^/]+']],
+ ]
+ ],
+ [
+ '/te{ param }st',
+ [
+ ['/te', ['param', '[^/]+'], 'st']
+ ]
+ ],
+ [
+ '/test/{param1}/test2/{param2}',
+ [
+ ['/test/', ['param1', '[^/]+'], '/test2/', ['param2', '[^/]+']]
+ ]
+ ],
+ [
+ '/test/{param:\d+}',
+ [
+ ['/test/', ['param', '\d+']]
+ ]
+ ],
+ [
+ '/test/{ param : \d{1,9} }',
+ [
+ ['/test/', ['param', '\d{1,9}']]
+ ]
+ ],
+ [
+ '/test[opt]',
+ [
+ ['/test'],
+ ['/testopt'],
+ ]
+ ],
+ [
+ '/test[/{param}]',
+ [
+ ['/test'],
+ ['/test/', ['param', '[^/]+']],
+ ]
+ ],
+ [
+ '/{param}[opt]',
+ [
+ ['/', ['param', '[^/]+']],
+ ['/', ['param', '[^/]+'], 'opt']
+ ]
+ ],
+ [
+ '/test[/{name}[/{id:[0-9]+}]]',
+ [
+ ['/test'],
+ ['/test/', ['name', '[^/]+']],
+ ['/test/', ['name', '[^/]+'], '/', ['id', '[0-9]+']],
+ ]
+ ],
+ [
+ '',
+ [
+ [''],
+ ]
+ ],
+ [
+ '[test]',
+ [
+ [''],
+ ['test'],
+ ]
+ ],
+ [
+ '/{foo-bar}',
+ [
+ ['/', ['foo-bar', '[^/]+']]
+ ]
+ ],
+ [
+ '/{_foo:.*}',
+ [
+ ['/', ['_foo', '.*']]
+ ]
+ ],
+ ];
+ }
+
+ public function provideTestParseError() {
+ return [
+ [
+ '/test[opt',
+ "Number of opening '[' and closing ']' does not match"
+ ],
+ [
+ '/test[opt[opt2]',
+ "Number of opening '[' and closing ']' does not match"
+ ],
+ [
+ '/testopt]',
+ "Number of opening '[' and closing ']' does not match"
+ ],
+ [
+ '/test[]',
+ "Empty optional part"
+ ],
+ [
+ '/test[[opt]]',
+ "Empty optional part"
+ ],
+ [
+ '[[test]]',
+ "Empty optional part"
+ ],
+ [
+ '/test[/opt]/required',
+ "Optional segments can only occur at the end of a route"
+ ],
+ ];
+ }
+}
diff --git a/samples/server/petstore-security-test/slim/vendor/nikic/fast-route/test/bootstrap.php b/samples/server/petstore-security-test/slim/vendor/nikic/fast-route/test/bootstrap.php
new file mode 100644
index 0000000000..27e6d4c8fb
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/nikic/fast-route/test/bootstrap.php
@@ -0,0 +1,11 @@
+> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`; fi
+
+script:
+ - cd ext/pimple
+ - if [ "$PIMPLE_EXT" == "yes" ]; then yes n | make test | tee output ; grep -E 'Tests failed +. +0' output; fi
+ - cd ../..
+ - phpunit
+
+matrix:
+ exclude:
+ - php: hhvm
+ env: PIMPLE_EXT=yes
diff --git a/samples/server/petstore-security-test/slim/vendor/pimple/pimple/CHANGELOG b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/CHANGELOG
new file mode 100644
index 0000000000..cc679972ec
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/CHANGELOG
@@ -0,0 +1,35 @@
+* 3.0.2 (2015-09-11)
+
+ * refactored the C extension
+ * minor non-significant changes
+
+* 3.0.1 (2015-07-30)
+
+ * simplified some code
+ * fixed a segfault in the C extension
+
+* 3.0.0 (2014-07-24)
+
+ * removed the Pimple class alias (use Pimple\Container instead)
+
+* 2.1.1 (2014-07-24)
+
+ * fixed compiler warnings for the C extension
+ * fixed code when dealing with circular references
+
+* 2.1.0 (2014-06-24)
+
+ * moved the Pimple to Pimple\Container (with a BC layer -- Pimple is now a
+ deprecated alias which will be removed in Pimple 3.0)
+ * added Pimple\ServiceProviderInterface (and Pimple::register())
+
+* 2.0.0 (2014-02-10)
+
+ * changed extend to automatically re-assign the extended service and keep it as shared or factory
+ (to keep BC, extend still returns the extended service)
+ * changed services to be shared by default (use factory() for factory
+ services)
+
+* 1.0.0
+
+ * initial version
diff --git a/samples/server/petstore-security-test/slim/vendor/pimple/pimple/LICENSE b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/LICENSE
new file mode 100644
index 0000000000..d7949e2fb3
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2009-2015 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/samples/server/petstore-security-test/slim/vendor/pimple/pimple/README.rst b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/README.rst
new file mode 100644
index 0000000000..93fb35a89b
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/README.rst
@@ -0,0 +1,201 @@
+Pimple
+======
+
+.. caution::
+
+ This is the documentation for Pimple 3.x. If you are using Pimple 1.x, read
+ the `Pimple 1.x documentation`_. Reading the Pimple 1.x code is also a good
+ way to learn more about how to create a simple Dependency Injection
+ Container (recent versions of Pimple are more focused on performance).
+
+Pimple is a small Dependency Injection Container for PHP.
+
+Installation
+------------
+
+Before using Pimple in your project, add it to your ``composer.json`` file:
+
+.. code-block:: bash
+
+ $ ./composer.phar require pimple/pimple ~3.0
+
+Alternatively, Pimple is also available as a PHP C extension:
+
+.. code-block:: bash
+
+ $ git clone https://github.com/silexphp/Pimple
+ $ cd Pimple/ext/pimple
+ $ phpize
+ $ ./configure
+ $ make
+ $ make install
+
+Usage
+-----
+
+Creating a container is a matter of creating a ``Container`` instance:
+
+.. code-block:: php
+
+ use Pimple\Container;
+
+ $container = new Container();
+
+As many other dependency injection containers, Pimple manages two different
+kind of data: **services** and **parameters**.
+
+Defining Services
+~~~~~~~~~~~~~~~~~
+
+A service is an object that does something as part of a larger system. Examples
+of services: a database connection, a templating engine, or a mailer. Almost
+any **global** object can be a service.
+
+Services are defined by **anonymous functions** that return an instance of an
+object:
+
+.. code-block:: php
+
+ // define some services
+ $container['session_storage'] = function ($c) {
+ return new SessionStorage('SESSION_ID');
+ };
+
+ $container['session'] = function ($c) {
+ return new Session($c['session_storage']);
+ };
+
+Notice that the anonymous function has access to the current container
+instance, allowing references to other services or parameters.
+
+As objects are only created when you get them, the order of the definitions
+does not matter.
+
+Using the defined services is also very easy:
+
+.. code-block:: php
+
+ // get the session object
+ $session = $container['session'];
+
+ // the above call is roughly equivalent to the following code:
+ // $storage = new SessionStorage('SESSION_ID');
+ // $session = new Session($storage);
+
+Defining Factory Services
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+By default, each time you get a service, Pimple returns the **same instance**
+of it. If you want a different instance to be returned for all calls, wrap your
+anonymous function with the ``factory()`` method
+
+.. code-block:: php
+
+ $container['session'] = $container->factory(function ($c) {
+ return new Session($c['session_storage']);
+ });
+
+Now, each call to ``$container['session']`` returns a new instance of the
+session.
+
+Defining Parameters
+~~~~~~~~~~~~~~~~~~~
+
+Defining a parameter allows to ease the configuration of your container from
+the outside and to store global values:
+
+.. code-block:: php
+
+ // define some parameters
+ $container['cookie_name'] = 'SESSION_ID';
+ $container['session_storage_class'] = 'SessionStorage';
+
+If you change the ``session_storage`` service definition like below:
+
+.. code-block:: php
+
+ $container['session_storage'] = function ($c) {
+ return new $c['session_storage_class']($c['cookie_name']);
+ };
+
+You can now easily change the cookie name by overriding the
+``session_storage_class`` parameter instead of redefining the service
+definition.
+
+Protecting Parameters
+~~~~~~~~~~~~~~~~~~~~~
+
+Because Pimple sees anonymous functions as service definitions, you need to
+wrap anonymous functions with the ``protect()`` method to store them as
+parameters:
+
+.. code-block:: php
+
+ $container['random_func'] = $container->protect(function () {
+ return rand();
+ });
+
+Modifying Services after Definition
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+In some cases you may want to modify a service definition after it has been
+defined. You can use the ``extend()`` method to define additional code to be
+run on your service just after it is created:
+
+.. code-block:: php
+
+ $container['session_storage'] = function ($c) {
+ return new $c['session_storage_class']($c['cookie_name']);
+ };
+
+ $container->extend('session_storage', function ($storage, $c) {
+ $storage->...();
+
+ return $storage;
+ });
+
+The first argument is the name of the service to extend, the second a function
+that gets access to the object instance and the container.
+
+Extending a Container
+~~~~~~~~~~~~~~~~~~~~~
+
+If you use the same libraries over and over, you might want to reuse some
+services from one project to the next one; package your services into a
+**provider** by implementing ``Pimple\ServiceProviderInterface``:
+
+.. code-block:: php
+
+ use Pimple\Container;
+
+ class FooProvider implements Pimple\ServiceProviderInterface
+ {
+ public function register(Container $pimple)
+ {
+ // register some services and parameters
+ // on $pimple
+ }
+ }
+
+Then, register the provider on a Container:
+
+.. code-block:: php
+
+ $pimple->register(new FooProvider());
+
+Fetching the Service Creation Function
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+When you access an object, Pimple automatically calls the anonymous function
+that you defined, which creates the service object for you. If you want to get
+raw access to this function, you can use the ``raw()`` method:
+
+.. code-block:: php
+
+ $container['session'] = function ($c) {
+ return new Session($c['session_storage']);
+ };
+
+ $sessionFunction = $container->raw('session');
+
+.. _Pimple 1.x documentation: https://github.com/silexphp/Pimple/tree/1.1
diff --git a/samples/server/petstore-security-test/slim/vendor/pimple/pimple/composer.json b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/composer.json
new file mode 100644
index 0000000000..a5268f1611
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/composer.json
@@ -0,0 +1,25 @@
+{
+ "name": "pimple/pimple",
+ "type": "library",
+ "description": "Pimple, a simple Dependency Injection Container",
+ "keywords": ["dependency injection", "container"],
+ "homepage": "http://pimple.sensiolabs.org",
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ }
+ ],
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "autoload": {
+ "psr-0": { "Pimple": "src/" }
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.0.x-dev"
+ }
+ }
+}
diff --git a/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/.gitignore b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/.gitignore
new file mode 100644
index 0000000000..1861088ac1
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/.gitignore
@@ -0,0 +1,30 @@
+*.sw*
+.deps
+Makefile
+Makefile.fragments
+Makefile.global
+Makefile.objects
+acinclude.m4
+aclocal.m4
+build/
+config.cache
+config.guess
+config.h
+config.h.in
+config.log
+config.nice
+config.status
+config.sub
+configure
+configure.in
+install-sh
+libtool
+ltmain.sh
+missing
+mkinstalldirs
+run-tests.php
+*.loT
+.libs/
+modules/
+*.la
+*.lo
diff --git a/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/README.md b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/README.md
new file mode 100644
index 0000000000..7b39eb2929
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/README.md
@@ -0,0 +1,12 @@
+This is Pimple 2 implemented in C
+
+* PHP >= 5.3
+* Not tested under Windows, might work
+
+Install
+=======
+
+ > phpize
+ > ./configure
+ > make
+ > make install
diff --git a/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/config.m4 b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/config.m4
new file mode 100644
index 0000000000..c9ba17ddbd
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/config.m4
@@ -0,0 +1,63 @@
+dnl $Id$
+dnl config.m4 for extension pimple
+
+dnl Comments in this file start with the string 'dnl'.
+dnl Remove where necessary. This file will not work
+dnl without editing.
+
+dnl If your extension references something external, use with:
+
+dnl PHP_ARG_WITH(pimple, for pimple support,
+dnl Make sure that the comment is aligned:
+dnl [ --with-pimple Include pimple support])
+
+dnl Otherwise use enable:
+
+PHP_ARG_ENABLE(pimple, whether to enable pimple support,
+dnl Make sure that the comment is aligned:
+[ --enable-pimple Enable pimple support])
+
+if test "$PHP_PIMPLE" != "no"; then
+ dnl Write more examples of tests here...
+
+ dnl # --with-pimple -> check with-path
+ dnl SEARCH_PATH="/usr/local /usr" # you might want to change this
+ dnl SEARCH_FOR="/include/pimple.h" # you most likely want to change this
+ dnl if test -r $PHP_PIMPLE/$SEARCH_FOR; then # path given as parameter
+ dnl PIMPLE_DIR=$PHP_PIMPLE
+ dnl else # search default path list
+ dnl AC_MSG_CHECKING([for pimple files in default path])
+ dnl for i in $SEARCH_PATH ; do
+ dnl if test -r $i/$SEARCH_FOR; then
+ dnl PIMPLE_DIR=$i
+ dnl AC_MSG_RESULT(found in $i)
+ dnl fi
+ dnl done
+ dnl fi
+ dnl
+ dnl if test -z "$PIMPLE_DIR"; then
+ dnl AC_MSG_RESULT([not found])
+ dnl AC_MSG_ERROR([Please reinstall the pimple distribution])
+ dnl fi
+
+ dnl # --with-pimple -> add include path
+ dnl PHP_ADD_INCLUDE($PIMPLE_DIR/include)
+
+ dnl # --with-pimple -> check for lib and symbol presence
+ dnl LIBNAME=pimple # you may want to change this
+ dnl LIBSYMBOL=pimple # you most likely want to change this
+
+ dnl PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL,
+ dnl [
+ dnl PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $PIMPLE_DIR/lib, PIMPLE_SHARED_LIBADD)
+ dnl AC_DEFINE(HAVE_PIMPLELIB,1,[ ])
+ dnl ],[
+ dnl AC_MSG_ERROR([wrong pimple lib version or lib not found])
+ dnl ],[
+ dnl -L$PIMPLE_DIR/lib -lm
+ dnl ])
+ dnl
+ dnl PHP_SUBST(PIMPLE_SHARED_LIBADD)
+
+ PHP_NEW_EXTENSION(pimple, pimple.c, $ext_shared)
+fi
diff --git a/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/config.w32 b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/config.w32
new file mode 100644
index 0000000000..39857b3254
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/config.w32
@@ -0,0 +1,13 @@
+// $Id$
+// vim:ft=javascript
+
+// If your extension references something external, use ARG_WITH
+// ARG_WITH("pimple", "for pimple support", "no");
+
+// Otherwise, use ARG_ENABLE
+// ARG_ENABLE("pimple", "enable pimple support", "no");
+
+if (PHP_PIMPLE != "no") {
+ EXTENSION("pimple", "pimple.c");
+}
+
diff --git a/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/php_pimple.h b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/php_pimple.h
new file mode 100644
index 0000000000..49431f08a8
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/php_pimple.h
@@ -0,0 +1,121 @@
+
+/*
+ * This file is part of Pimple.
+ *
+ * Copyright (c) 2014 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.
+ */
+
+#ifndef PHP_PIMPLE_H
+#define PHP_PIMPLE_H
+
+extern zend_module_entry pimple_module_entry;
+#define phpext_pimple_ptr &pimple_module_entry
+
+#ifdef PHP_WIN32
+# define PHP_PIMPLE_API __declspec(dllexport)
+#elif defined(__GNUC__) && __GNUC__ >= 4
+# define PHP_PIMPLE_API __attribute__ ((visibility("default")))
+#else
+# define PHP_PIMPLE_API
+#endif
+
+#ifdef ZTS
+#include "TSRM.h"
+#endif
+
+#define PIMPLE_VERSION "3.0.2"
+#define PIMPLE_NS "Pimple"
+
+#define PIMPLE_DEFAULT_ZVAL_CACHE_NUM 5
+#define PIMPLE_DEFAULT_ZVAL_VALUES_NUM 10
+
+zend_module_entry *get_module(void);
+
+PHP_MINIT_FUNCTION(pimple);
+PHP_MINFO_FUNCTION(pimple);
+
+PHP_METHOD(Pimple, __construct);
+PHP_METHOD(Pimple, factory);
+PHP_METHOD(Pimple, protect);
+PHP_METHOD(Pimple, raw);
+PHP_METHOD(Pimple, extend);
+PHP_METHOD(Pimple, keys);
+PHP_METHOD(Pimple, register);
+PHP_METHOD(Pimple, offsetSet);
+PHP_METHOD(Pimple, offsetUnset);
+PHP_METHOD(Pimple, offsetGet);
+PHP_METHOD(Pimple, offsetExists);
+
+PHP_METHOD(PimpleClosure, invoker);
+
+typedef struct _pimple_bucket_value {
+ zval *value; /* Must be the first element */
+ zval *raw;
+ zend_object_handle handle_num;
+ enum {
+ PIMPLE_IS_PARAM = 0,
+ PIMPLE_IS_SERVICE = 2
+ } type;
+ zend_bool initialized;
+ zend_fcall_info_cache fcc;
+} pimple_bucket_value;
+
+typedef struct _pimple_object {
+ zend_object zobj;
+ HashTable values;
+ HashTable factories;
+ HashTable protected;
+} pimple_object;
+
+typedef struct _pimple_closure_object {
+ zend_object zobj;
+ zval *callable;
+ zval *factory;
+} pimple_closure_object;
+
+static const char sensiolabs_logo[] = "";
+
+static int pimple_zval_to_pimpleval(zval *_zval, pimple_bucket_value *_pimple_bucket_value TSRMLS_DC);
+static int pimple_zval_is_valid_callback(zval *_zval, pimple_bucket_value *_pimple_bucket_value TSRMLS_DC);
+
+static void pimple_bucket_dtor(pimple_bucket_value *bucket);
+static void pimple_free_bucket(pimple_bucket_value *bucket);
+
+static zval *pimple_object_read_dimension(zval *object, zval *offset, int type TSRMLS_DC);
+static void pimple_object_write_dimension(zval *object, zval *offset, zval *value TSRMLS_DC);
+static int pimple_object_has_dimension(zval *object, zval *offset, int check_empty TSRMLS_DC);
+static void pimple_object_unset_dimension(zval *object, zval *offset TSRMLS_DC);
+static zend_object_value pimple_object_create(zend_class_entry *ce TSRMLS_DC);
+static void pimple_free_object_storage(pimple_object *obj TSRMLS_DC);
+
+static void pimple_closure_free_object_storage(pimple_closure_object *obj TSRMLS_DC);
+static zend_object_value pimple_closure_object_create(zend_class_entry *ce TSRMLS_DC);
+static zend_function *pimple_closure_get_constructor(zval * TSRMLS_DC);
+static int pimple_closure_get_closure(zval *obj, zend_class_entry **ce_ptr, union _zend_function **fptr_ptr, zval **zobj_ptr TSRMLS_DC);
+
+#ifdef ZTS
+#define PIMPLE_G(v) TSRMG(pimple_globals_id, zend_pimple_globals *, v)
+#else
+#define PIMPLE_G(v) (pimple_globals.v)
+#endif
+
+#endif /* PHP_PIMPLE_H */
+
diff --git a/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/pimple.c b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/pimple.c
new file mode 100644
index 0000000000..239c01d683
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/pimple.c
@@ -0,0 +1,922 @@
+
+/*
+ * This file is part of Pimple.
+ *
+ * Copyright (c) 2014 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "php.h"
+#include "php_ini.h"
+#include "ext/standard/info.h"
+#include "php_pimple.h"
+#include "pimple_compat.h"
+#include "zend_interfaces.h"
+#include "zend.h"
+#include "Zend/zend_closures.h"
+#include "ext/spl/spl_exceptions.h"
+#include "Zend/zend_exceptions.h"
+#include "main/php_output.h"
+#include "SAPI.h"
+
+static zend_class_entry *pimple_ce;
+static zend_object_handlers pimple_object_handlers;
+static zend_class_entry *pimple_closure_ce;
+static zend_class_entry *pimple_serviceprovider_ce;
+static zend_object_handlers pimple_closure_object_handlers;
+static zend_internal_function pimple_closure_invoker_function;
+
+#define FETCH_DIM_HANDLERS_VARS pimple_object *pimple_obj = NULL; \
+ ulong index; \
+ pimple_obj = (pimple_object *)zend_object_store_get_object(object TSRMLS_CC); \
+
+#define PIMPLE_OBJECT_HANDLE_INHERITANCE_OBJECT_HANDLERS do { \
+ if (ce != pimple_ce) { \
+ zend_hash_find(&ce->function_table, ZEND_STRS("offsetget"), (void **)&function); \
+ if (function->common.scope != ce) { /* if the function is not defined in this actual class */ \
+ pimple_object_handlers.read_dimension = pimple_object_read_dimension; /* then overwrite the handler to use custom one */ \
+ } \
+ zend_hash_find(&ce->function_table, ZEND_STRS("offsetset"), (void **)&function); \
+ if (function->common.scope != ce) { \
+ pimple_object_handlers.write_dimension = pimple_object_write_dimension; \
+ } \
+ zend_hash_find(&ce->function_table, ZEND_STRS("offsetexists"), (void **)&function); \
+ if (function->common.scope != ce) { \
+ pimple_object_handlers.has_dimension = pimple_object_has_dimension; \
+ } \
+ zend_hash_find(&ce->function_table, ZEND_STRS("offsetunset"), (void **)&function); \
+ if (function->common.scope != ce) { \
+ pimple_object_handlers.unset_dimension = pimple_object_unset_dimension; \
+ } \
+ } else { \
+ pimple_object_handlers.read_dimension = pimple_object_read_dimension; \
+ pimple_object_handlers.write_dimension = pimple_object_write_dimension; \
+ pimple_object_handlers.has_dimension = pimple_object_has_dimension; \
+ pimple_object_handlers.unset_dimension = pimple_object_unset_dimension; \
+ }\
+ } while(0);
+
+#define PIMPLE_CALL_CB do { \
+ zend_fcall_info_argn(&fci TSRMLS_CC, 1, &object); \
+ fci.size = sizeof(fci); \
+ fci.object_ptr = retval->fcc.object_ptr; \
+ fci.function_name = retval->value; \
+ fci.no_separation = 1; \
+ fci.retval_ptr_ptr = &retval_ptr_ptr; \
+\
+ zend_call_function(&fci, &retval->fcc TSRMLS_CC); \
+ efree(fci.params); \
+ if (EG(exception)) { \
+ return EG(uninitialized_zval_ptr); \
+ } \
+ } while(0);
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, 0, 0, 0)
+ZEND_ARG_ARRAY_INFO(0, value, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_offsetset, 0, 0, 2)
+ZEND_ARG_INFO(0, offset)
+ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_offsetget, 0, 0, 1)
+ZEND_ARG_INFO(0, offset)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_offsetexists, 0, 0, 1)
+ZEND_ARG_INFO(0, offset)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_offsetunset, 0, 0, 1)
+ZEND_ARG_INFO(0, offset)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_factory, 0, 0, 1)
+ZEND_ARG_INFO(0, callable)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_protect, 0, 0, 1)
+ZEND_ARG_INFO(0, callable)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_raw, 0, 0, 1)
+ZEND_ARG_INFO(0, id)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_extend, 0, 0, 2)
+ZEND_ARG_INFO(0, id)
+ZEND_ARG_INFO(0, callable)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_keys, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_register, 0, 0, 1)
+ZEND_ARG_OBJ_INFO(0, provider, Pimple\\ServiceProviderInterface, 0)
+ZEND_ARG_ARRAY_INFO(0, values, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_serviceprovider_register, 0, 0, 1)
+ZEND_ARG_OBJ_INFO(0, pimple, Pimple\\Container, 0)
+ZEND_END_ARG_INFO()
+
+static const zend_function_entry pimple_ce_functions[] = {
+ PHP_ME(Pimple, __construct, arginfo___construct, ZEND_ACC_PUBLIC)
+ PHP_ME(Pimple, factory, arginfo_factory, ZEND_ACC_PUBLIC)
+ PHP_ME(Pimple, protect, arginfo_protect, ZEND_ACC_PUBLIC)
+ PHP_ME(Pimple, raw, arginfo_raw, ZEND_ACC_PUBLIC)
+ PHP_ME(Pimple, extend, arginfo_extend, ZEND_ACC_PUBLIC)
+ PHP_ME(Pimple, keys, arginfo_keys, ZEND_ACC_PUBLIC)
+ PHP_ME(Pimple, register, arginfo_register, ZEND_ACC_PUBLIC)
+
+ PHP_ME(Pimple, offsetSet, arginfo_offsetset, ZEND_ACC_PUBLIC)
+ PHP_ME(Pimple, offsetGet, arginfo_offsetget, ZEND_ACC_PUBLIC)
+ PHP_ME(Pimple, offsetExists, arginfo_offsetexists, ZEND_ACC_PUBLIC)
+ PHP_ME(Pimple, offsetUnset, arginfo_offsetunset, ZEND_ACC_PUBLIC)
+ PHP_FE_END
+};
+
+static const zend_function_entry pimple_serviceprovider_iface_ce_functions[] = {
+ PHP_ABSTRACT_ME(ServiceProviderInterface, register, arginfo_serviceprovider_register)
+ PHP_FE_END
+};
+
+static void pimple_closure_free_object_storage(pimple_closure_object *obj TSRMLS_DC)
+{
+ zend_object_std_dtor(&obj->zobj TSRMLS_CC);
+ if (obj->factory) {
+ zval_ptr_dtor(&obj->factory);
+ }
+ if (obj->callable) {
+ zval_ptr_dtor(&obj->callable);
+ }
+ efree(obj);
+}
+
+static void pimple_free_object_storage(pimple_object *obj TSRMLS_DC)
+{
+ zend_hash_destroy(&obj->factories);
+ zend_hash_destroy(&obj->protected);
+ zend_hash_destroy(&obj->values);
+ zend_object_std_dtor(&obj->zobj TSRMLS_CC);
+ efree(obj);
+}
+
+static void pimple_free_bucket(pimple_bucket_value *bucket)
+{
+ if (bucket->raw) {
+ zval_ptr_dtor(&bucket->raw);
+ }
+}
+
+static zend_object_value pimple_closure_object_create(zend_class_entry *ce TSRMLS_DC)
+{
+ zend_object_value retval;
+ pimple_closure_object *pimple_closure_obj = NULL;
+
+ pimple_closure_obj = ecalloc(1, sizeof(pimple_closure_object));
+ ZEND_OBJ_INIT(&pimple_closure_obj->zobj, ce);
+
+ pimple_closure_object_handlers.get_constructor = pimple_closure_get_constructor;
+ retval.handlers = &pimple_closure_object_handlers;
+ retval.handle = zend_objects_store_put(pimple_closure_obj, (zend_objects_store_dtor_t) zend_objects_destroy_object, (zend_objects_free_object_storage_t) pimple_closure_free_object_storage, NULL TSRMLS_CC);
+
+ return retval;
+}
+
+static zend_function *pimple_closure_get_constructor(zval *obj TSRMLS_DC)
+{
+ zend_error(E_ERROR, "Pimple\\ContainerClosure is an internal class and cannot be instantiated");
+
+ return NULL;
+}
+
+static int pimple_closure_get_closure(zval *obj, zend_class_entry **ce_ptr, union _zend_function **fptr_ptr, zval **zobj_ptr TSRMLS_DC)
+{
+ *zobj_ptr = obj;
+ *ce_ptr = Z_OBJCE_P(obj);
+ *fptr_ptr = (zend_function *)&pimple_closure_invoker_function;
+
+ return SUCCESS;
+}
+
+static zend_object_value pimple_object_create(zend_class_entry *ce TSRMLS_DC)
+{
+ zend_object_value retval;
+ pimple_object *pimple_obj = NULL;
+ zend_function *function = NULL;
+
+ pimple_obj = emalloc(sizeof(pimple_object));
+ ZEND_OBJ_INIT(&pimple_obj->zobj, ce);
+
+ PIMPLE_OBJECT_HANDLE_INHERITANCE_OBJECT_HANDLERS
+
+ retval.handlers = &pimple_object_handlers;
+ retval.handle = zend_objects_store_put(pimple_obj, (zend_objects_store_dtor_t) zend_objects_destroy_object, (zend_objects_free_object_storage_t) pimple_free_object_storage, NULL TSRMLS_CC);
+
+ zend_hash_init(&pimple_obj->factories, PIMPLE_DEFAULT_ZVAL_CACHE_NUM, NULL, (dtor_func_t)pimple_bucket_dtor, 0);
+ zend_hash_init(&pimple_obj->protected, PIMPLE_DEFAULT_ZVAL_CACHE_NUM, NULL, (dtor_func_t)pimple_bucket_dtor, 0);
+ zend_hash_init(&pimple_obj->values, PIMPLE_DEFAULT_ZVAL_VALUES_NUM, NULL, (dtor_func_t)pimple_bucket_dtor, 0);
+
+ return retval;
+}
+
+static void pimple_object_write_dimension(zval *object, zval *offset, zval *value TSRMLS_DC)
+{
+ FETCH_DIM_HANDLERS_VARS
+
+ pimple_bucket_value pimple_value = {0}, *found_value = NULL;
+ ulong hash;
+
+ pimple_zval_to_pimpleval(value, &pimple_value TSRMLS_CC);
+
+ if (!offset) {/* $p[] = 'foo' when not overloaded */
+ zend_hash_next_index_insert(&pimple_obj->values, (void *)&pimple_value, sizeof(pimple_bucket_value), NULL);
+ Z_ADDREF_P(value);
+ return;
+ }
+
+ switch (Z_TYPE_P(offset)) {
+ case IS_STRING:
+ hash = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1);
+ zend_hash_quick_find(&pimple_obj->values, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hash, (void **)&found_value);
+ if (found_value && found_value->type == PIMPLE_IS_SERVICE && found_value->initialized == 1) {
+ pimple_free_bucket(&pimple_value);
+ zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Cannot override frozen service \"%s\".", Z_STRVAL_P(offset));
+ return;
+ }
+ if (zend_hash_quick_update(&pimple_obj->values, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hash, (void *)&pimple_value, sizeof(pimple_bucket_value), NULL) == FAILURE) {
+ pimple_free_bucket(&pimple_value);
+ return;
+ }
+ Z_ADDREF_P(value);
+ break;
+ case IS_DOUBLE:
+ case IS_BOOL:
+ case IS_LONG:
+ if (Z_TYPE_P(offset) == IS_DOUBLE) {
+ index = (ulong)Z_DVAL_P(offset);
+ } else {
+ index = Z_LVAL_P(offset);
+ }
+ zend_hash_index_find(&pimple_obj->values, index, (void **)&found_value);
+ if (found_value && found_value->type == PIMPLE_IS_SERVICE && found_value->initialized == 1) {
+ pimple_free_bucket(&pimple_value);
+ zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Cannot override frozen service \"%ld\".", index);
+ return;
+ }
+ if (zend_hash_index_update(&pimple_obj->values, index, (void *)&pimple_value, sizeof(pimple_bucket_value), NULL) == FAILURE) {
+ pimple_free_bucket(&pimple_value);
+ return;
+ }
+ Z_ADDREF_P(value);
+ break;
+ case IS_NULL: /* $p[] = 'foo' when overloaded */
+ zend_hash_next_index_insert(&pimple_obj->values, (void *)&pimple_value, sizeof(pimple_bucket_value), NULL);
+ Z_ADDREF_P(value);
+ break;
+ default:
+ pimple_free_bucket(&pimple_value);
+ zend_error(E_WARNING, "Unsupported offset type");
+ }
+}
+
+static void pimple_object_unset_dimension(zval *object, zval *offset TSRMLS_DC)
+{
+ FETCH_DIM_HANDLERS_VARS
+
+ switch (Z_TYPE_P(offset)) {
+ case IS_STRING:
+ zend_symtable_del(&pimple_obj->values, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1);
+ zend_symtable_del(&pimple_obj->factories, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1);
+ zend_symtable_del(&pimple_obj->protected, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1);
+ break;
+ case IS_DOUBLE:
+ case IS_BOOL:
+ case IS_LONG:
+ if (Z_TYPE_P(offset) == IS_DOUBLE) {
+ index = (ulong)Z_DVAL_P(offset);
+ } else {
+ index = Z_LVAL_P(offset);
+ }
+ zend_hash_index_del(&pimple_obj->values, index);
+ zend_hash_index_del(&pimple_obj->factories, index);
+ zend_hash_index_del(&pimple_obj->protected, index);
+ break;
+ default:
+ zend_error(E_WARNING, "Unsupported offset type");
+ }
+}
+
+static int pimple_object_has_dimension(zval *object, zval *offset, int check_empty TSRMLS_DC)
+{
+ FETCH_DIM_HANDLERS_VARS
+
+ pimple_bucket_value *retval = NULL;
+
+ switch (Z_TYPE_P(offset)) {
+ case IS_STRING:
+ if (zend_symtable_find(&pimple_obj->values, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void **)&retval) == SUCCESS) {
+ switch (check_empty) {
+ case 0: /* isset */
+ return 1; /* Differs from PHP behavior (Z_TYPE_P(retval->value) != IS_NULL;) */
+ case 1: /* empty */
+ default:
+ return zend_is_true(retval->value);
+ }
+ }
+ return 0;
+ break;
+ case IS_DOUBLE:
+ case IS_BOOL:
+ case IS_LONG:
+ if (Z_TYPE_P(offset) == IS_DOUBLE) {
+ index = (ulong)Z_DVAL_P(offset);
+ } else {
+ index = Z_LVAL_P(offset);
+ }
+ if (zend_hash_index_find(&pimple_obj->values, index, (void **)&retval) == SUCCESS) {
+ switch (check_empty) {
+ case 0: /* isset */
+ return 1; /* Differs from PHP behavior (Z_TYPE_P(retval->value) != IS_NULL;)*/
+ case 1: /* empty */
+ default:
+ return zend_is_true(retval->value);
+ }
+ }
+ return 0;
+ break;
+ default:
+ zend_error(E_WARNING, "Unsupported offset type");
+ return 0;
+ }
+}
+
+static zval *pimple_object_read_dimension(zval *object, zval *offset, int type TSRMLS_DC)
+{
+ FETCH_DIM_HANDLERS_VARS
+
+ pimple_bucket_value *retval = NULL;
+ zend_fcall_info fci = {0};
+ zval *retval_ptr_ptr = NULL;
+
+ switch (Z_TYPE_P(offset)) {
+ case IS_STRING:
+ if (zend_symtable_find(&pimple_obj->values, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void **)&retval) == FAILURE) {
+ zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Identifier \"%s\" is not defined.", Z_STRVAL_P(offset));
+ return EG(uninitialized_zval_ptr);
+ }
+ break;
+ case IS_DOUBLE:
+ case IS_BOOL:
+ case IS_LONG:
+ if (Z_TYPE_P(offset) == IS_DOUBLE) {
+ index = (ulong)Z_DVAL_P(offset);
+ } else {
+ index = Z_LVAL_P(offset);
+ }
+ if (zend_hash_index_find(&pimple_obj->values, index, (void **)&retval) == FAILURE) {
+ return EG(uninitialized_zval_ptr);
+ }
+ break;
+ case IS_NULL: /* $p[][3] = 'foo' first dim access */
+ return EG(uninitialized_zval_ptr);
+ break;
+ default:
+ zend_error(E_WARNING, "Unsupported offset type");
+ return EG(uninitialized_zval_ptr);
+ }
+
+ if(retval->type == PIMPLE_IS_PARAM) {
+ return retval->value;
+ }
+
+ if (zend_hash_index_exists(&pimple_obj->protected, retval->handle_num)) {
+ /* Service is protected, return the value every time */
+ return retval->value;
+ }
+
+ if (zend_hash_index_exists(&pimple_obj->factories, retval->handle_num)) {
+ /* Service is a factory, call it everytime and never cache its result */
+ PIMPLE_CALL_CB
+ Z_DELREF_P(retval_ptr_ptr); /* fetch dim addr will increment refcount */
+ return retval_ptr_ptr;
+ }
+
+ if (retval->initialized == 1) {
+ /* Service has already been called, return its cached value */
+ return retval->value;
+ }
+
+ ALLOC_INIT_ZVAL(retval->raw);
+ MAKE_COPY_ZVAL(&retval->value, retval->raw);
+
+ PIMPLE_CALL_CB
+
+ retval->initialized = 1;
+ zval_ptr_dtor(&retval->value);
+ retval->value = retval_ptr_ptr;
+
+ return retval->value;
+}
+
+static int pimple_zval_is_valid_callback(zval *_zval, pimple_bucket_value *_pimple_bucket_value TSRMLS_DC)
+{
+ if (Z_TYPE_P(_zval) != IS_OBJECT) {
+ return FAILURE;
+ }
+
+ if (_pimple_bucket_value->fcc.called_scope) {
+ return SUCCESS;
+ }
+
+ if (Z_OBJ_HANDLER_P(_zval, get_closure) && Z_OBJ_HANDLER_P(_zval, get_closure)(_zval, &_pimple_bucket_value->fcc.calling_scope, &_pimple_bucket_value->fcc.function_handler, &_pimple_bucket_value->fcc.object_ptr TSRMLS_CC) == SUCCESS) {
+ _pimple_bucket_value->fcc.called_scope = _pimple_bucket_value->fcc.calling_scope;
+ return SUCCESS;
+ } else {
+ return FAILURE;
+ }
+}
+
+static int pimple_zval_to_pimpleval(zval *_zval, pimple_bucket_value *_pimple_bucket_value TSRMLS_DC)
+{
+ _pimple_bucket_value->value = _zval;
+
+ if (Z_TYPE_P(_zval) != IS_OBJECT) {
+ return PIMPLE_IS_PARAM;
+ }
+
+ if (pimple_zval_is_valid_callback(_zval, _pimple_bucket_value TSRMLS_CC) == SUCCESS) {
+ _pimple_bucket_value->type = PIMPLE_IS_SERVICE;
+ _pimple_bucket_value->handle_num = Z_OBJ_HANDLE_P(_zval);
+ }
+
+ return PIMPLE_IS_SERVICE;
+}
+
+static void pimple_bucket_dtor(pimple_bucket_value *bucket)
+{
+ zval_ptr_dtor(&bucket->value);
+ pimple_free_bucket(bucket);
+}
+
+PHP_METHOD(Pimple, protect)
+{
+ zval *protected = NULL;
+ pimple_object *pobj = NULL;
+ pimple_bucket_value bucket = {0};
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &protected) == FAILURE) {
+ return;
+ }
+
+ if (pimple_zval_is_valid_callback(protected, &bucket TSRMLS_CC) == FAILURE) {
+ pimple_free_bucket(&bucket);
+ zend_throw_exception(spl_ce_InvalidArgumentException, "Callable is not a Closure or invokable object.", 0 TSRMLS_CC);
+ return;
+ }
+
+ pimple_zval_to_pimpleval(protected, &bucket TSRMLS_CC);
+ pobj = (pimple_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
+
+ if (zend_hash_index_update(&pobj->protected, bucket.handle_num, (void *)&bucket, sizeof(pimple_bucket_value), NULL) == SUCCESS) {
+ Z_ADDREF_P(protected);
+ RETURN_ZVAL(protected, 1 , 0);
+ } else {
+ pimple_free_bucket(&bucket);
+ }
+ RETURN_FALSE;
+}
+
+PHP_METHOD(Pimple, raw)
+{
+ zval *offset = NULL;
+ pimple_object *pobj = NULL;
+ pimple_bucket_value *value = NULL;
+ ulong index;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &offset) == FAILURE) {
+ return;
+ }
+
+ pobj = zend_object_store_get_object(getThis() TSRMLS_CC);
+
+ switch (Z_TYPE_P(offset)) {
+ case IS_STRING:
+ if (zend_symtable_find(&pobj->values, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void *)&value) == FAILURE) {
+ zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Identifier \"%s\" is not defined.", Z_STRVAL_P(offset));
+ RETURN_NULL();
+ }
+ break;
+ case IS_DOUBLE:
+ case IS_BOOL:
+ case IS_LONG:
+ if (Z_TYPE_P(offset) == IS_DOUBLE) {
+ index = (ulong)Z_DVAL_P(offset);
+ } else {
+ index = Z_LVAL_P(offset);
+ }
+ if (zend_hash_index_find(&pobj->values, index, (void *)&value) == FAILURE) {
+ RETURN_NULL();
+ }
+ break;
+ case IS_NULL:
+ default:
+ zend_error(E_WARNING, "Unsupported offset type");
+ }
+
+ if (value->raw) {
+ RETVAL_ZVAL(value->raw, 1, 0);
+ } else {
+ RETVAL_ZVAL(value->value, 1, 0);
+ }
+}
+
+PHP_METHOD(Pimple, extend)
+{
+ zval *offset = NULL, *callable = NULL, *pimple_closure_obj = NULL;
+ pimple_bucket_value bucket = {0}, *value = NULL;
+ pimple_object *pobj = NULL;
+ pimple_closure_object *pcobj = NULL;
+ ulong index;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &offset, &callable) == FAILURE) {
+ return;
+ }
+
+ pobj = zend_object_store_get_object(getThis() TSRMLS_CC);
+
+ switch (Z_TYPE_P(offset)) {
+ case IS_STRING:
+ if (zend_symtable_find(&pobj->values, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void *)&value) == FAILURE) {
+ zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Identifier \"%s\" is not defined.", Z_STRVAL_P(offset));
+ RETURN_NULL();
+ }
+ if (value->type != PIMPLE_IS_SERVICE) {
+ zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Identifier \"%s\" does not contain an object definition.", Z_STRVAL_P(offset));
+ RETURN_NULL();
+ }
+ break;
+ case IS_DOUBLE:
+ case IS_BOOL:
+ case IS_LONG:
+ if (Z_TYPE_P(offset) == IS_DOUBLE) {
+ index = (ulong)Z_DVAL_P(offset);
+ } else {
+ index = Z_LVAL_P(offset);
+ }
+ if (zend_hash_index_find(&pobj->values, index, (void *)&value) == FAILURE) {
+ zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Identifier \"%ld\" is not defined.", index);
+ RETURN_NULL();
+ }
+ if (value->type != PIMPLE_IS_SERVICE) {
+ zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Identifier \"%ld\" does not contain an object definition.", index);
+ RETURN_NULL();
+ }
+ break;
+ case IS_NULL:
+ default:
+ zend_error(E_WARNING, "Unsupported offset type");
+ }
+
+ if (pimple_zval_is_valid_callback(callable, &bucket TSRMLS_CC) == FAILURE) {
+ pimple_free_bucket(&bucket);
+ zend_throw_exception(spl_ce_InvalidArgumentException, "Extension service definition is not a Closure or invokable object.", 0 TSRMLS_CC);
+ RETURN_NULL();
+ }
+ pimple_free_bucket(&bucket);
+
+ ALLOC_INIT_ZVAL(pimple_closure_obj);
+ object_init_ex(pimple_closure_obj, pimple_closure_ce);
+
+ pcobj = zend_object_store_get_object(pimple_closure_obj TSRMLS_CC);
+ pcobj->callable = callable;
+ pcobj->factory = value->value;
+ Z_ADDREF_P(callable);
+ Z_ADDREF_P(value->value);
+
+ if (zend_hash_index_exists(&pobj->factories, value->handle_num)) {
+ pimple_zval_to_pimpleval(pimple_closure_obj, &bucket TSRMLS_CC);
+ zend_hash_index_del(&pobj->factories, value->handle_num);
+ zend_hash_index_update(&pobj->factories, bucket.handle_num, (void *)&bucket, sizeof(pimple_bucket_value), NULL);
+ Z_ADDREF_P(pimple_closure_obj);
+ }
+
+ pimple_object_write_dimension(getThis(), offset, pimple_closure_obj TSRMLS_CC);
+
+ RETVAL_ZVAL(pimple_closure_obj, 1, 1);
+}
+
+PHP_METHOD(Pimple, keys)
+{
+ HashPosition pos;
+ pimple_object *pobj = NULL;
+ zval **value = NULL;
+ zval *endval = NULL;
+ char *str_index = NULL;
+ int str_len;
+ ulong num_index;
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
+ pobj = zend_object_store_get_object(getThis() TSRMLS_CC);
+ array_init_size(return_value, zend_hash_num_elements(&pobj->values));
+
+ zend_hash_internal_pointer_reset_ex(&pobj->values, &pos);
+
+ while(zend_hash_get_current_data_ex(&pobj->values, (void **)&value, &pos) == SUCCESS) {
+ MAKE_STD_ZVAL(endval);
+ switch (zend_hash_get_current_key_ex(&pobj->values, &str_index, (uint *)&str_len, &num_index, 0, &pos)) {
+ case HASH_KEY_IS_STRING:
+ ZVAL_STRINGL(endval, str_index, str_len - 1, 1);
+ zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &endval, sizeof(zval *), NULL);
+ break;
+ case HASH_KEY_IS_LONG:
+ ZVAL_LONG(endval, num_index);
+ zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &endval, sizeof(zval *), NULL);
+ break;
+ }
+ zend_hash_move_forward_ex(&pobj->values, &pos);
+ }
+}
+
+PHP_METHOD(Pimple, factory)
+{
+ zval *factory = NULL;
+ pimple_object *pobj = NULL;
+ pimple_bucket_value bucket = {0};
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &factory) == FAILURE) {
+ return;
+ }
+
+ if (pimple_zval_is_valid_callback(factory, &bucket TSRMLS_CC) == FAILURE) {
+ pimple_free_bucket(&bucket);
+ zend_throw_exception(spl_ce_InvalidArgumentException, "Service definition is not a Closure or invokable object.", 0 TSRMLS_CC);
+ return;
+ }
+
+ pimple_zval_to_pimpleval(factory, &bucket TSRMLS_CC);
+ pobj = (pimple_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
+
+ if (zend_hash_index_update(&pobj->factories, bucket.handle_num, (void *)&bucket, sizeof(pimple_bucket_value), NULL) == SUCCESS) {
+ Z_ADDREF_P(factory);
+ RETURN_ZVAL(factory, 1 , 0);
+ } else {
+ pimple_free_bucket(&bucket);
+ }
+
+ RETURN_FALSE;
+}
+
+PHP_METHOD(Pimple, offsetSet)
+{
+ zval *offset = NULL, *value = NULL;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &offset, &value) == FAILURE) {
+ return;
+ }
+
+ pimple_object_write_dimension(getThis(), offset, value TSRMLS_CC);
+}
+
+PHP_METHOD(Pimple, offsetGet)
+{
+ zval *offset = NULL, *retval = NULL;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &offset) == FAILURE) {
+ return;
+ }
+
+ retval = pimple_object_read_dimension(getThis(), offset, 0 TSRMLS_CC);
+
+ RETVAL_ZVAL(retval, 1, 0);
+}
+
+PHP_METHOD(Pimple, offsetUnset)
+{
+ zval *offset = NULL;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &offset) == FAILURE) {
+ return;
+ }
+
+ pimple_object_unset_dimension(getThis(), offset TSRMLS_CC);
+}
+
+PHP_METHOD(Pimple, offsetExists)
+{
+ zval *offset = NULL;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &offset) == FAILURE) {
+ return;
+ }
+
+ RETVAL_BOOL(pimple_object_has_dimension(getThis(), offset, 1 TSRMLS_CC));
+}
+
+PHP_METHOD(Pimple, register)
+{
+ zval *provider;
+ zval **data;
+ zval *retval = NULL;
+ zval key;
+
+ HashTable *array = NULL;
+ HashPosition pos;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|h", &provider, pimple_serviceprovider_ce, &array) == FAILURE) {
+ return;
+ }
+
+ RETVAL_ZVAL(getThis(), 1, 0);
+
+ zend_call_method_with_1_params(&provider, Z_OBJCE_P(provider), NULL, "register", &retval, getThis());
+
+ if (retval) {
+ zval_ptr_dtor(&retval);
+ }
+
+ if (!array) {
+ return;
+ }
+
+ zend_hash_internal_pointer_reset_ex(array, &pos);
+
+ while(zend_hash_get_current_data_ex(array, (void **)&data, &pos) == SUCCESS) {
+ zend_hash_get_current_key_zval_ex(array, &key, &pos);
+ pimple_object_write_dimension(getThis(), &key, *data TSRMLS_CC);
+ zend_hash_move_forward_ex(array, &pos);
+ }
+}
+
+PHP_METHOD(Pimple, __construct)
+{
+ zval *values = NULL, **pData = NULL, offset;
+ HashPosition pos;
+ char *str_index = NULL;
+ zend_uint str_length;
+ ulong num_index;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|a!", &values) == FAILURE || !values) {
+ return;
+ }
+
+ zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(values), &pos);
+ while (zend_hash_has_more_elements_ex(Z_ARRVAL_P(values), &pos) == SUCCESS) {
+ zend_hash_get_current_data_ex(Z_ARRVAL_P(values), (void **)&pData, &pos);
+ zend_hash_get_current_key_ex(Z_ARRVAL_P(values), &str_index, &str_length, &num_index, 0, &pos);
+ INIT_ZVAL(offset);
+ if (zend_hash_get_current_key_type_ex(Z_ARRVAL_P(values), &pos) == HASH_KEY_IS_LONG) {
+ ZVAL_LONG(&offset, num_index);
+ } else {
+ ZVAL_STRINGL(&offset, str_index, (str_length - 1), 0);
+ }
+ pimple_object_write_dimension(getThis(), &offset, *pData TSRMLS_CC);
+ zend_hash_move_forward_ex(Z_ARRVAL_P(values), &pos);
+ }
+}
+
+/*
+ * This is PHP code snippet handling extend()s calls :
+
+ $extended = function ($c) use ($callable, $factory) {
+ return $callable($factory($c), $c);
+ };
+
+ */
+PHP_METHOD(PimpleClosure, invoker)
+{
+ pimple_closure_object *pcobj = NULL;
+ zval *arg = NULL, *retval = NULL, *newretval = NULL;
+ zend_fcall_info fci = {0};
+ zval **args[2];
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &arg) == FAILURE) {
+ return;
+ }
+
+ pcobj = zend_object_store_get_object(getThis() TSRMLS_CC);
+
+ fci.function_name = pcobj->factory;
+ args[0] = &arg;
+ zend_fcall_info_argp(&fci TSRMLS_CC, 1, args);
+ fci.retval_ptr_ptr = &retval;
+ fci.size = sizeof(fci);
+
+ if (zend_call_function(&fci, NULL TSRMLS_CC) == FAILURE || EG(exception)) {
+ efree(fci.params);
+ return; /* Should here return default zval */
+ }
+
+ efree(fci.params);
+ memset(&fci, 0, sizeof(fci));
+ fci.size = sizeof(fci);
+
+ fci.function_name = pcobj->callable;
+ args[0] = &retval;
+ args[1] = &arg;
+ zend_fcall_info_argp(&fci TSRMLS_CC, 2, args);
+ fci.retval_ptr_ptr = &newretval;
+
+ if (zend_call_function(&fci, NULL TSRMLS_CC) == FAILURE || EG(exception)) {
+ efree(fci.params);
+ zval_ptr_dtor(&retval);
+ return;
+ }
+
+ efree(fci.params);
+ zval_ptr_dtor(&retval);
+
+ RETVAL_ZVAL(newretval, 1 ,1);
+}
+
+PHP_MINIT_FUNCTION(pimple)
+{
+ zend_class_entry tmp_pimple_ce, tmp_pimple_closure_ce, tmp_pimple_serviceprovider_iface_ce;
+ INIT_NS_CLASS_ENTRY(tmp_pimple_ce, PIMPLE_NS, "Container", pimple_ce_functions);
+ INIT_NS_CLASS_ENTRY(tmp_pimple_closure_ce, PIMPLE_NS, "ContainerClosure", NULL);
+ INIT_NS_CLASS_ENTRY(tmp_pimple_serviceprovider_iface_ce, PIMPLE_NS, "ServiceProviderInterface", pimple_serviceprovider_iface_ce_functions);
+
+ tmp_pimple_ce.create_object = pimple_object_create;
+ tmp_pimple_closure_ce.create_object = pimple_closure_object_create;
+
+ pimple_ce = zend_register_internal_class(&tmp_pimple_ce TSRMLS_CC);
+ zend_class_implements(pimple_ce TSRMLS_CC, 1, zend_ce_arrayaccess);
+
+ pimple_closure_ce = zend_register_internal_class(&tmp_pimple_closure_ce TSRMLS_CC);
+ pimple_closure_ce->ce_flags |= ZEND_ACC_FINAL_CLASS;
+
+ pimple_serviceprovider_ce = zend_register_internal_interface(&tmp_pimple_serviceprovider_iface_ce TSRMLS_CC);
+
+ memcpy(&pimple_closure_object_handlers, zend_get_std_object_handlers(), sizeof(*zend_get_std_object_handlers()));
+ pimple_object_handlers = std_object_handlers;
+ pimple_closure_object_handlers.get_closure = pimple_closure_get_closure;
+
+ pimple_closure_invoker_function.function_name = "Pimple closure internal invoker";
+ pimple_closure_invoker_function.fn_flags |= ZEND_ACC_CLOSURE;
+ pimple_closure_invoker_function.handler = ZEND_MN(PimpleClosure_invoker);
+ pimple_closure_invoker_function.num_args = 1;
+ pimple_closure_invoker_function.required_num_args = 1;
+ pimple_closure_invoker_function.scope = pimple_closure_ce;
+ pimple_closure_invoker_function.type = ZEND_INTERNAL_FUNCTION;
+ pimple_closure_invoker_function.module = &pimple_module_entry;
+
+ return SUCCESS;
+}
+
+PHP_MINFO_FUNCTION(pimple)
+{
+ php_info_print_table_start();
+ php_info_print_table_header(2, "SensioLabs Pimple C support", "enabled");
+ php_info_print_table_row(2, "Pimple supported version", PIMPLE_VERSION);
+ php_info_print_table_end();
+
+ php_info_print_box_start(0);
+ php_write((void *)ZEND_STRL("SensioLabs Pimple C support developed by Julien Pauli") TSRMLS_CC);
+ if (!sapi_module.phpinfo_as_text) {
+ php_write((void *)ZEND_STRL(sensiolabs_logo) TSRMLS_CC);
+ }
+ php_info_print_box_end();
+}
+
+zend_module_entry pimple_module_entry = {
+ STANDARD_MODULE_HEADER,
+ "pimple",
+ NULL,
+ PHP_MINIT(pimple),
+ NULL,
+ NULL,
+ NULL,
+ PHP_MINFO(pimple),
+ PIMPLE_VERSION,
+ STANDARD_MODULE_PROPERTIES
+};
+
+#ifdef COMPILE_DL_PIMPLE
+ZEND_GET_MODULE(pimple)
+#endif
diff --git a/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/pimple_compat.h b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/pimple_compat.h
new file mode 100644
index 0000000000..d234e174d0
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/pimple_compat.h
@@ -0,0 +1,81 @@
+
+/*
+ * This file is part of Pimple.
+ *
+ * Copyright (c) 2014 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.
+ */
+
+#ifndef PIMPLE_COMPAT_H_
+#define PIMPLE_COMPAT_H_
+
+#include "Zend/zend_extensions.h" /* for ZEND_EXTENSION_API_NO */
+
+#define PHP_5_0_X_API_NO 220040412
+#define PHP_5_1_X_API_NO 220051025
+#define PHP_5_2_X_API_NO 220060519
+#define PHP_5_3_X_API_NO 220090626
+#define PHP_5_4_X_API_NO 220100525
+#define PHP_5_5_X_API_NO 220121212
+#define PHP_5_6_X_API_NO 220131226
+
+#define IS_PHP_56 ZEND_EXTENSION_API_NO == PHP_5_6_X_API_NO
+#define IS_AT_LEAST_PHP_56 ZEND_EXTENSION_API_NO >= PHP_5_6_X_API_NO
+
+#define IS_PHP_55 ZEND_EXTENSION_API_NO == PHP_5_5_X_API_NO
+#define IS_AT_LEAST_PHP_55 ZEND_EXTENSION_API_NO >= PHP_5_5_X_API_NO
+
+#define IS_PHP_54 ZEND_EXTENSION_API_NO == PHP_5_4_X_API_NO
+#define IS_AT_LEAST_PHP_54 ZEND_EXTENSION_API_NO >= PHP_5_4_X_API_NO
+
+#define IS_PHP_53 ZEND_EXTENSION_API_NO == PHP_5_3_X_API_NO
+#define IS_AT_LEAST_PHP_53 ZEND_EXTENSION_API_NO >= PHP_5_3_X_API_NO
+
+#if IS_PHP_53
+#define object_properties_init(obj, ce) do { \
+ zend_hash_copy(obj->properties, &ce->default_properties, zval_copy_property_ctor(ce), NULL, sizeof(zval *)); \
+ } while (0);
+#endif
+
+#define ZEND_OBJ_INIT(obj, ce) do { \
+ zend_object_std_init(obj, ce TSRMLS_CC); \
+ object_properties_init((obj), (ce)); \
+ } while(0);
+
+#if IS_PHP_53 || IS_PHP_54
+static void zend_hash_get_current_key_zval_ex(const HashTable *ht, zval *key, HashPosition *pos) {
+ Bucket *p;
+
+ p = pos ? (*pos) : ht->pInternalPointer;
+
+ if (!p) {
+ Z_TYPE_P(key) = IS_NULL;
+ } else if (p->nKeyLength) {
+ Z_TYPE_P(key) = IS_STRING;
+ Z_STRVAL_P(key) = estrndup(p->arKey, p->nKeyLength - 1);
+ Z_STRLEN_P(key) = p->nKeyLength - 1;
+ } else {
+ Z_TYPE_P(key) = IS_LONG;
+ Z_LVAL_P(key) = p->h;
+ }
+}
+#endif
+
+#endif /* PIMPLE_COMPAT_H_ */
diff --git a/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/001.phpt b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/001.phpt
new file mode 100644
index 0000000000..0809ea232b
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/001.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test for read_dim/write_dim handlers
+--SKIPIF--
+
+--FILE--
+
+
+--EXPECTF--
+foo
+42
+foo2
+foo99
+baz
+strstr
\ No newline at end of file
diff --git a/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/002.phpt b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/002.phpt
new file mode 100644
index 0000000000..7b56d2c1fe
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/002.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Test for constructor
+--SKIPIF--
+
+--FILE--
+'foo'));
+var_dump($p[42]);
+?>
+--EXPECT--
+NULL
+string(3) "foo"
diff --git a/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/003.phpt b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/003.phpt
new file mode 100644
index 0000000000..a22cfa352e
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/003.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Test empty dimensions
+--SKIPIF--
+
+--FILE--
+
+--EXPECT--
+int(42)
+string(3) "bar"
\ No newline at end of file
diff --git a/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/004.phpt b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/004.phpt
new file mode 100644
index 0000000000..1e1d251367
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/004.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test has/unset dim handlers
+--SKIPIF--
+
+--FILE--
+
+--EXPECT--
+int(42)
+NULL
+bool(true)
+bool(false)
+bool(true)
+bool(true)
\ No newline at end of file
diff --git a/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/005.phpt b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/005.phpt
new file mode 100644
index 0000000000..0479ee055d
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/005.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test simple class inheritance
+--SKIPIF--
+
+--FILE--
+someAttr;
+?>
+--EXPECT--
+string(3) "hit"
+foo
+fooAttr
\ No newline at end of file
diff --git a/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/006.phpt b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/006.phpt
new file mode 100644
index 0000000000..cfe8a119e6
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/006.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Test complex class inheritance
+--SKIPIF--
+
+--FILE--
+ 'bar', 88 => 'baz');
+
+$p = new TestPimple($defaultValues);
+$p[42] = 'foo';
+var_dump($p[42]);
+var_dump($p[0]);
+?>
+--EXPECT--
+string(13) "hit offsetset"
+string(27) "hit offsetget in TestPimple"
+string(25) "hit offsetget in MyPimple"
+string(3) "foo"
+string(27) "hit offsetget in TestPimple"
+string(25) "hit offsetget in MyPimple"
+string(3) "baz"
\ No newline at end of file
diff --git a/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/007.phpt b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/007.phpt
new file mode 100644
index 0000000000..5aac683806
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/007.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Test for read_dim/write_dim handlers
+--SKIPIF--
+
+--FILE--
+
+--EXPECTF--
+foo
+42
\ No newline at end of file
diff --git a/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/008.phpt b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/008.phpt
new file mode 100644
index 0000000000..db7eeec4a1
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/008.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test frozen services
+--SKIPIF--
+
+--FILE--
+
+--EXPECTF--
diff --git a/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/009.phpt b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/009.phpt
new file mode 100644
index 0000000000..bb05ea2964
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/009.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Test service is called as callback, and only once
+--SKIPIF--
+
+--FILE--
+
+--EXPECTF--
+bool(true)
\ No newline at end of file
diff --git a/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/010.phpt b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/010.phpt
new file mode 100644
index 0000000000..badce0146a
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/010.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test service is called as callback for every callback type
+--SKIPIF--
+
+--FILE--
+
+--EXPECTF--
+callme
+called
+Foo::bar
+array(2) {
+ [0]=>
+ string(3) "Foo"
+ [1]=>
+ string(3) "bar"
+}
\ No newline at end of file
diff --git a/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/011.phpt b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/011.phpt
new file mode 100644
index 0000000000..6682ab8ebd
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/011.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Test service callback throwing an exception
+--SKIPIF--
+
+--FILE--
+
+--EXPECTF--
+all right!
\ No newline at end of file
diff --git a/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/012.phpt b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/012.phpt
new file mode 100644
index 0000000000..4c6ac486dc
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/012.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Test service factory
+--SKIPIF--
+
+--FILE--
+factory($f = function() { var_dump('called-1'); return 'ret-1';});
+
+$p[] = $f;
+
+$p[] = function () { var_dump('called-2'); return 'ret-2'; };
+
+var_dump($p[0]);
+var_dump($p[0]);
+var_dump($p[1]);
+var_dump($p[1]);
+?>
+--EXPECTF--
+string(8) "called-1"
+string(5) "ret-1"
+string(8) "called-1"
+string(5) "ret-1"
+string(8) "called-2"
+string(5) "ret-2"
+string(5) "ret-2"
\ No newline at end of file
diff --git a/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/013.phpt b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/013.phpt
new file mode 100644
index 0000000000..f419958c5f
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/013.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Test keys()
+--SKIPIF--
+
+--FILE--
+keys());
+
+$p['foo'] = 'bar';
+$p[] = 'foo';
+
+var_dump($p->keys());
+
+unset($p['foo']);
+
+var_dump($p->keys());
+?>
+--EXPECTF--
+array(0) {
+}
+array(2) {
+ [0]=>
+ string(3) "foo"
+ [1]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
\ No newline at end of file
diff --git a/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/014.phpt b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/014.phpt
new file mode 100644
index 0000000000..ac937213ac
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/014.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test raw()
+--SKIPIF--
+
+--FILE--
+raw('foo'));
+var_dump($p[42]);
+
+unset($p['foo']);
+
+try {
+ $p->raw('foo');
+ echo "expected exception";
+} catch (InvalidArgumentException $e) { }
+--EXPECTF--
+string(8) "called-2"
+string(5) "ret-2"
+object(Closure)#%i (0) {
+}
+string(8) "called-2"
+string(5) "ret-2"
\ No newline at end of file
diff --git a/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/015.phpt b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/015.phpt
new file mode 100644
index 0000000000..314f008ac1
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/015.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Test protect()
+--SKIPIF--
+
+--FILE--
+protect($f);
+
+var_dump($p['foo']);
+--EXPECTF--
+object(Closure)#%i (0) {
+}
\ No newline at end of file
diff --git a/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/016.phpt b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/016.phpt
new file mode 100644
index 0000000000..e55edb0a7a
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/016.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Test extend()
+--SKIPIF--
+
+--FILE--
+extend(12, function ($w) { var_dump($w); return 'bar'; }); /* $callable in code above */
+
+var_dump($c('param'));
+--EXPECTF--
+string(5) "param"
+string(3) "foo"
+string(3) "bar"
\ No newline at end of file
diff --git a/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/017.phpt b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/017.phpt
new file mode 100644
index 0000000000..bac23ce09a
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/017.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Test extend() with exception in service extension
+--SKIPIF--
+
+--FILE--
+extend(12, function ($w) { throw new BadMethodCallException; });
+
+try {
+ $p[12];
+ echo "Exception expected";
+} catch (BadMethodCallException $e) { }
+--EXPECTF--
diff --git a/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/017_1.phpt b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/017_1.phpt
new file mode 100644
index 0000000000..8f881d6ebf
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/017_1.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Test extend() with exception in service factory
+--SKIPIF--
+
+--FILE--
+extend(12, function ($w) { return 'foobar'; });
+
+try {
+ $p[12];
+ echo "Exception expected";
+} catch (BadMethodCallException $e) { }
+--EXPECTF--
diff --git a/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/018.phpt b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/018.phpt
new file mode 100644
index 0000000000..27c12a14e7
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/018.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Test register()
+--SKIPIF--
+
+--FILE--
+register(new Foo, array(42 => 'bar'));
+
+var_dump($p[42]);
+--EXPECTF--
+object(Pimple\Container)#1 (0) {
+}
+string(3) "bar"
\ No newline at end of file
diff --git a/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/019.phpt b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/019.phpt
new file mode 100644
index 0000000000..28a9aecac7
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/019.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Test register() returns static and is a fluent interface
+--SKIPIF--
+
+--FILE--
+register(new Foo));
+--EXPECTF--
+bool(true)
diff --git a/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/bench.phpb b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/bench.phpb
new file mode 100644
index 0000000000..8f983e656b
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/bench.phpb
@@ -0,0 +1,51 @@
+factory($factory);
+
+$p['factory'] = $factory;
+
+echo $p['factory'];
+echo $p['factory'];
+echo $p['factory'];
+
+}
+
+echo microtime(true) - $time;
diff --git a/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/bench_shared.phpb b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/bench_shared.phpb
new file mode 100644
index 0000000000..aec541f0bc
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/ext/pimple/tests/bench_shared.phpb
@@ -0,0 +1,25 @@
+
diff --git a/samples/server/petstore-security-test/slim/vendor/pimple/pimple/phpunit.xml.dist b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/phpunit.xml.dist
new file mode 100644
index 0000000000..5c8d487fea
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/phpunit.xml.dist
@@ -0,0 +1,14 @@
+
+
+
+
+
+ ./src/Pimple/Tests
+
+
+
diff --git a/samples/server/petstore-security-test/slim/vendor/pimple/pimple/src/Pimple/Container.php b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/src/Pimple/Container.php
new file mode 100644
index 0000000000..c976431e99
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/src/Pimple/Container.php
@@ -0,0 +1,282 @@
+factories = new \SplObjectStorage();
+ $this->protected = new \SplObjectStorage();
+
+ foreach ($values as $key => $value) {
+ $this->offsetSet($key, $value);
+ }
+ }
+
+ /**
+ * Sets a parameter or an object.
+ *
+ * Objects must be defined as Closures.
+ *
+ * Allowing any PHP callable leads to difficult to debug problems
+ * as function names (strings) are callable (creating a function with
+ * the same name as an existing parameter would break your container).
+ *
+ * @param string $id The unique identifier for the parameter or object
+ * @param mixed $value The value of the parameter or a closure to define an object
+ *
+ * @throws \RuntimeException Prevent override of a frozen service
+ */
+ public function offsetSet($id, $value)
+ {
+ if (isset($this->frozen[$id])) {
+ throw new \RuntimeException(sprintf('Cannot override frozen service "%s".', $id));
+ }
+
+ $this->values[$id] = $value;
+ $this->keys[$id] = true;
+ }
+
+ /**
+ * Gets a parameter or an object.
+ *
+ * @param string $id The unique identifier for the parameter or object
+ *
+ * @return mixed The value of the parameter or an object
+ *
+ * @throws \InvalidArgumentException if the identifier is not defined
+ */
+ public function offsetGet($id)
+ {
+ if (!isset($this->keys[$id])) {
+ throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id));
+ }
+
+ if (
+ isset($this->raw[$id])
+ || !is_object($this->values[$id])
+ || isset($this->protected[$this->values[$id]])
+ || !method_exists($this->values[$id], '__invoke')
+ ) {
+ return $this->values[$id];
+ }
+
+ if (isset($this->factories[$this->values[$id]])) {
+ return $this->values[$id]($this);
+ }
+
+ $raw = $this->values[$id];
+ $val = $this->values[$id] = $raw($this);
+ $this->raw[$id] = $raw;
+
+ $this->frozen[$id] = true;
+
+ return $val;
+ }
+
+ /**
+ * Checks if a parameter or an object is set.
+ *
+ * @param string $id The unique identifier for the parameter or object
+ *
+ * @return bool
+ */
+ public function offsetExists($id)
+ {
+ return isset($this->keys[$id]);
+ }
+
+ /**
+ * Unsets a parameter or an object.
+ *
+ * @param string $id The unique identifier for the parameter or object
+ */
+ public function offsetUnset($id)
+ {
+ if (isset($this->keys[$id])) {
+ if (is_object($this->values[$id])) {
+ unset($this->factories[$this->values[$id]], $this->protected[$this->values[$id]]);
+ }
+
+ unset($this->values[$id], $this->frozen[$id], $this->raw[$id], $this->keys[$id]);
+ }
+ }
+
+ /**
+ * Marks a callable as being a factory service.
+ *
+ * @param callable $callable A service definition to be used as a factory
+ *
+ * @return callable The passed callable
+ *
+ * @throws \InvalidArgumentException Service definition has to be a closure of an invokable object
+ */
+ public function factory($callable)
+ {
+ if (!method_exists($callable, '__invoke')) {
+ throw new \InvalidArgumentException('Service definition is not a Closure or invokable object.');
+ }
+
+ $this->factories->attach($callable);
+
+ return $callable;
+ }
+
+ /**
+ * Protects a callable from being interpreted as a service.
+ *
+ * This is useful when you want to store a callable as a parameter.
+ *
+ * @param callable $callable A callable to protect from being evaluated
+ *
+ * @return callable The passed callable
+ *
+ * @throws \InvalidArgumentException Service definition has to be a closure of an invokable object
+ */
+ public function protect($callable)
+ {
+ if (!method_exists($callable, '__invoke')) {
+ throw new \InvalidArgumentException('Callable is not a Closure or invokable object.');
+ }
+
+ $this->protected->attach($callable);
+
+ return $callable;
+ }
+
+ /**
+ * Gets a parameter or the closure defining an object.
+ *
+ * @param string $id The unique identifier for the parameter or object
+ *
+ * @return mixed The value of the parameter or the closure defining an object
+ *
+ * @throws \InvalidArgumentException if the identifier is not defined
+ */
+ public function raw($id)
+ {
+ if (!isset($this->keys[$id])) {
+ throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id));
+ }
+
+ if (isset($this->raw[$id])) {
+ return $this->raw[$id];
+ }
+
+ return $this->values[$id];
+ }
+
+ /**
+ * Extends an object definition.
+ *
+ * Useful when you want to extend an existing object definition,
+ * without necessarily loading that object.
+ *
+ * @param string $id The unique identifier for the object
+ * @param callable $callable A service definition to extend the original
+ *
+ * @return callable The wrapped callable
+ *
+ * @throws \InvalidArgumentException if the identifier is not defined or not a service definition
+ */
+ public function extend($id, $callable)
+ {
+ if (!isset($this->keys[$id])) {
+ throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id));
+ }
+
+ if (!is_object($this->values[$id]) || !method_exists($this->values[$id], '__invoke')) {
+ throw new \InvalidArgumentException(sprintf('Identifier "%s" does not contain an object definition.', $id));
+ }
+
+ if (!is_object($callable) || !method_exists($callable, '__invoke')) {
+ throw new \InvalidArgumentException('Extension service definition is not a Closure or invokable object.');
+ }
+
+ $factory = $this->values[$id];
+
+ $extended = function ($c) use ($callable, $factory) {
+ return $callable($factory($c), $c);
+ };
+
+ if (isset($this->factories[$factory])) {
+ $this->factories->detach($factory);
+ $this->factories->attach($extended);
+ }
+
+ return $this[$id] = $extended;
+ }
+
+ /**
+ * Returns all defined value names.
+ *
+ * @return array An array of value names
+ */
+ public function keys()
+ {
+ return array_keys($this->values);
+ }
+
+ /**
+ * Registers a service provider.
+ *
+ * @param ServiceProviderInterface $provider A ServiceProviderInterface instance
+ * @param array $values An array of values that customizes the provider
+ *
+ * @return static
+ */
+ public function register(ServiceProviderInterface $provider, array $values = array())
+ {
+ $provider->register($this);
+
+ foreach ($values as $key => $value) {
+ $this[$key] = $value;
+ }
+
+ return $this;
+ }
+}
diff --git a/samples/server/petstore-security-test/slim/vendor/pimple/pimple/src/Pimple/ServiceProviderInterface.php b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/src/Pimple/ServiceProviderInterface.php
new file mode 100644
index 0000000000..c004594baf
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/src/Pimple/ServiceProviderInterface.php
@@ -0,0 +1,46 @@
+value = $value;
+
+ return $service;
+ }
+}
diff --git a/samples/server/petstore-security-test/slim/vendor/pimple/pimple/src/Pimple/Tests/Fixtures/NonInvokable.php b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/src/Pimple/Tests/Fixtures/NonInvokable.php
new file mode 100644
index 0000000000..33cd4e5486
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/src/Pimple/Tests/Fixtures/NonInvokable.php
@@ -0,0 +1,34 @@
+factory(function () {
+ return new Service();
+ });
+ }
+}
diff --git a/samples/server/petstore-security-test/slim/vendor/pimple/pimple/src/Pimple/Tests/Fixtures/Service.php b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/src/Pimple/Tests/Fixtures/Service.php
new file mode 100644
index 0000000000..d71b184ddf
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/src/Pimple/Tests/Fixtures/Service.php
@@ -0,0 +1,35 @@
+
+ */
+class Service
+{
+ public $value;
+}
diff --git a/samples/server/petstore-security-test/slim/vendor/pimple/pimple/src/Pimple/Tests/PimpleServiceProviderInterfaceTest.php b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/src/Pimple/Tests/PimpleServiceProviderInterfaceTest.php
new file mode 100644
index 0000000000..8e5c4c73de
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/src/Pimple/Tests/PimpleServiceProviderInterfaceTest.php
@@ -0,0 +1,76 @@
+
+ */
+class PimpleServiceProviderInterfaceTest extends \PHPUnit_Framework_TestCase
+{
+ public function testProvider()
+ {
+ $pimple = new Container();
+
+ $pimpleServiceProvider = new Fixtures\PimpleServiceProvider();
+ $pimpleServiceProvider->register($pimple);
+
+ $this->assertEquals('value', $pimple['param']);
+ $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $pimple['service']);
+
+ $serviceOne = $pimple['factory'];
+ $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceOne);
+
+ $serviceTwo = $pimple['factory'];
+ $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceTwo);
+
+ $this->assertNotSame($serviceOne, $serviceTwo);
+ }
+
+ public function testProviderWithRegisterMethod()
+ {
+ $pimple = new Container();
+
+ $pimple->register(new Fixtures\PimpleServiceProvider(), array(
+ 'anotherParameter' => 'anotherValue',
+ ));
+
+ $this->assertEquals('value', $pimple['param']);
+ $this->assertEquals('anotherValue', $pimple['anotherParameter']);
+
+ $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $pimple['service']);
+
+ $serviceOne = $pimple['factory'];
+ $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceOne);
+
+ $serviceTwo = $pimple['factory'];
+ $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceTwo);
+
+ $this->assertNotSame($serviceOne, $serviceTwo);
+ }
+}
diff --git a/samples/server/petstore-security-test/slim/vendor/pimple/pimple/src/Pimple/Tests/PimpleTest.php b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/src/Pimple/Tests/PimpleTest.php
new file mode 100644
index 0000000000..918f620d88
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/pimple/pimple/src/Pimple/Tests/PimpleTest.php
@@ -0,0 +1,440 @@
+
+ */
+class PimpleTest extends \PHPUnit_Framework_TestCase
+{
+ public function testWithString()
+ {
+ $pimple = new Container();
+ $pimple['param'] = 'value';
+
+ $this->assertEquals('value', $pimple['param']);
+ }
+
+ public function testWithClosure()
+ {
+ $pimple = new Container();
+ $pimple['service'] = function () {
+ return new Fixtures\Service();
+ };
+
+ $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $pimple['service']);
+ }
+
+ public function testServicesShouldBeDifferent()
+ {
+ $pimple = new Container();
+ $pimple['service'] = $pimple->factory(function () {
+ return new Fixtures\Service();
+ });
+
+ $serviceOne = $pimple['service'];
+ $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceOne);
+
+ $serviceTwo = $pimple['service'];
+ $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceTwo);
+
+ $this->assertNotSame($serviceOne, $serviceTwo);
+ }
+
+ public function testShouldPassContainerAsParameter()
+ {
+ $pimple = new Container();
+ $pimple['service'] = function () {
+ return new Fixtures\Service();
+ };
+ $pimple['container'] = function ($container) {
+ return $container;
+ };
+
+ $this->assertNotSame($pimple, $pimple['service']);
+ $this->assertSame($pimple, $pimple['container']);
+ }
+
+ public function testIsset()
+ {
+ $pimple = new Container();
+ $pimple['param'] = 'value';
+ $pimple['service'] = function () {
+ return new Fixtures\Service();
+ };
+
+ $pimple['null'] = null;
+
+ $this->assertTrue(isset($pimple['param']));
+ $this->assertTrue(isset($pimple['service']));
+ $this->assertTrue(isset($pimple['null']));
+ $this->assertFalse(isset($pimple['non_existent']));
+ }
+
+ public function testConstructorInjection()
+ {
+ $params = array('param' => 'value');
+ $pimple = new Container($params);
+
+ $this->assertSame($params['param'], $pimple['param']);
+ }
+
+ /**
+ * @expectedException \InvalidArgumentException
+ * @expectedExceptionMessage Identifier "foo" is not defined.
+ */
+ public function testOffsetGetValidatesKeyIsPresent()
+ {
+ $pimple = new Container();
+ echo $pimple['foo'];
+ }
+
+ public function testOffsetGetHonorsNullValues()
+ {
+ $pimple = new Container();
+ $pimple['foo'] = null;
+ $this->assertNull($pimple['foo']);
+ }
+
+ public function testUnset()
+ {
+ $pimple = new Container();
+ $pimple['param'] = 'value';
+ $pimple['service'] = function () {
+ return new Fixtures\Service();
+ };
+
+ unset($pimple['param'], $pimple['service']);
+ $this->assertFalse(isset($pimple['param']));
+ $this->assertFalse(isset($pimple['service']));
+ }
+
+ /**
+ * @dataProvider serviceDefinitionProvider
+ */
+ public function testShare($service)
+ {
+ $pimple = new Container();
+ $pimple['shared_service'] = $service;
+
+ $serviceOne = $pimple['shared_service'];
+ $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceOne);
+
+ $serviceTwo = $pimple['shared_service'];
+ $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceTwo);
+
+ $this->assertSame($serviceOne, $serviceTwo);
+ }
+
+ /**
+ * @dataProvider serviceDefinitionProvider
+ */
+ public function testProtect($service)
+ {
+ $pimple = new Container();
+ $pimple['protected'] = $pimple->protect($service);
+
+ $this->assertSame($service, $pimple['protected']);
+ }
+
+ public function testGlobalFunctionNameAsParameterValue()
+ {
+ $pimple = new Container();
+ $pimple['global_function'] = 'strlen';
+ $this->assertSame('strlen', $pimple['global_function']);
+ }
+
+ public function testRaw()
+ {
+ $pimple = new Container();
+ $pimple['service'] = $definition = $pimple->factory(function () { return 'foo'; });
+ $this->assertSame($definition, $pimple->raw('service'));
+ }
+
+ public function testRawHonorsNullValues()
+ {
+ $pimple = new Container();
+ $pimple['foo'] = null;
+ $this->assertNull($pimple->raw('foo'));
+ }
+
+ public function testFluentRegister()
+ {
+ $pimple = new Container();
+ $this->assertSame($pimple, $pimple->register($this->getMock('Pimple\ServiceProviderInterface')));
+ }
+
+ /**
+ * @expectedException \InvalidArgumentException
+ * @expectedExceptionMessage Identifier "foo" is not defined.
+ */
+ public function testRawValidatesKeyIsPresent()
+ {
+ $pimple = new Container();
+ $pimple->raw('foo');
+ }
+
+ /**
+ * @dataProvider serviceDefinitionProvider
+ */
+ public function testExtend($service)
+ {
+ $pimple = new Container();
+ $pimple['shared_service'] = function () {
+ return new Fixtures\Service();
+ };
+ $pimple['factory_service'] = $pimple->factory(function () {
+ return new Fixtures\Service();
+ });
+
+ $pimple->extend('shared_service', $service);
+ $serviceOne = $pimple['shared_service'];
+ $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceOne);
+ $serviceTwo = $pimple['shared_service'];
+ $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceTwo);
+ $this->assertSame($serviceOne, $serviceTwo);
+ $this->assertSame($serviceOne->value, $serviceTwo->value);
+
+ $pimple->extend('factory_service', $service);
+ $serviceOne = $pimple['factory_service'];
+ $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceOne);
+ $serviceTwo = $pimple['factory_service'];
+ $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceTwo);
+ $this->assertNotSame($serviceOne, $serviceTwo);
+ $this->assertNotSame($serviceOne->value, $serviceTwo->value);
+ }
+
+ public function testExtendDoesNotLeakWithFactories()
+ {
+ if (extension_loaded('pimple')) {
+ $this->markTestSkipped('Pimple extension does not support this test');
+ }
+ $pimple = new Container();
+
+ $pimple['foo'] = $pimple->factory(function () { return; });
+ $pimple['foo'] = $pimple->extend('foo', function ($foo, $pimple) { return; });
+ unset($pimple['foo']);
+
+ $p = new \ReflectionProperty($pimple, 'values');
+ $p->setAccessible(true);
+ $this->assertEmpty($p->getValue($pimple));
+
+ $p = new \ReflectionProperty($pimple, 'factories');
+ $p->setAccessible(true);
+ $this->assertCount(0, $p->getValue($pimple));
+ }
+
+ /**
+ * @expectedException \InvalidArgumentException
+ * @expectedExceptionMessage Identifier "foo" is not defined.
+ */
+ public function testExtendValidatesKeyIsPresent()
+ {
+ $pimple = new Container();
+ $pimple->extend('foo', function () {});
+ }
+
+ public function testKeys()
+ {
+ $pimple = new Container();
+ $pimple['foo'] = 123;
+ $pimple['bar'] = 123;
+
+ $this->assertEquals(array('foo', 'bar'), $pimple->keys());
+ }
+
+ /** @test */
+ public function settingAnInvokableObjectShouldTreatItAsFactory()
+ {
+ $pimple = new Container();
+ $pimple['invokable'] = new Fixtures\Invokable();
+
+ $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $pimple['invokable']);
+ }
+
+ /** @test */
+ public function settingNonInvokableObjectShouldTreatItAsParameter()
+ {
+ $pimple = new Container();
+ $pimple['non_invokable'] = new Fixtures\NonInvokable();
+
+ $this->assertInstanceOf('Pimple\Tests\Fixtures\NonInvokable', $pimple['non_invokable']);
+ }
+
+ /**
+ * @dataProvider badServiceDefinitionProvider
+ * @expectedException \InvalidArgumentException
+ * @expectedExceptionMessage Service definition is not a Closure or invokable object.
+ */
+ public function testFactoryFailsForInvalidServiceDefinitions($service)
+ {
+ $pimple = new Container();
+ $pimple->factory($service);
+ }
+
+ /**
+ * @dataProvider badServiceDefinitionProvider
+ * @expectedException \InvalidArgumentException
+ * @expectedExceptionMessage Callable is not a Closure or invokable object.
+ */
+ public function testProtectFailsForInvalidServiceDefinitions($service)
+ {
+ $pimple = new Container();
+ $pimple->protect($service);
+ }
+
+ /**
+ * @dataProvider badServiceDefinitionProvider
+ * @expectedException \InvalidArgumentException
+ * @expectedExceptionMessage Identifier "foo" does not contain an object definition.
+ */
+ public function testExtendFailsForKeysNotContainingServiceDefinitions($service)
+ {
+ $pimple = new Container();
+ $pimple['foo'] = $service;
+ $pimple->extend('foo', function () {});
+ }
+
+ /**
+ * @dataProvider badServiceDefinitionProvider
+ * @expectedException \InvalidArgumentException
+ * @expectedExceptionMessage Extension service definition is not a Closure or invokable object.
+ */
+ public function testExtendFailsForInvalidServiceDefinitions($service)
+ {
+ $pimple = new Container();
+ $pimple['foo'] = function () {};
+ $pimple->extend('foo', $service);
+ }
+
+ /**
+ * Provider for invalid service definitions.
+ */
+ public function badServiceDefinitionProvider()
+ {
+ return array(
+ array(123),
+ array(new Fixtures\NonInvokable()),
+ );
+ }
+
+ /**
+ * Provider for service definitions.
+ */
+ public function serviceDefinitionProvider()
+ {
+ return array(
+ array(function ($value) {
+ $service = new Fixtures\Service();
+ $service->value = $value;
+
+ return $service;
+ }),
+ array(new Fixtures\Invokable()),
+ );
+ }
+
+ public function testDefiningNewServiceAfterFreeze()
+ {
+ $pimple = new Container();
+ $pimple['foo'] = function () {
+ return 'foo';
+ };
+ $foo = $pimple['foo'];
+
+ $pimple['bar'] = function () {
+ return 'bar';
+ };
+ $this->assertSame('bar', $pimple['bar']);
+ }
+
+ /**
+ * @expectedException \RuntimeException
+ * @expectedExceptionMessage Cannot override frozen service "foo".
+ */
+ public function testOverridingServiceAfterFreeze()
+ {
+ $pimple = new Container();
+ $pimple['foo'] = function () {
+ return 'foo';
+ };
+ $foo = $pimple['foo'];
+
+ $pimple['foo'] = function () {
+ return 'bar';
+ };
+ }
+
+ public function testRemovingServiceAfterFreeze()
+ {
+ $pimple = new Container();
+ $pimple['foo'] = function () {
+ return 'foo';
+ };
+ $foo = $pimple['foo'];
+
+ unset($pimple['foo']);
+ $pimple['foo'] = function () {
+ return 'bar';
+ };
+ $this->assertSame('bar', $pimple['foo']);
+ }
+
+ public function testExtendingService()
+ {
+ $pimple = new Container();
+ $pimple['foo'] = function () {
+ return 'foo';
+ };
+ $pimple['foo'] = $pimple->extend('foo', function ($foo, $app) {
+ return "$foo.bar";
+ });
+ $pimple['foo'] = $pimple->extend('foo', function ($foo, $app) {
+ return "$foo.baz";
+ });
+ $this->assertSame('foo.bar.baz', $pimple['foo']);
+ }
+
+ public function testExtendingServiceAfterOtherServiceFreeze()
+ {
+ $pimple = new Container();
+ $pimple['foo'] = function () {
+ return 'foo';
+ };
+ $pimple['bar'] = function () {
+ return 'bar';
+ };
+ $foo = $pimple['foo'];
+
+ $pimple['bar'] = $pimple->extend('bar', function ($bar, $app) {
+ return "$bar.baz";
+ });
+ $this->assertSame('bar.baz', $pimple['bar']);
+ }
+}
diff --git a/samples/server/petstore-security-test/slim/vendor/psr/http-message/LICENSE b/samples/server/petstore-security-test/slim/vendor/psr/http-message/LICENSE
new file mode 100644
index 0000000000..c2d8e452de
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/psr/http-message/LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2014 PHP Framework Interoperability Group
+
+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/samples/server/petstore-security-test/slim/vendor/psr/http-message/README.md b/samples/server/petstore-security-test/slim/vendor/psr/http-message/README.md
new file mode 100644
index 0000000000..28185338f7
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/psr/http-message/README.md
@@ -0,0 +1,13 @@
+PSR Http Message
+================
+
+This repository holds all interfaces/classes/traits related to
+[PSR-7](http://www.php-fig.org/psr/psr-7/).
+
+Note that this is not a HTTP message implementation of its own. It is merely an
+interface that describes a HTTP message. See the specification for more details.
+
+Usage
+-----
+
+We'll certainly need some stuff in here.
\ No newline at end of file
diff --git a/samples/server/petstore-security-test/slim/vendor/psr/http-message/composer.json b/samples/server/petstore-security-test/slim/vendor/psr/http-message/composer.json
new file mode 100644
index 0000000000..4774b61262
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/psr/http-message/composer.json
@@ -0,0 +1,25 @@
+{
+ "name": "psr/http-message",
+ "description": "Common interface for HTTP messages",
+ "keywords": ["psr", "psr-7", "http", "http-message", "request", "response"],
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "http://www.php-fig.org/"
+ }
+ ],
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Http\\Message\\": "src/"
+ }
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ }
+}
diff --git a/samples/server/petstore-security-test/slim/vendor/psr/http-message/src/MessageInterface.php b/samples/server/petstore-security-test/slim/vendor/psr/http-message/src/MessageInterface.php
new file mode 100644
index 0000000000..8f67a050e8
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/psr/http-message/src/MessageInterface.php
@@ -0,0 +1,187 @@
+getHeaders() as $name => $values) {
+ * echo $name . ": " . implode(", ", $values);
+ * }
+ *
+ * // Emit headers iteratively:
+ * foreach ($message->getHeaders() as $name => $values) {
+ * foreach ($values as $value) {
+ * header(sprintf('%s: %s', $name, $value), false);
+ * }
+ * }
+ *
+ * While header names are not case-sensitive, getHeaders() will preserve the
+ * exact case in which headers were originally specified.
+ *
+ * @return array Returns an associative array of the message's headers. Each
+ * key MUST be a header name, and each value MUST be an array of strings
+ * for that header.
+ */
+ public function getHeaders();
+
+ /**
+ * Checks if a header exists by the given case-insensitive name.
+ *
+ * @param string $name Case-insensitive header field name.
+ * @return bool Returns true if any header names match the given header
+ * name using a case-insensitive string comparison. Returns false if
+ * no matching header name is found in the message.
+ */
+ public function hasHeader($name);
+
+ /**
+ * Retrieves a message header value by the given case-insensitive name.
+ *
+ * This method returns an array of all the header values of the given
+ * case-insensitive header name.
+ *
+ * If the header does not appear in the message, this method MUST return an
+ * empty array.
+ *
+ * @param string $name Case-insensitive header field name.
+ * @return string[] An array of string values as provided for the given
+ * header. If the header does not appear in the message, this method MUST
+ * return an empty array.
+ */
+ public function getHeader($name);
+
+ /**
+ * Retrieves a comma-separated string of the values for a single header.
+ *
+ * This method returns all of the header values of the given
+ * case-insensitive header name as a string concatenated together using
+ * a comma.
+ *
+ * NOTE: Not all header values may be appropriately represented using
+ * comma concatenation. For such headers, use getHeader() instead
+ * and supply your own delimiter when concatenating.
+ *
+ * If the header does not appear in the message, this method MUST return
+ * an empty string.
+ *
+ * @param string $name Case-insensitive header field name.
+ * @return string A string of values as provided for the given header
+ * concatenated together using a comma. If the header does not appear in
+ * the message, this method MUST return an empty string.
+ */
+ public function getHeaderLine($name);
+
+ /**
+ * Return an instance with the provided value replacing the specified header.
+ *
+ * While header names are case-insensitive, the casing of the header will
+ * be preserved by this function, and returned from getHeaders().
+ *
+ * This method MUST be implemented in such a way as to retain the
+ * immutability of the message, and MUST return an instance that has the
+ * new and/or updated header and value.
+ *
+ * @param string $name Case-insensitive header field name.
+ * @param string|string[] $value Header value(s).
+ * @return self
+ * @throws \InvalidArgumentException for invalid header names or values.
+ */
+ public function withHeader($name, $value);
+
+ /**
+ * Return an instance with the specified header appended with the given value.
+ *
+ * Existing values for the specified header will be maintained. The new
+ * value(s) will be appended to the existing list. If the header did not
+ * exist previously, it will be added.
+ *
+ * This method MUST be implemented in such a way as to retain the
+ * immutability of the message, and MUST return an instance that has the
+ * new header and/or value.
+ *
+ * @param string $name Case-insensitive header field name to add.
+ * @param string|string[] $value Header value(s).
+ * @return self
+ * @throws \InvalidArgumentException for invalid header names or values.
+ */
+ public function withAddedHeader($name, $value);
+
+ /**
+ * Return an instance without the specified header.
+ *
+ * Header resolution MUST be done without case-sensitivity.
+ *
+ * This method MUST be implemented in such a way as to retain the
+ * immutability of the message, and MUST return an instance that removes
+ * the named header.
+ *
+ * @param string $name Case-insensitive header field name to remove.
+ * @return self
+ */
+ public function withoutHeader($name);
+
+ /**
+ * Gets the body of the message.
+ *
+ * @return StreamInterface Returns the body as a stream.
+ */
+ public function getBody();
+
+ /**
+ * Return an instance with the specified message body.
+ *
+ * The body MUST be a StreamInterface object.
+ *
+ * This method MUST be implemented in such a way as to retain the
+ * immutability of the message, and MUST return a new instance that has the
+ * new body stream.
+ *
+ * @param StreamInterface $body Body.
+ * @return self
+ * @throws \InvalidArgumentException When the body is not valid.
+ */
+ public function withBody(StreamInterface $body);
+}
diff --git a/samples/server/petstore-security-test/slim/vendor/psr/http-message/src/RequestInterface.php b/samples/server/petstore-security-test/slim/vendor/psr/http-message/src/RequestInterface.php
new file mode 100644
index 0000000000..75c802e292
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/psr/http-message/src/RequestInterface.php
@@ -0,0 +1,129 @@
+getQuery()`
+ * or from the `QUERY_STRING` server param.
+ *
+ * @return array
+ */
+ public function getQueryParams();
+
+ /**
+ * Return an instance with the specified query string arguments.
+ *
+ * These values SHOULD remain immutable over the course of the incoming
+ * request. They MAY be injected during instantiation, such as from PHP's
+ * $_GET superglobal, or MAY be derived from some other value such as the
+ * URI. In cases where the arguments are parsed from the URI, the data
+ * MUST be compatible with what PHP's parse_str() would return for
+ * purposes of how duplicate query parameters are handled, and how nested
+ * sets are handled.
+ *
+ * Setting query string arguments MUST NOT change the URI stored by the
+ * request, nor the values in the server params.
+ *
+ * This method MUST be implemented in such a way as to retain the
+ * immutability of the message, and MUST return an instance that has the
+ * updated query string arguments.
+ *
+ * @param array $query Array of query string arguments, typically from
+ * $_GET.
+ * @return self
+ */
+ public function withQueryParams(array $query);
+
+ /**
+ * Retrieve normalized file upload data.
+ *
+ * This method returns upload metadata in a normalized tree, with each leaf
+ * an instance of Psr\Http\Message\UploadedFileInterface.
+ *
+ * These values MAY be prepared from $_FILES or the message body during
+ * instantiation, or MAY be injected via withUploadedFiles().
+ *
+ * @return array An array tree of UploadedFileInterface instances; an empty
+ * array MUST be returned if no data is present.
+ */
+ public function getUploadedFiles();
+
+ /**
+ * Create a new instance with the specified uploaded files.
+ *
+ * This method MUST be implemented in such a way as to retain the
+ * immutability of the message, and MUST return an instance that has the
+ * updated body parameters.
+ *
+ * @param array An array tree of UploadedFileInterface instances.
+ * @return self
+ * @throws \InvalidArgumentException if an invalid structure is provided.
+ */
+ public function withUploadedFiles(array $uploadedFiles);
+
+ /**
+ * Retrieve any parameters provided in the request body.
+ *
+ * If the request Content-Type is either application/x-www-form-urlencoded
+ * or multipart/form-data, and the request method is POST, this method MUST
+ * return the contents of $_POST.
+ *
+ * Otherwise, this method may return any results of deserializing
+ * the request body content; as parsing returns structured content, the
+ * potential types MUST be arrays or objects only. A null value indicates
+ * the absence of body content.
+ *
+ * @return null|array|object The deserialized body parameters, if any.
+ * These will typically be an array or object.
+ */
+ public function getParsedBody();
+
+ /**
+ * Return an instance with the specified body parameters.
+ *
+ * These MAY be injected during instantiation.
+ *
+ * If the request Content-Type is either application/x-www-form-urlencoded
+ * or multipart/form-data, and the request method is POST, use this method
+ * ONLY to inject the contents of $_POST.
+ *
+ * The data IS NOT REQUIRED to come from $_POST, but MUST be the results of
+ * deserializing the request body content. Deserialization/parsing returns
+ * structured data, and, as such, this method ONLY accepts arrays or objects,
+ * or a null value if nothing was available to parse.
+ *
+ * As an example, if content negotiation determines that the request data
+ * is a JSON payload, this method could be used to create a request
+ * instance with the deserialized parameters.
+ *
+ * This method MUST be implemented in such a way as to retain the
+ * immutability of the message, and MUST return an instance that has the
+ * updated body parameters.
+ *
+ * @param null|array|object $data The deserialized body data. This will
+ * typically be in an array or object.
+ * @return self
+ * @throws \InvalidArgumentException if an unsupported argument type is
+ * provided.
+ */
+ public function withParsedBody($data);
+
+ /**
+ * Retrieve attributes derived from the request.
+ *
+ * The request "attributes" may be used to allow injection of any
+ * parameters derived from the request: e.g., the results of path
+ * match operations; the results of decrypting cookies; the results of
+ * deserializing non-form-encoded message bodies; etc. Attributes
+ * will be application and request specific, and CAN be mutable.
+ *
+ * @return array Attributes derived from the request.
+ */
+ public function getAttributes();
+
+ /**
+ * Retrieve a single derived request attribute.
+ *
+ * Retrieves a single derived request attribute as described in
+ * getAttributes(). If the attribute has not been previously set, returns
+ * the default value as provided.
+ *
+ * This method obviates the need for a hasAttribute() method, as it allows
+ * specifying a default value to return if the attribute is not found.
+ *
+ * @see getAttributes()
+ * @param string $name The attribute name.
+ * @param mixed $default Default value to return if the attribute does not exist.
+ * @return mixed
+ */
+ public function getAttribute($name, $default = null);
+
+ /**
+ * Return an instance with the specified derived request attribute.
+ *
+ * This method allows setting a single derived request attribute as
+ * described in getAttributes().
+ *
+ * This method MUST be implemented in such a way as to retain the
+ * immutability of the message, and MUST return an instance that has the
+ * updated attribute.
+ *
+ * @see getAttributes()
+ * @param string $name The attribute name.
+ * @param mixed $value The value of the attribute.
+ * @return self
+ */
+ public function withAttribute($name, $value);
+
+ /**
+ * Return an instance that removes the specified derived request attribute.
+ *
+ * This method allows removing a single derived request attribute as
+ * described in getAttributes().
+ *
+ * This method MUST be implemented in such a way as to retain the
+ * immutability of the message, and MUST return an instance that removes
+ * the attribute.
+ *
+ * @see getAttributes()
+ * @param string $name The attribute name.
+ * @return self
+ */
+ public function withoutAttribute($name);
+}
diff --git a/samples/server/petstore-security-test/slim/vendor/psr/http-message/src/StreamInterface.php b/samples/server/petstore-security-test/slim/vendor/psr/http-message/src/StreamInterface.php
new file mode 100644
index 0000000000..f68f391269
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/psr/http-message/src/StreamInterface.php
@@ -0,0 +1,158 @@
+
+ * [user-info@]host[:port]
+ *
+ *
+ * If the port component is not set or is the standard port for the current
+ * scheme, it SHOULD NOT be included.
+ *
+ * @see https://tools.ietf.org/html/rfc3986#section-3.2
+ * @return string The URI authority, in "[user-info@]host[:port]" format.
+ */
+ public function getAuthority();
+
+ /**
+ * Retrieve the user information component of the URI.
+ *
+ * If no user information is present, this method MUST return an empty
+ * string.
+ *
+ * If a user is present in the URI, this will return that value;
+ * additionally, if the password is also present, it will be appended to the
+ * user value, with a colon (":") separating the values.
+ *
+ * The trailing "@" character is not part of the user information and MUST
+ * NOT be added.
+ *
+ * @return string The URI user information, in "username[:password]" format.
+ */
+ public function getUserInfo();
+
+ /**
+ * Retrieve the host component of the URI.
+ *
+ * If no host is present, this method MUST return an empty string.
+ *
+ * The value returned MUST be normalized to lowercase, per RFC 3986
+ * Section 3.2.2.
+ *
+ * @see http://tools.ietf.org/html/rfc3986#section-3.2.2
+ * @return string The URI host.
+ */
+ public function getHost();
+
+ /**
+ * Retrieve the port component of the URI.
+ *
+ * If a port is present, and it is non-standard for the current scheme,
+ * this method MUST return it as an integer. If the port is the standard port
+ * used with the current scheme, this method SHOULD return null.
+ *
+ * If no port is present, and no scheme is present, this method MUST return
+ * a null value.
+ *
+ * If no port is present, but a scheme is present, this method MAY return
+ * the standard port for that scheme, but SHOULD return null.
+ *
+ * @return null|int The URI port.
+ */
+ public function getPort();
+
+ /**
+ * Retrieve the path component of the URI.
+ *
+ * The path can either be empty or absolute (starting with a slash) or
+ * rootless (not starting with a slash). Implementations MUST support all
+ * three syntaxes.
+ *
+ * Normally, the empty path "" and absolute path "/" are considered equal as
+ * defined in RFC 7230 Section 2.7.3. But this method MUST NOT automatically
+ * do this normalization because in contexts with a trimmed base path, e.g.
+ * the front controller, this difference becomes significant. It's the task
+ * of the user to handle both "" and "/".
+ *
+ * The value returned MUST be percent-encoded, but MUST NOT double-encode
+ * any characters. To determine what characters to encode, please refer to
+ * RFC 3986, Sections 2 and 3.3.
+ *
+ * As an example, if the value should include a slash ("/") not intended as
+ * delimiter between path segments, that value MUST be passed in encoded
+ * form (e.g., "%2F") to the instance.
+ *
+ * @see https://tools.ietf.org/html/rfc3986#section-2
+ * @see https://tools.ietf.org/html/rfc3986#section-3.3
+ * @return string The URI path.
+ */
+ public function getPath();
+
+ /**
+ * Retrieve the query string of the URI.
+ *
+ * If no query string is present, this method MUST return an empty string.
+ *
+ * The leading "?" character is not part of the query and MUST NOT be
+ * added.
+ *
+ * The value returned MUST be percent-encoded, but MUST NOT double-encode
+ * any characters. To determine what characters to encode, please refer to
+ * RFC 3986, Sections 2 and 3.4.
+ *
+ * As an example, if a value in a key/value pair of the query string should
+ * include an ampersand ("&") not intended as a delimiter between values,
+ * that value MUST be passed in encoded form (e.g., "%26") to the instance.
+ *
+ * @see https://tools.ietf.org/html/rfc3986#section-2
+ * @see https://tools.ietf.org/html/rfc3986#section-3.4
+ * @return string The URI query string.
+ */
+ public function getQuery();
+
+ /**
+ * Retrieve the fragment component of the URI.
+ *
+ * If no fragment is present, this method MUST return an empty string.
+ *
+ * The leading "#" character is not part of the fragment and MUST NOT be
+ * added.
+ *
+ * The value returned MUST be percent-encoded, but MUST NOT double-encode
+ * any characters. To determine what characters to encode, please refer to
+ * RFC 3986, Sections 2 and 3.5.
+ *
+ * @see https://tools.ietf.org/html/rfc3986#section-2
+ * @see https://tools.ietf.org/html/rfc3986#section-3.5
+ * @return string The URI fragment.
+ */
+ public function getFragment();
+
+ /**
+ * Return an instance with the specified scheme.
+ *
+ * This method MUST retain the state of the current instance, and return
+ * an instance that contains the specified scheme.
+ *
+ * Implementations MUST support the schemes "http" and "https" case
+ * insensitively, and MAY accommodate other schemes if required.
+ *
+ * An empty scheme is equivalent to removing the scheme.
+ *
+ * @param string $scheme The scheme to use with the new instance.
+ * @return self A new instance with the specified scheme.
+ * @throws \InvalidArgumentException for invalid or unsupported schemes.
+ */
+ public function withScheme($scheme);
+
+ /**
+ * Return an instance with the specified user information.
+ *
+ * This method MUST retain the state of the current instance, and return
+ * an instance that contains the specified user information.
+ *
+ * Password is optional, but the user information MUST include the
+ * user; an empty string for the user is equivalent to removing user
+ * information.
+ *
+ * @param string $user The user name to use for authority.
+ * @param null|string $password The password associated with $user.
+ * @return self A new instance with the specified user information.
+ */
+ public function withUserInfo($user, $password = null);
+
+ /**
+ * Return an instance with the specified host.
+ *
+ * This method MUST retain the state of the current instance, and return
+ * an instance that contains the specified host.
+ *
+ * An empty host value is equivalent to removing the host.
+ *
+ * @param string $host The hostname to use with the new instance.
+ * @return self A new instance with the specified host.
+ * @throws \InvalidArgumentException for invalid hostnames.
+ */
+ public function withHost($host);
+
+ /**
+ * Return an instance with the specified port.
+ *
+ * This method MUST retain the state of the current instance, and return
+ * an instance that contains the specified port.
+ *
+ * Implementations MUST raise an exception for ports outside the
+ * established TCP and UDP port ranges.
+ *
+ * A null value provided for the port is equivalent to removing the port
+ * information.
+ *
+ * @param null|int $port The port to use with the new instance; a null value
+ * removes the port information.
+ * @return self A new instance with the specified port.
+ * @throws \InvalidArgumentException for invalid ports.
+ */
+ public function withPort($port);
+
+ /**
+ * Return an instance with the specified path.
+ *
+ * This method MUST retain the state of the current instance, and return
+ * an instance that contains the specified path.
+ *
+ * The path can either be empty or absolute (starting with a slash) or
+ * rootless (not starting with a slash). Implementations MUST support all
+ * three syntaxes.
+ *
+ * If the path is intended to be domain-relative rather than path relative then
+ * it must begin with a slash ("/"). Paths not starting with a slash ("/")
+ * are assumed to be relative to some base path known to the application or
+ * consumer.
+ *
+ * Users can provide both encoded and decoded path characters.
+ * Implementations ensure the correct encoding as outlined in getPath().
+ *
+ * @param string $path The path to use with the new instance.
+ * @return self A new instance with the specified path.
+ * @throws \InvalidArgumentException for invalid paths.
+ */
+ public function withPath($path);
+
+ /**
+ * Return an instance with the specified query string.
+ *
+ * This method MUST retain the state of the current instance, and return
+ * an instance that contains the specified query string.
+ *
+ * Users can provide both encoded and decoded query characters.
+ * Implementations ensure the correct encoding as outlined in getQuery().
+ *
+ * An empty query string value is equivalent to removing the query string.
+ *
+ * @param string $query The query string to use with the new instance.
+ * @return self A new instance with the specified query string.
+ * @throws \InvalidArgumentException for invalid query strings.
+ */
+ public function withQuery($query);
+
+ /**
+ * Return an instance with the specified URI fragment.
+ *
+ * This method MUST retain the state of the current instance, and return
+ * an instance that contains the specified URI fragment.
+ *
+ * Users can provide both encoded and decoded fragment characters.
+ * Implementations ensure the correct encoding as outlined in getFragment().
+ *
+ * An empty fragment value is equivalent to removing the fragment.
+ *
+ * @param string $fragment The fragment to use with the new instance.
+ * @return self A new instance with the specified fragment.
+ */
+ public function withFragment($fragment);
+
+ /**
+ * Return the string representation as a URI reference.
+ *
+ * Depending on which components of the URI are present, the resulting
+ * string is either a full URI or relative reference according to RFC 3986,
+ * Section 4.1. The method concatenates the various components of the URI,
+ * using the appropriate delimiters:
+ *
+ * - If a scheme is present, it MUST be suffixed by ":".
+ * - If an authority is present, it MUST be prefixed by "//".
+ * - The path can be concatenated without delimiters. But there are two
+ * cases where the path has to be adjusted to make the URI reference
+ * valid as PHP does not allow to throw an exception in __toString():
+ * - If the path is rootless and an authority is present, the path MUST
+ * be prefixed by "/".
+ * - If the path is starting with more than one "/" and no authority is
+ * present, the starting slashes MUST be reduced to one.
+ * - If a query is present, it MUST be prefixed by "?".
+ * - If a fragment is present, it MUST be prefixed by "#".
+ *
+ * @see http://tools.ietf.org/html/rfc3986#section-4.1
+ * @return string
+ */
+ public function __toString();
+}
diff --git a/samples/server/petstore-security-test/slim/vendor/slim/slim/CONTRIBUTING.md b/samples/server/petstore-security-test/slim/vendor/slim/slim/CONTRIBUTING.md
new file mode 100644
index 0000000000..9bbb6b17ca
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/slim/slim/CONTRIBUTING.md
@@ -0,0 +1,20 @@
+# How to Contribute
+
+## Pull Requests
+
+1. Fork the Slim Framework repository
+2. Create a new branch for each feature or improvement
+3. Send a pull request from each feature branch to the **develop** branch
+
+It is very important to separate new features or improvements into separate feature branches, and to send a
+pull request for each branch. This allows me to review and pull in new features or improvements individually.
+
+## Style Guide
+
+All pull requests must adhere to the [PSR-2 standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md).
+
+## Unit Testing
+
+All pull requests must be accompanied by passing unit tests and complete code coverage. The Slim Framework uses phpunit for testing.
+
+[Learn about PHPUnit](https://github.com/sebastianbergmann/phpunit/)
diff --git a/samples/server/petstore-security-test/slim/vendor/slim/slim/LICENSE.md b/samples/server/petstore-security-test/slim/vendor/slim/slim/LICENSE.md
new file mode 100644
index 0000000000..0875f84f90
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/slim/slim/LICENSE.md
@@ -0,0 +1,19 @@
+Copyright (c) 2011-2016 Josh Lockhart
+
+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/samples/server/petstore-security-test/slim/vendor/slim/slim/README.md b/samples/server/petstore-security-test/slim/vendor/slim/slim/README.md
new file mode 100644
index 0000000000..d20f3939d1
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/slim/slim/README.md
@@ -0,0 +1,84 @@
+# Slim Framework
+
+[![Build Status](https://travis-ci.org/slimphp/Slim.svg?branch=develop)](https://travis-ci.org/slimphp/Slim)
+[![Coverage Status](https://coveralls.io/repos/slimphp/Slim/badge.svg)](https://coveralls.io/r/slimphp/Slim)
+[![Total Downloads](https://poser.pugx.org/slim/slim/downloads)](https://packagist.org/packages/slim/slim)
+[![License](https://poser.pugx.org/slim/slim/license)](https://packagist.org/packages/slim/slim)
+
+Slim is a PHP micro-framework that helps you quickly write simple yet powerful web applications and APIs.
+
+## Installation
+
+It's recommended that you use [Composer](https://getcomposer.org/) to install Slim.
+
+```bash
+$ composer require slim/slim "^3.0"
+```
+
+This will install Slim and all required dependencies. Slim requires PHP 5.5.0 or newer.
+
+## Usage
+
+Create an index.php file with the following contents:
+
+```php
+get('/hello/{name}', function ($request, $response, $args) {
+ $response->write("Hello, " . $args['name']);
+ return $response;
+});
+
+$app->run();
+```
+
+You may quickly test this using the built-in PHP server:
+```bash
+$ php -S localhost:8000
+```
+
+Going to http://localhost:8000/hello/world will now display "Hello, world".
+
+For more information on how to configure your web server, see the [Documentation](http://www.slimframework.com/docs/start/web-servers.html).
+
+## Tests
+
+To execute the test suite, you'll need phpunit.
+
+```bash
+$ phpunit
+```
+
+## Contributing
+
+Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
+
+## Learn More
+
+Learn more at these links:
+
+- [Website](http://www.slimframework.com)
+- [Documentation](http://www.slimframework.com/docs/start/installation.html)
+- [Support Forum](http://help.slimframework.com)
+- [Twitter](https://twitter.com/slimphp)
+- [Resources](https://github.com/xssc/awesome-slim)
+
+## Security
+
+If you discover security related issues, please email security@slimframework.com instead of using the issue tracker.
+
+## Credits
+
+- [Josh Lockhart](https://github.com/codeguy)
+- [Andrew Smith](https://github.com/silentworks)
+- [Rob Allen](https://github.com/akrabat)
+- [Gabriel Manricks](https://github.com/gmanricks)
+- [All Contributors](../../contributors)
+
+## License
+
+The Slim Framework is licensed under the MIT license. See [License File](LICENSE.md) for more information.
diff --git a/samples/server/petstore-security-test/slim/vendor/slim/slim/Slim/App.php b/samples/server/petstore-security-test/slim/vendor/slim/slim/Slim/App.php
new file mode 100644
index 0000000000..96d82cb81f
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/slim/slim/Slim/App.php
@@ -0,0 +1,644 @@
+container = $container;
+ }
+
+ /**
+ * Enable access to the DI container by consumers of $app
+ *
+ * @return ContainerInterface
+ */
+ public function getContainer()
+ {
+ return $this->container;
+ }
+
+ /**
+ * Add middleware
+ *
+ * This method prepends new middleware to the app's middleware stack.
+ *
+ * @param callable|string $callable The callback routine
+ *
+ * @return static
+ */
+ public function add($callable)
+ {
+ return $this->addMiddleware(new DeferredCallable($callable, $this->container));
+ }
+
+ /**
+ * Calling a non-existant method on App checks to see if there's an item
+ * in the container that is callable and if so, calls it.
+ *
+ * @param string $method
+ * @param array $args
+ * @return mixed
+ */
+ public function __call($method, $args)
+ {
+ if ($this->container->has($method)) {
+ $obj = $this->container->get($method);
+ if (is_callable($obj)) {
+ return call_user_func_array($obj, $args);
+ }
+ }
+
+ throw new \BadMethodCallException("Method $method is not a valid method");
+ }
+
+ /********************************************************************************
+ * Router proxy methods
+ *******************************************************************************/
+
+ /**
+ * Add GET route
+ *
+ * @param string $pattern The route URI pattern
+ * @param callable|string $callable The route callback routine
+ *
+ * @return \Slim\Interfaces\RouteInterface
+ */
+ public function get($pattern, $callable)
+ {
+ return $this->map(['GET'], $pattern, $callable);
+ }
+
+ /**
+ * Add POST route
+ *
+ * @param string $pattern The route URI pattern
+ * @param callable|string $callable The route callback routine
+ *
+ * @return \Slim\Interfaces\RouteInterface
+ */
+ public function post($pattern, $callable)
+ {
+ return $this->map(['POST'], $pattern, $callable);
+ }
+
+ /**
+ * Add PUT route
+ *
+ * @param string $pattern The route URI pattern
+ * @param callable|string $callable The route callback routine
+ *
+ * @return \Slim\Interfaces\RouteInterface
+ */
+ public function put($pattern, $callable)
+ {
+ return $this->map(['PUT'], $pattern, $callable);
+ }
+
+ /**
+ * Add PATCH route
+ *
+ * @param string $pattern The route URI pattern
+ * @param callable|string $callable The route callback routine
+ *
+ * @return \Slim\Interfaces\RouteInterface
+ */
+ public function patch($pattern, $callable)
+ {
+ return $this->map(['PATCH'], $pattern, $callable);
+ }
+
+ /**
+ * Add DELETE route
+ *
+ * @param string $pattern The route URI pattern
+ * @param callable|string $callable The route callback routine
+ *
+ * @return \Slim\Interfaces\RouteInterface
+ */
+ public function delete($pattern, $callable)
+ {
+ return $this->map(['DELETE'], $pattern, $callable);
+ }
+
+ /**
+ * Add OPTIONS route
+ *
+ * @param string $pattern The route URI pattern
+ * @param callable|string $callable The route callback routine
+ *
+ * @return \Slim\Interfaces\RouteInterface
+ */
+ public function options($pattern, $callable)
+ {
+ return $this->map(['OPTIONS'], $pattern, $callable);
+ }
+
+ /**
+ * Add route for any HTTP method
+ *
+ * @param string $pattern The route URI pattern
+ * @param callable|string $callable The route callback routine
+ *
+ * @return \Slim\Interfaces\RouteInterface
+ */
+ public function any($pattern, $callable)
+ {
+ return $this->map(['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'], $pattern, $callable);
+ }
+
+ /**
+ * Add route with multiple methods
+ *
+ * @param string[] $methods Numeric array of HTTP method names
+ * @param string $pattern The route URI pattern
+ * @param callable|string $callable The route callback routine
+ *
+ * @return RouteInterface
+ */
+ public function map(array $methods, $pattern, $callable)
+ {
+ if ($callable instanceof Closure) {
+ $callable = $callable->bindTo($this->container);
+ }
+
+ $route = $this->container->get('router')->map($methods, $pattern, $callable);
+ if (is_callable([$route, 'setContainer'])) {
+ $route->setContainer($this->container);
+ }
+
+ if (is_callable([$route, 'setOutputBuffering'])) {
+ $route->setOutputBuffering($this->container->get('settings')['outputBuffering']);
+ }
+
+ return $route;
+ }
+
+ /**
+ * Route Groups
+ *
+ * This method accepts a route pattern and a callback. All route
+ * declarations in the callback will be prepended by the group(s)
+ * that it is in.
+ *
+ * @param string $pattern
+ * @param callable $callable
+ *
+ * @return RouteGroupInterface
+ */
+ public function group($pattern, $callable)
+ {
+ /** @var RouteGroup $group */
+ $group = $this->container->get('router')->pushGroup($pattern, $callable);
+ $group->setContainer($this->container);
+ $group($this);
+ $this->container->get('router')->popGroup();
+ return $group;
+ }
+
+ /********************************************************************************
+ * Runner
+ *******************************************************************************/
+
+ /**
+ * Run application
+ *
+ * This method traverses the application middleware stack and then sends the
+ * resultant Response object to the HTTP client.
+ *
+ * @param bool|false $silent
+ * @return ResponseInterface
+ *
+ * @throws Exception
+ * @throws MethodNotAllowedException
+ * @throws NotFoundException
+ */
+ public function run($silent = false)
+ {
+ $request = $this->container->get('request');
+ $response = $this->container->get('response');
+
+ $response = $this->process($request, $response);
+
+ if (!$silent) {
+ $this->respond($response);
+ }
+
+ return $response;
+ }
+
+ /**
+ * Process a request
+ *
+ * This method traverses the application middleware stack and then returns the
+ * resultant Response object.
+ *
+ * @param ServerRequestInterface $request
+ * @param ResponseInterface $response
+ * @return ResponseInterface
+ *
+ * @throws Exception
+ * @throws MethodNotAllowedException
+ * @throws NotFoundException
+ */
+ public function process(ServerRequestInterface $request, ResponseInterface $response)
+ {
+ // Ensure basePath is set
+ $router = $this->container->get('router');
+ if (is_callable([$request->getUri(), 'getBasePath']) && is_callable([$router, 'setBasePath'])) {
+ $router->setBasePath($request->getUri()->getBasePath());
+ }
+
+ // Dispatch the Router first if the setting for this is on
+ if ($this->container->get('settings')['determineRouteBeforeAppMiddleware'] === true) {
+ // Dispatch router (note: you won't be able to alter routes after this)
+ $request = $this->dispatchRouterAndPrepareRoute($request, $router);
+ }
+
+ // Traverse middleware stack
+ try {
+ $response = $this->callMiddlewareStack($request, $response);
+ } catch (Exception $e) {
+ $response = $this->handleException($e, $request, $response);
+ } catch (Throwable $e) {
+ $response = $this->handlePhpError($e, $request, $response);
+ }
+
+ $response = $this->finalize($response);
+
+ return $response;
+ }
+
+ /**
+ * Send the response the client
+ *
+ * @param ResponseInterface $response
+ */
+ public function respond(ResponseInterface $response)
+ {
+ // Send response
+ if (!headers_sent()) {
+ // Status
+ header(sprintf(
+ 'HTTP/%s %s %s',
+ $response->getProtocolVersion(),
+ $response->getStatusCode(),
+ $response->getReasonPhrase()
+ ));
+
+ // Headers
+ foreach ($response->getHeaders() as $name => $values) {
+ foreach ($values as $value) {
+ header(sprintf('%s: %s', $name, $value), false);
+ }
+ }
+ }
+
+ // Body
+ if (!$this->isEmptyResponse($response)) {
+ $body = $response->getBody();
+ if ($body->isSeekable()) {
+ $body->rewind();
+ }
+ $settings = $this->container->get('settings');
+ $chunkSize = $settings['responseChunkSize'];
+
+ $contentLength = $response->getHeaderLine('Content-Length');
+ if (!$contentLength) {
+ $contentLength = $body->getSize();
+ }
+
+
+ if (isset($contentLength)) {
+ $amountToRead = $contentLength;
+ while ($amountToRead > 0 && !$body->eof()) {
+ $data = $body->read(min($chunkSize, $amountToRead));
+ echo $data;
+
+ $amountToRead -= strlen($data);
+
+ if (connection_status() != CONNECTION_NORMAL) {
+ break;
+ }
+ }
+ } else {
+ while (!$body->eof()) {
+ echo $body->read($chunkSize);
+ if (connection_status() != CONNECTION_NORMAL) {
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Invoke application
+ *
+ * This method implements the middleware interface. It receives
+ * Request and Response objects, and it returns a Response object
+ * after compiling the routes registered in the Router and dispatching
+ * the Request object to the appropriate Route callback routine.
+ *
+ * @param ServerRequestInterface $request The most recent Request object
+ * @param ResponseInterface $response The most recent Response object
+ *
+ * @return ResponseInterface
+ * @throws MethodNotAllowedException
+ * @throws NotFoundException
+ */
+ public function __invoke(ServerRequestInterface $request, ResponseInterface $response)
+ {
+ // Get the route info
+ $routeInfo = $request->getAttribute('routeInfo');
+
+ /** @var \Slim\Interfaces\RouterInterface $router */
+ $router = $this->container->get('router');
+
+ // If router hasn't been dispatched or the URI changed then dispatch
+ if (null === $routeInfo || ($routeInfo['request'] !== [$request->getMethod(), (string) $request->getUri()])) {
+ $request = $this->dispatchRouterAndPrepareRoute($request, $router);
+ $routeInfo = $request->getAttribute('routeInfo');
+ }
+
+ if ($routeInfo[0] === Dispatcher::FOUND) {
+ $route = $router->lookupRoute($routeInfo[1]);
+ return $route->run($request, $response);
+ } elseif ($routeInfo[0] === Dispatcher::METHOD_NOT_ALLOWED) {
+ if (!$this->container->has('notAllowedHandler')) {
+ throw new MethodNotAllowedException($request, $response, $routeInfo[1]);
+ }
+ /** @var callable $notAllowedHandler */
+ $notAllowedHandler = $this->container->get('notAllowedHandler');
+ return $notAllowedHandler($request, $response, $routeInfo[1]);
+ }
+
+ if (!$this->container->has('notFoundHandler')) {
+ throw new NotFoundException($request, $response);
+ }
+ /** @var callable $notFoundHandler */
+ $notFoundHandler = $this->container->get('notFoundHandler');
+ return $notFoundHandler($request, $response);
+ }
+
+ /**
+ * Perform a sub-request from within an application route
+ *
+ * This method allows you to prepare and initiate a sub-request, run within
+ * the context of the current request. This WILL NOT issue a remote HTTP
+ * request. Instead, it will route the provided URL, method, headers,
+ * cookies, body, and server variables against the set of registered
+ * application routes. The result response object is returned.
+ *
+ * @param string $method The request method (e.g., GET, POST, PUT, etc.)
+ * @param string $path The request URI path
+ * @param string $query The request URI query string
+ * @param array $headers The request headers (key-value array)
+ * @param array $cookies The request cookies (key-value array)
+ * @param string $bodyContent The request body
+ * @param ResponseInterface $response The response object (optional)
+ * @return ResponseInterface
+ */
+ public function subRequest(
+ $method,
+ $path,
+ $query = '',
+ array $headers = [],
+ array $cookies = [],
+ $bodyContent = '',
+ ResponseInterface $response = null
+ ) {
+ $env = $this->container->get('environment');
+ $uri = Uri::createFromEnvironment($env)->withPath($path)->withQuery($query);
+ $headers = new Headers($headers);
+ $serverParams = $env->all();
+ $body = new Body(fopen('php://temp', 'r+'));
+ $body->write($bodyContent);
+ $body->rewind();
+ $request = new Request($method, $uri, $headers, $cookies, $serverParams, $body);
+
+ if (!$response) {
+ $response = $this->container->get('response');
+ }
+
+ return $this($request, $response);
+ }
+
+ /**
+ * Dispatch the router to find the route. Prepare the route for use.
+ *
+ * @param ServerRequestInterface $request
+ * @param RouterInterface $router
+ * @return ServerRequestInterface
+ */
+ protected function dispatchRouterAndPrepareRoute(ServerRequestInterface $request, RouterInterface $router)
+ {
+ $routeInfo = $router->dispatch($request);
+
+ if ($routeInfo[0] === Dispatcher::FOUND) {
+ $routeArguments = [];
+ foreach ($routeInfo[2] as $k => $v) {
+ $routeArguments[$k] = urldecode($v);
+ }
+
+ $route = $router->lookupRoute($routeInfo[1]);
+ $route->prepare($request, $routeArguments);
+
+ // add route to the request's attributes in case a middleware or handler needs access to the route
+ $request = $request->withAttribute('route', $route);
+ }
+
+ $routeInfo['request'] = [$request->getMethod(), (string) $request->getUri()];
+
+ return $request->withAttribute('routeInfo', $routeInfo);
+ }
+
+ /**
+ * Finalize response
+ *
+ * @param ResponseInterface $response
+ * @return ResponseInterface
+ */
+ protected function finalize(ResponseInterface $response)
+ {
+ // stop PHP sending a Content-Type automatically
+ ini_set('default_mimetype', '');
+
+ if ($this->isEmptyResponse($response)) {
+ return $response->withoutHeader('Content-Type')->withoutHeader('Content-Length');
+ }
+
+ // Add Content-Length header if `addContentLengthHeader` setting is set
+ if (isset($this->container->get('settings')['addContentLengthHeader']) &&
+ $this->container->get('settings')['addContentLengthHeader'] == true) {
+ if (ob_get_length() > 0) {
+ throw new \RuntimeException("Unexpected data in output buffer. " .
+ "Maybe you have characters before an opening getBody()->getSize();
+ if ($size !== null && !$response->hasHeader('Content-Length')) {
+ $response = $response->withHeader('Content-Length', (string) $size);
+ }
+ }
+
+ return $response;
+ }
+
+ /**
+ * Helper method, which returns true if the provided response must not output a body and false
+ * if the response could have a body.
+ *
+ * @see https://tools.ietf.org/html/rfc7231
+ *
+ * @param ResponseInterface $response
+ * @return bool
+ */
+ protected function isEmptyResponse(ResponseInterface $response)
+ {
+ if (method_exists($response, 'isEmpty')) {
+ return $response->isEmpty();
+ }
+
+ return in_array($response->getStatusCode(), [204, 205, 304]);
+ }
+
+ /**
+ * Call relevant handler from the Container if needed. If it doesn't exist,
+ * then just re-throw.
+ *
+ * @param Exception $e
+ * @param ServerRequestInterface $request
+ * @param ResponseInterface $response
+ *
+ * @return ResponseInterface
+ * @throws Exception if a handler is needed and not found
+ */
+ protected function handleException(Exception $e, ServerRequestInterface $request, ResponseInterface $response)
+ {
+ if ($e instanceof MethodNotAllowedException) {
+ $handler = 'notAllowedHandler';
+ $params = [$e->getRequest(), $e->getResponse(), $e->getAllowedMethods()];
+ } elseif ($e instanceof NotFoundException) {
+ $handler = 'notFoundHandler';
+ $params = [$e->getRequest(), $e->getResponse()];
+ } elseif ($e instanceof SlimException) {
+ // This is a Stop exception and contains the response
+ return $e->getResponse();
+ } else {
+ // Other exception, use $request and $response params
+ $handler = 'errorHandler';
+ $params = [$request, $response, $e];
+ }
+
+ if ($this->container->has($handler)) {
+ $callable = $this->container->get($handler);
+ // Call the registered handler
+ return call_user_func_array($callable, $params);
+ }
+
+ // No handlers found, so just throw the exception
+ throw $e;
+ }
+
+ /**
+ * Call relevant handler from the Container if needed. If it doesn't exist,
+ * then just re-throw.
+ *
+ * @param Throwable $e
+ * @param ServerRequestInterface $request
+ * @param ResponseInterface $response
+ * @return ResponseInterface
+ * @throws Throwable
+ */
+ protected function handlePhpError(Throwable $e, ServerRequestInterface $request, ResponseInterface $response)
+ {
+ $handler = 'phpErrorHandler';
+ $params = [$request, $response, $e];
+
+ if ($this->container->has($handler)) {
+ $callable = $this->container->get($handler);
+ // Call the registered handler
+ return call_user_func_array($callable, $params);
+ }
+
+ // No handlers found, so just throw the exception
+ throw $e;
+ }
+}
diff --git a/samples/server/petstore-security-test/slim/vendor/slim/slim/Slim/CallableResolver.php b/samples/server/petstore-security-test/slim/vendor/slim/slim/Slim/CallableResolver.php
new file mode 100644
index 0000000000..705a9f207f
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/slim/slim/Slim/CallableResolver.php
@@ -0,0 +1,87 @@
+container = $container;
+ }
+
+ /**
+ * Resolve toResolve into a closure that that the router can dispatch.
+ *
+ * If toResolve is of the format 'class:method', then try to extract 'class'
+ * from the container otherwise instantiate it and then dispatch 'method'.
+ *
+ * @param mixed $toResolve
+ *
+ * @return callable
+ *
+ * @throws RuntimeException if the callable does not exist
+ * @throws RuntimeException if the callable is not resolvable
+ */
+ public function resolve($toResolve)
+ {
+ $resolved = $toResolve;
+
+ if (!is_callable($toResolve) && is_string($toResolve)) {
+ // check for slim callable as "class:method"
+ $callablePattern = '!^([^\:]+)\:([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)$!';
+ if (preg_match($callablePattern, $toResolve, $matches)) {
+ $class = $matches[1];
+ $method = $matches[2];
+
+ if ($this->container->has($class)) {
+ $resolved = [$this->container->get($class), $method];
+ } else {
+ if (!class_exists($class)) {
+ throw new RuntimeException(sprintf('Callable %s does not exist', $class));
+ }
+ $resolved = [new $class($this->container), $method];
+ }
+ } else {
+ // check if string is something in the DIC that's callable or is a class name which
+ // has an __invoke() method
+ $class = $toResolve;
+ if ($this->container->has($class)) {
+ $resolved = $this->container->get($class);
+ } else {
+ if (!class_exists($class)) {
+ throw new RuntimeException(sprintf('Callable %s does not exist', $class));
+ }
+ $resolved = new $class($this->container);
+ }
+ }
+ }
+
+ if (!is_callable($resolved)) {
+ throw new RuntimeException(sprintf('%s is not resolvable', $toResolve));
+ }
+
+ return $resolved;
+ }
+}
diff --git a/samples/server/petstore-security-test/slim/vendor/slim/slim/Slim/CallableResolverAwareTrait.php b/samples/server/petstore-security-test/slim/vendor/slim/slim/Slim/CallableResolverAwareTrait.php
new file mode 100644
index 0000000000..f7ff485282
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/slim/slim/Slim/CallableResolverAwareTrait.php
@@ -0,0 +1,47 @@
+container instanceof ContainerInterface) {
+ return $callable;
+ }
+
+ /** @var CallableResolverInterface $resolver */
+ $resolver = $this->container->get('callableResolver');
+
+ return $resolver->resolve($callable);
+ }
+}
diff --git a/samples/server/petstore-security-test/slim/vendor/slim/slim/Slim/Collection.php b/samples/server/petstore-security-test/slim/vendor/slim/slim/Slim/Collection.php
new file mode 100644
index 0000000000..d33acd9ce3
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/slim/slim/Slim/Collection.php
@@ -0,0 +1,204 @@
+ $value) {
+ $this->set($key, $value);
+ }
+ }
+
+ /********************************************************************************
+ * Collection interface
+ *******************************************************************************/
+
+ /**
+ * Set collection item
+ *
+ * @param string $key The data key
+ * @param mixed $value The data value
+ */
+ public function set($key, $value)
+ {
+ $this->data[$key] = $value;
+ }
+
+ /**
+ * Get collection item for key
+ *
+ * @param string $key The data key
+ * @param mixed $default The default value to return if data key does not exist
+ *
+ * @return mixed The key's value, or the default value
+ */
+ public function get($key, $default = null)
+ {
+ return $this->has($key) ? $this->data[$key] : $default;
+ }
+
+ /**
+ * Add item to collection
+ *
+ * @param array $items Key-value array of data to append to this collection
+ */
+ public function replace(array $items)
+ {
+ foreach ($items as $key => $value) {
+ $this->set($key, $value);
+ }
+ }
+
+ /**
+ * Get all items in collection
+ *
+ * @return array The collection's source data
+ */
+ public function all()
+ {
+ return $this->data;
+ }
+
+ /**
+ * Get collection keys
+ *
+ * @return array The collection's source data keys
+ */
+ public function keys()
+ {
+ return array_keys($this->data);
+ }
+
+ /**
+ * Does this collection have a given key?
+ *
+ * @param string $key The data key
+ *
+ * @return bool
+ */
+ public function has($key)
+ {
+ return array_key_exists($key, $this->data);
+ }
+
+ /**
+ * Remove item from collection
+ *
+ * @param string $key The data key
+ */
+ public function remove($key)
+ {
+ unset($this->data[$key]);
+ }
+
+ /**
+ * Remove all items from collection
+ */
+ public function clear()
+ {
+ $this->data = [];
+ }
+
+ /********************************************************************************
+ * ArrayAccess interface
+ *******************************************************************************/
+
+ /**
+ * Does this collection have a given key?
+ *
+ * @param string $key The data key
+ *
+ * @return bool
+ */
+ public function offsetExists($key)
+ {
+ return $this->has($key);
+ }
+
+ /**
+ * Get collection item for key
+ *
+ * @param string $key The data key
+ *
+ * @return mixed The key's value, or the default value
+ */
+ public function offsetGet($key)
+ {
+ return $this->get($key);
+ }
+
+ /**
+ * Set collection item
+ *
+ * @param string $key The data key
+ * @param mixed $value The data value
+ */
+ public function offsetSet($key, $value)
+ {
+ $this->set($key, $value);
+ }
+
+ /**
+ * Remove item from collection
+ *
+ * @param string $key The data key
+ */
+ public function offsetUnset($key)
+ {
+ $this->remove($key);
+ }
+
+ /**
+ * Get number of items in collection
+ *
+ * @return int
+ */
+ public function count()
+ {
+ return count($this->data);
+ }
+
+ /********************************************************************************
+ * IteratorAggregate interface
+ *******************************************************************************/
+
+ /**
+ * Get collection iterator
+ *
+ * @return \ArrayIterator
+ */
+ public function getIterator()
+ {
+ return new ArrayIterator($this->data);
+ }
+}
diff --git a/samples/server/petstore-security-test/slim/vendor/slim/slim/Slim/Container.php b/samples/server/petstore-security-test/slim/vendor/slim/slim/Slim/Container.php
new file mode 100644
index 0000000000..c97f2b3fdf
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/slim/slim/Slim/Container.php
@@ -0,0 +1,181 @@
+ '1.1',
+ 'responseChunkSize' => 4096,
+ 'outputBuffering' => 'append',
+ 'determineRouteBeforeAppMiddleware' => false,
+ 'displayErrorDetails' => false,
+ 'addContentLengthHeader' => true,
+ 'routerCacheFile' => false,
+ ];
+
+ /**
+ * Create new container
+ *
+ * @param array $values The parameters or objects.
+ */
+ public function __construct(array $values = [])
+ {
+ parent::__construct($values);
+
+ $userSettings = isset($values['settings']) ? $values['settings'] : [];
+ $this->registerDefaultServices($userSettings);
+ }
+
+ /**
+ * This function registers the default services that Slim needs to work.
+ *
+ * All services are shared - that is, they are registered such that the
+ * same instance is returned on subsequent calls.
+ *
+ * @param array $userSettings Associative array of application settings
+ *
+ * @return void
+ */
+ private function registerDefaultServices($userSettings)
+ {
+ $defaultSettings = $this->defaultSettings;
+
+ /**
+ * This service MUST return an array or an
+ * instance of \ArrayAccess.
+ *
+ * @return array|\ArrayAccess
+ */
+ $this['settings'] = function () use ($userSettings, $defaultSettings) {
+ return new Collection(array_merge($defaultSettings, $userSettings));
+ };
+
+ $defaultProvider = new DefaultServicesProvider();
+ $defaultProvider->register($this);
+ }
+
+ /********************************************************************************
+ * Methods to satisfy Interop\Container\ContainerInterface
+ *******************************************************************************/
+
+ /**
+ * Finds an entry of the container by its identifier and returns it.
+ *
+ * @param string $id Identifier of the entry to look for.
+ *
+ * @throws ContainerValueNotFoundException No entry was found for this identifier.
+ * @throws ContainerException Error while retrieving the entry.
+ *
+ * @return mixed Entry.
+ */
+ public function get($id)
+ {
+ if (!$this->offsetExists($id)) {
+ throw new ContainerValueNotFoundException(sprintf('Identifier "%s" is not defined.', $id));
+ }
+ try {
+ return $this->offsetGet($id);
+ } catch (\InvalidArgumentException $exception) {
+ if ($this->exceptionThrownByContainer($exception)) {
+ throw new SlimContainerException(
+ sprintf('Container error while retrieving "%s"', $id),
+ null,
+ $exception
+ );
+ } else {
+ throw $exception;
+ }
+ }
+ }
+
+ /**
+ * Tests whether an exception needs to be recast for compliance with Container-Interop. This will be if the
+ * exception was thrown by Pimple.
+ *
+ * @param \InvalidArgumentException $exception
+ *
+ * @return bool
+ */
+ private function exceptionThrownByContainer(\InvalidArgumentException $exception)
+ {
+ $trace = $exception->getTrace()[0];
+
+ return $trace['class'] === PimpleContainer::class && $trace['function'] === 'offsetGet';
+ }
+
+ /**
+ * Returns true if the container can return an entry for the given identifier.
+ * Returns false otherwise.
+ *
+ * @param string $id Identifier of the entry to look for.
+ *
+ * @return boolean
+ */
+ public function has($id)
+ {
+ return $this->offsetExists($id);
+ }
+
+
+ /********************************************************************************
+ * Magic methods for convenience
+ *******************************************************************************/
+
+ public function __get($name)
+ {
+ return $this->get($name);
+ }
+
+ public function __isset($name)
+ {
+ return $this->has($name);
+ }
+}
diff --git a/samples/server/petstore-security-test/slim/vendor/slim/slim/Slim/DefaultServicesProvider.php b/samples/server/petstore-security-test/slim/vendor/slim/slim/Slim/DefaultServicesProvider.php
new file mode 100644
index 0000000000..c18d875720
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/slim/slim/Slim/DefaultServicesProvider.php
@@ -0,0 +1,204 @@
+get('environment'));
+ };
+ }
+
+ if (!isset($container['response'])) {
+ /**
+ * PSR-7 Response object
+ *
+ * @param Container $container
+ *
+ * @return ResponseInterface
+ */
+ $container['response'] = function ($container) {
+ $headers = new Headers(['Content-Type' => 'text/html; charset=UTF-8']);
+ $response = new Response(200, $headers);
+
+ return $response->withProtocolVersion($container->get('settings')['httpVersion']);
+ };
+ }
+
+ if (!isset($container['router'])) {
+ /**
+ * This service MUST return a SHARED instance
+ * of \Slim\Interfaces\RouterInterface.
+ *
+ * @param Container $container
+ *
+ * @return RouterInterface
+ */
+ $container['router'] = function ($container) {
+ $routerCacheFile = false;
+ if (isset($container->get('settings')['routerCacheFile'])) {
+ $routerCacheFile = $container->get('settings')['routerCacheFile'];
+ }
+
+ return (new Router)->setCacheFile($routerCacheFile);
+ };
+ }
+
+ if (!isset($container['foundHandler'])) {
+ /**
+ * This service MUST return a SHARED instance
+ * of \Slim\Interfaces\InvocationStrategyInterface.
+ *
+ * @return InvocationStrategyInterface
+ */
+ $container['foundHandler'] = function () {
+ return new RequestResponse;
+ };
+ }
+
+ if (!isset($container['phpErrorHandler'])) {
+ /**
+ * This service MUST return a callable
+ * that accepts three arguments:
+ *
+ * 1. Instance of \Psr\Http\Message\ServerRequestInterface
+ * 2. Instance of \Psr\Http\Message\ResponseInterface
+ * 3. Instance of \Error
+ *
+ * The callable MUST return an instance of
+ * \Psr\Http\Message\ResponseInterface.
+ *
+ * @param Container $container
+ *
+ * @return callable
+ */
+ $container['phpErrorHandler'] = function ($container) {
+ return new PhpError($container->get('settings')['displayErrorDetails']);
+ };
+ }
+
+ if (!isset($container['errorHandler'])) {
+ /**
+ * This service MUST return a callable
+ * that accepts three arguments:
+ *
+ * 1. Instance of \Psr\Http\Message\ServerRequestInterface
+ * 2. Instance of \Psr\Http\Message\ResponseInterface
+ * 3. Instance of \Exception
+ *
+ * The callable MUST return an instance of
+ * \Psr\Http\Message\ResponseInterface.
+ *
+ * @param Container $container
+ *
+ * @return callable
+ */
+ $container['errorHandler'] = function ($container) {
+ return new Error($container->get('settings')['displayErrorDetails']);
+ };
+ }
+
+ if (!isset($container['notFoundHandler'])) {
+ /**
+ * This service MUST return a callable
+ * that accepts two arguments:
+ *
+ * 1. Instance of \Psr\Http\Message\ServerRequestInterface
+ * 2. Instance of \Psr\Http\Message\ResponseInterface
+ *
+ * The callable MUST return an instance of
+ * \Psr\Http\Message\ResponseInterface.
+ *
+ * @return callable
+ */
+ $container['notFoundHandler'] = function () {
+ return new NotFound;
+ };
+ }
+
+ if (!isset($container['notAllowedHandler'])) {
+ /**
+ * This service MUST return a callable
+ * that accepts three arguments:
+ *
+ * 1. Instance of \Psr\Http\Message\ServerRequestInterface
+ * 2. Instance of \Psr\Http\Message\ResponseInterface
+ * 3. Array of allowed HTTP methods
+ *
+ * The callable MUST return an instance of
+ * \Psr\Http\Message\ResponseInterface.
+ *
+ * @return callable
+ */
+ $container['notAllowedHandler'] = function () {
+ return new NotAllowed;
+ };
+ }
+
+ if (!isset($container['callableResolver'])) {
+ /**
+ * Instance of \Slim\Interfaces\CallableResolverInterface
+ *
+ * @param Container $container
+ *
+ * @return CallableResolverInterface
+ */
+ $container['callableResolver'] = function ($container) {
+ return new CallableResolver($container);
+ };
+ }
+ }
+}
diff --git a/samples/server/petstore-security-test/slim/vendor/slim/slim/Slim/DeferredCallable.php b/samples/server/petstore-security-test/slim/vendor/slim/slim/Slim/DeferredCallable.php
new file mode 100644
index 0000000000..def58ab23b
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/slim/slim/Slim/DeferredCallable.php
@@ -0,0 +1,39 @@
+callable = $callable;
+ $this->container = $container;
+ }
+
+ public function __invoke()
+ {
+ $callable = $this->resolveCallable($this->callable);
+ if ($callable instanceof Closure) {
+ $callable = $callable->bindTo($this->container);
+ }
+
+ $args = func_get_args();
+
+ return call_user_func_array($callable, $args);
+ }
+}
diff --git a/samples/server/petstore-security-test/slim/vendor/slim/slim/Slim/Exception/ContainerException.php b/samples/server/petstore-security-test/slim/vendor/slim/slim/Slim/Exception/ContainerException.php
new file mode 100644
index 0000000000..0200e1a861
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/slim/slim/Slim/Exception/ContainerException.php
@@ -0,0 +1,20 @@
+allowedMethods = $allowedMethods;
+ }
+
+ /**
+ * Get allowed methods
+ *
+ * @return string[]
+ */
+ public function getAllowedMethods()
+ {
+ return $this->allowedMethods;
+ }
+}
diff --git a/samples/server/petstore-security-test/slim/vendor/slim/slim/Slim/Exception/NotFoundException.php b/samples/server/petstore-security-test/slim/vendor/slim/slim/Slim/Exception/NotFoundException.php
new file mode 100644
index 0000000000..65365eb99d
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/slim/slim/Slim/Exception/NotFoundException.php
@@ -0,0 +1,14 @@
+request = $request;
+ $this->response = $response;
+ }
+
+ /**
+ * Get request
+ *
+ * @return ServerRequestInterface
+ */
+ public function getRequest()
+ {
+ return $this->request;
+ }
+
+ /**
+ * Get response
+ *
+ * @return ResponseInterface
+ */
+ public function getResponse()
+ {
+ return $this->response;
+ }
+}
diff --git a/samples/server/petstore-security-test/slim/vendor/slim/slim/Slim/Handlers/AbstractError.php b/samples/server/petstore-security-test/slim/vendor/slim/slim/Slim/Handlers/AbstractError.php
new file mode 100644
index 0000000000..5a6cee30a9
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/slim/slim/Slim/Handlers/AbstractError.php
@@ -0,0 +1,99 @@
+displayErrorDetails = (bool) $displayErrorDetails;
+ }
+
+ /**
+ * Write to the error log if displayErrorDetails is false
+ *
+ * @param \Exception|\Throwable $throwable
+ *
+ * @return void
+ */
+ protected function writeToErrorLog($throwable)
+ {
+ if ($this->displayErrorDetails) {
+ return;
+ }
+
+ $message = 'Slim Application Error:' . PHP_EOL;
+ $message .= $this->renderThrowableAsText($throwable);
+ while ($throwable = $throwable->getPrevious()) {
+ $message .= PHP_EOL . 'Previous error:' . PHP_EOL;
+ $message .= $this->renderThrowableAsText($throwable);
+ }
+
+ $message .= PHP_EOL . 'View in rendered output by enabling the "displayErrorDetails" setting.' . PHP_EOL;
+
+ $this->logError($message);
+ }
+
+ /**
+ * Render error as Text.
+ *
+ * @param \Exception|\Throwable $throwable
+ *
+ * @return string
+ */
+ protected function renderThrowableAsText($throwable)
+ {
+ $text = sprintf('Type: %s' . PHP_EOL, get_class($throwable));
+
+ if ($code = $throwable->getCode()) {
+ $text .= sprintf('Code: %s' . PHP_EOL, $code);
+ }
+
+ if ($message = $throwable->getMessage()) {
+ $text .= sprintf('Message: %s' . PHP_EOL, htmlentities($message));
+ }
+
+ if ($file = $throwable->getFile()) {
+ $text .= sprintf('File: %s' . PHP_EOL, $file);
+ }
+
+ if ($line = $throwable->getLine()) {
+ $text .= sprintf('Line: %s' . PHP_EOL, $line);
+ }
+
+ if ($trace = $throwable->getTraceAsString()) {
+ $text .= sprintf('Trace: %s', $trace);
+ }
+
+ return $text;
+ }
+
+ /**
+ * Wraps the error_log function so that this can be easily tested
+ *
+ * @param $message
+ */
+ protected function logError($message)
+ {
+ error_log($message);
+ }
+}
diff --git a/samples/server/petstore-security-test/slim/vendor/slim/slim/Slim/Handlers/AbstractHandler.php b/samples/server/petstore-security-test/slim/vendor/slim/slim/Slim/Handlers/AbstractHandler.php
new file mode 100644
index 0000000000..decdf725ce
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/slim/slim/Slim/Handlers/AbstractHandler.php
@@ -0,0 +1,59 @@
+getHeaderLine('Accept');
+ $selectedContentTypes = array_intersect(explode(',', $acceptHeader), $this->knownContentTypes);
+
+ if (count($selectedContentTypes)) {
+ return current($selectedContentTypes);
+ }
+
+ // handle +json and +xml specially
+ if (preg_match('/\+(json|xml)/', $acceptHeader, $matches)) {
+ $mediaType = 'application/' . $matches[1];
+ if (in_array($mediaType, $this->knownContentTypes)) {
+ return $mediaType;
+ }
+ }
+
+ return 'text/html';
+ }
+}
diff --git a/samples/server/petstore-security-test/slim/vendor/slim/slim/Slim/Handlers/Error.php b/samples/server/petstore-security-test/slim/vendor/slim/slim/Slim/Handlers/Error.php
new file mode 100644
index 0000000000..b9951888ef
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/slim/slim/Slim/Handlers/Error.php
@@ -0,0 +1,206 @@
+determineContentType($request);
+ switch ($contentType) {
+ case 'application/json':
+ $output = $this->renderJsonErrorMessage($exception);
+ break;
+
+ case 'text/xml':
+ case 'application/xml':
+ $output = $this->renderXmlErrorMessage($exception);
+ break;
+
+ case 'text/html':
+ $output = $this->renderHtmlErrorMessage($exception);
+ break;
+
+ default:
+ throw new UnexpectedValueException('Cannot render unknown content type ' . $contentType);
+ }
+
+ $this->writeToErrorLog($exception);
+
+ $body = new Body(fopen('php://temp', 'r+'));
+ $body->write($output);
+
+ return $response
+ ->withStatus(500)
+ ->withHeader('Content-type', $contentType)
+ ->withBody($body);
+ }
+
+ /**
+ * Render HTML error page
+ *
+ * @param \Exception $exception
+ *
+ * @return string
+ */
+ protected function renderHtmlErrorMessage(\Exception $exception)
+ {
+ $title = 'Slim Application Error';
+
+ if ($this->displayErrorDetails) {
+ $html = 'The application could not run because of the following error:
';
+ $html .= 'Details
';
+ $html .= $this->renderHtmlException($exception);
+
+ while ($exception = $exception->getPrevious()) {
+ $html .= 'Previous exception
';
+ $html .= $this->renderHtmlException($exception);
+ }
+ } else {
+ $html = 'A website error has occurred. Sorry for the temporary inconvenience.
';
+ }
+
+ $output = sprintf(
+ "" .
+ "%s%s
%s",
+ $title,
+ $title,
+ $html
+ );
+
+ return $output;
+ }
+
+ /**
+ * Render exception as HTML.
+ *
+ * @param \Exception $exception
+ *
+ * @return string
+ */
+ protected function renderHtmlException(\Exception $exception)
+ {
+ $html = sprintf('Type: %s
', get_class($exception));
+
+ if (($code = $exception->getCode())) {
+ $html .= sprintf('Code: %s
', $code);
+ }
+
+ if (($message = $exception->getMessage())) {
+ $html .= sprintf('Message: %s
', htmlentities($message));
+ }
+
+ if (($file = $exception->getFile())) {
+ $html .= sprintf('File: %s
', $file);
+ }
+
+ if (($line = $exception->getLine())) {
+ $html .= sprintf('Line: %s
', $line);
+ }
+
+ if (($trace = $exception->getTraceAsString())) {
+ $html .= 'Trace
';
+ $html .= sprintf('%s
', htmlentities($trace));
+ }
+
+ return $html;
+ }
+
+ /**
+ * Render JSON error
+ *
+ * @param \Exception $exception
+ *
+ * @return string
+ */
+ protected function renderJsonErrorMessage(\Exception $exception)
+ {
+ $error = [
+ 'message' => 'Slim Application Error',
+ ];
+
+ if ($this->displayErrorDetails) {
+ $error['exception'] = [];
+
+ do {
+ $error['exception'][] = [
+ 'type' => get_class($exception),
+ 'code' => $exception->getCode(),
+ 'message' => $exception->getMessage(),
+ 'file' => $exception->getFile(),
+ 'line' => $exception->getLine(),
+ 'trace' => explode("\n", $exception->getTraceAsString()),
+ ];
+ } while ($exception = $exception->getPrevious());
+ }
+
+ return json_encode($error, JSON_PRETTY_PRINT);
+ }
+
+ /**
+ * Render XML error
+ *
+ * @param \Exception $exception
+ *
+ * @return string
+ */
+ protected function renderXmlErrorMessage(\Exception $exception)
+ {
+ $xml = "\n Slim Application Error\n";
+ if ($this->displayErrorDetails) {
+ do {
+ $xml .= " \n";
+ $xml .= " " . get_class($exception) . "\n";
+ $xml .= " " . $exception->getCode() . "
\n";
+ $xml .= " " . $this->createCdataSection($exception->getMessage()) . "\n";
+ $xml .= " " . $exception->getFile() . "\n";
+ $xml .= " " . $exception->getLine() . "\n";
+ $xml .= " " . $this->createCdataSection($exception->getTraceAsString()) . "\n";
+ $xml .= " \n";
+ } while ($exception = $exception->getPrevious());
+ }
+ $xml .= "";
+
+ return $xml;
+ }
+
+ /**
+ * Returns a CDATA section with the given content.
+ *
+ * @param string $content
+ * @return string
+ */
+ private function createCdataSection($content)
+ {
+ return sprintf('', str_replace(']]>', ']]]]>', $content));
+ }
+}
diff --git a/samples/server/petstore-security-test/slim/vendor/slim/slim/Slim/Handlers/NotAllowed.php b/samples/server/petstore-security-test/slim/vendor/slim/slim/Slim/Handlers/NotAllowed.php
new file mode 100644
index 0000000000..3442f20bc5
--- /dev/null
+++ b/samples/server/petstore-security-test/slim/vendor/slim/slim/Slim/Handlers/NotAllowed.php
@@ -0,0 +1,147 @@
+getMethod() === 'OPTIONS') {
+ $status = 200;
+ $contentType = 'text/plain';
+ $output = $this->renderPlainNotAllowedMessage($methods);
+ } else {
+ $status = 405;
+ $contentType = $this->determineContentType($request);
+ switch ($contentType) {
+ case 'application/json':
+ $output = $this->renderJsonNotAllowedMessage($methods);
+ break;
+
+ case 'text/xml':
+ case 'application/xml':
+ $output = $this->renderXmlNotAllowedMessage($methods);
+ break;
+
+ case 'text/html':
+ $output = $this->renderHtmlNotAllowedMessage($methods);
+ break;
+ default:
+ throw new UnexpectedValueException('Cannot render unknown content type ' . $contentType);
+ }
+ }
+
+ $body = new Body(fopen('php://temp', 'r+'));
+ $body->write($output);
+ $allow = implode(', ', $methods);
+
+ return $response
+ ->withStatus($status)
+ ->withHeader('Content-type', $contentType)
+ ->withHeader('Allow', $allow)
+ ->withBody($body);
+ }
+
+ /**
+ * Render PLAIN not allowed message
+ *
+ * @param array $methods
+ * @return string
+ */
+ protected function renderPlainNotAllowedMessage($methods)
+ {
+ $allow = implode(', ', $methods);
+
+ return 'Allowed methods: ' . $allow;
+ }
+
+ /**
+ * Render JSON not allowed message
+ *
+ * @param array $methods
+ * @return string
+ */
+ protected function renderJsonNotAllowedMessage($methods)
+ {
+ $allow = implode(', ', $methods);
+
+ return '{"message":"Method not allowed. Must be one of: ' . $allow . '"}';
+ }
+
+ /**
+ * Render XML not allowed message
+ *
+ * @param array $methods
+ * @return string
+ */
+ protected function renderXmlNotAllowedMessage($methods)
+ {
+ $allow = implode(', ', $methods);
+
+ return "Method not allowed. Must be one of: $allow";
+ }
+
+ /**
+ * Render HTML not allowed message
+ *
+ * @param array $methods
+ * @return string
+ */
+ protected function renderHtmlNotAllowedMessage($methods)
+ {
+ $allow = implode(', ', $methods);
+ $output = <<
+
+ Method not allowed
+
+
+
+ Method not allowed
+ Method not allowed. Must be one of: $allow
+
+