From cfcfceea2f0f06f7c08123b94bb937513f880a4e Mon Sep 17 00:00:00 2001 From: Samuel Laulhau Date: Fri, 27 Sep 2013 17:34:33 +0200 Subject: [PATCH 01/10] make flash middleware implements countable --- Slim/Middleware/Flash.php | 13 ++++++++++++- tests/Middleware/FlashTest.php | 13 +++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/Slim/Middleware/Flash.php b/Slim/Middleware/Flash.php index a1647665b..43ca9e960 100644 --- a/Slim/Middleware/Flash.php +++ b/Slim/Middleware/Flash.php @@ -45,7 +45,7 @@ * @author Josh Lockhart * @since 1.6.0 */ -class Flash extends \Slim\Middleware implements \ArrayAccess, \IteratorAggregate +class Flash extends \Slim\Middleware implements \ArrayAccess, \IteratorAggregate, \Countable { /** * @var array @@ -198,4 +198,15 @@ public function getIterator() return new \ArrayIterator($messages); } + + /** + * Countable: Count + */ + public function count() + { + return count($this->getMessages()); + } + + + } diff --git a/tests/Middleware/FlashTest.php b/tests/Middleware/FlashTest.php index 7b8f7961d..82d7fbdcd 100644 --- a/tests/Middleware/FlashTest.php +++ b/tests/Middleware/FlashTest.php @@ -125,4 +125,17 @@ public function testIteration() } $this->assertEquals('infofooerrorbar', $output); } + + /** + * Test countable + */ + public function testCountable() + { + $_SESSION['slim.flash'] = array('info' => 'foo', 'error' => 'bar'); + $f = new \Slim\MiddleWare\Flash(); + $f->loadMessages(); + $this->assertEquals(2, count($f)); + } + + } From 4803b21b8a52188d1ad3a61c23b595c686e19de7 Mon Sep 17 00:00:00 2001 From: = Date: Sun, 29 Sep 2013 15:46:31 -0400 Subject: [PATCH 02/10] Bump version numbers --- .vagrant.v1.1380248914 | 1 + Slim/Environment.php | 2 +- Slim/Exception/Pass.php | 2 +- Slim/Exception/Stop.php | 2 +- Slim/Helper/Set.php | 2 +- Slim/Http/Cookies.php | 2 +- Slim/Http/Headers.php | 2 +- Slim/Http/Request.php | 2 +- Slim/Http/Response.php | 2 +- Slim/Http/Util.php | 2 +- Slim/Log.php | 2 +- Slim/LogWriter.php | 2 +- Slim/Middleware.php | 2 +- Slim/Middleware/ContentTypes.php | 2 +- Slim/Middleware/MethodOverride.php | 2 +- Slim/Middleware/PrettyExceptions.php | 2 +- Slim/Middleware/SessionCookie.php | 2 +- Slim/Router.php | 2 +- Slim/Slim.php | 8 ++++---- Slim/View.php | 2 +- tests/EnvironmentTest.php | 2 +- tests/Helper/SetTest.php | 2 +- tests/Http/CookiesTest.php | 2 +- tests/Http/HeadersTest.php | 2 +- tests/Http/RequestTest.php | 2 +- tests/Http/ResponseTest.php | 2 +- tests/Http/UtilTest.php | 2 +- tests/LogTest.php | 2 +- tests/LogWriterTest.php | 2 +- tests/Middleware/ContentTypesTest.php | 2 +- tests/Middleware/FlashTest.php | 2 +- tests/Middleware/MethodOverrideTest.php | 2 +- tests/Middleware/PrettyExceptionsTest.php | 2 +- tests/Middleware/SessionCookieTest.php | 2 +- tests/MiddlewareTest.php | 2 +- tests/RouteTest.php | 2 +- tests/RouterTest.php | 2 +- tests/SlimTest.php | 2 +- tests/ViewTest.php | 2 +- 39 files changed, 42 insertions(+), 41 deletions(-) create mode 100644 .vagrant.v1.1380248914 diff --git a/.vagrant.v1.1380248914 b/.vagrant.v1.1380248914 new file mode 100644 index 000000000..d280fe710 --- /dev/null +++ b/.vagrant.v1.1380248914 @@ -0,0 +1 @@ +{"active":{"default":"d4f35030-4dba-4dbb-9110-ad346b2bbeb7"}} \ No newline at end of file diff --git a/Slim/Environment.php b/Slim/Environment.php index 707b2dc16..f18ee2e8d 100644 --- a/Slim/Environment.php +++ b/Slim/Environment.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.0 + * @version 2.3.2 * @package Slim * * MIT LICENSE diff --git a/Slim/Exception/Pass.php b/Slim/Exception/Pass.php index 2833dd0ec..1f6fb307c 100644 --- a/Slim/Exception/Pass.php +++ b/Slim/Exception/Pass.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.0 + * @version 2.3.2 * @package Slim * * MIT LICENSE diff --git a/Slim/Exception/Stop.php b/Slim/Exception/Stop.php index 8667eaeaa..5ef6ab5aa 100644 --- a/Slim/Exception/Stop.php +++ b/Slim/Exception/Stop.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.0 + * @version 2.3.2 * @package Slim * * MIT LICENSE diff --git a/Slim/Helper/Set.php b/Slim/Helper/Set.php index bd001b55c..166521126 100644 --- a/Slim/Helper/Set.php +++ b/Slim/Helper/Set.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.0 + * @version 2.3.2 * @package Slim * * MIT LICENSE diff --git a/Slim/Http/Cookies.php b/Slim/Http/Cookies.php index 61c70e742..b9a1e6450 100644 --- a/Slim/Http/Cookies.php +++ b/Slim/Http/Cookies.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.0 + * @version 2.3.2 * @package Slim * * MIT LICENSE diff --git a/Slim/Http/Headers.php b/Slim/Http/Headers.php index 5e0283e6e..882cc074f 100644 --- a/Slim/Http/Headers.php +++ b/Slim/Http/Headers.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.0 + * @version 2.3.2 * @package Slim * * MIT LICENSE diff --git a/Slim/Http/Request.php b/Slim/Http/Request.php index b7d32f985..1f6e55ff5 100644 --- a/Slim/Http/Request.php +++ b/Slim/Http/Request.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.0 + * @version 2.3.2 * @package Slim * * MIT LICENSE diff --git a/Slim/Http/Response.php b/Slim/Http/Response.php index 278bc3121..6f5922315 100644 --- a/Slim/Http/Response.php +++ b/Slim/Http/Response.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.0 + * @version 2.3.2 * @package Slim * * MIT LICENSE diff --git a/Slim/Http/Util.php b/Slim/Http/Util.php index 6aad66b3e..8db3c9d5c 100644 --- a/Slim/Http/Util.php +++ b/Slim/Http/Util.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.0 + * @version 2.3.2 * @package Slim * * MIT LICENSE diff --git a/Slim/Log.php b/Slim/Log.php index 1c679d07b..e5b7caa82 100644 --- a/Slim/Log.php +++ b/Slim/Log.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.0 + * @version 2.3.2 * @package Slim * * MIT LICENSE diff --git a/Slim/LogWriter.php b/Slim/LogWriter.php index 47c1f4e40..02687b7db 100644 --- a/Slim/LogWriter.php +++ b/Slim/LogWriter.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.0 + * @version 2.3.2 * @package Slim * * MIT LICENSE diff --git a/Slim/Middleware.php b/Slim/Middleware.php index 09ff17767..83c7cde0c 100644 --- a/Slim/Middleware.php +++ b/Slim/Middleware.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.0 + * @version 2.3.2 * @package Slim * * MIT LICENSE diff --git a/Slim/Middleware/ContentTypes.php b/Slim/Middleware/ContentTypes.php index e47ff5a43..9aaf1c0a9 100644 --- a/Slim/Middleware/ContentTypes.php +++ b/Slim/Middleware/ContentTypes.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.0 + * @version 2.3.2 * @package Slim * * MIT LICENSE diff --git a/Slim/Middleware/MethodOverride.php b/Slim/Middleware/MethodOverride.php index 5e4473e2b..b985c898e 100644 --- a/Slim/Middleware/MethodOverride.php +++ b/Slim/Middleware/MethodOverride.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.0 + * @version 2.3.2 * @package Slim * * MIT LICENSE diff --git a/Slim/Middleware/PrettyExceptions.php b/Slim/Middleware/PrettyExceptions.php index b67545e19..6e82992cb 100644 --- a/Slim/Middleware/PrettyExceptions.php +++ b/Slim/Middleware/PrettyExceptions.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.0 + * @version 2.3.2 * @package Slim * * MIT LICENSE diff --git a/Slim/Middleware/SessionCookie.php b/Slim/Middleware/SessionCookie.php index e0e7dafc5..05cb14c21 100644 --- a/Slim/Middleware/SessionCookie.php +++ b/Slim/Middleware/SessionCookie.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.0 + * @version 2.3.2 * @package Slim * * MIT LICENSE diff --git a/Slim/Router.php b/Slim/Router.php index 8f4c4fce2..85c921c80 100644 --- a/Slim/Router.php +++ b/Slim/Router.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.0 + * @version 2.3.2 * @package Slim * * MIT LICENSE diff --git a/Slim/Slim.php b/Slim/Slim.php index fd70e451c..321b51182 100644 --- a/Slim/Slim.php +++ b/Slim/Slim.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.0 + * @version 2.3.2 * @package Slim * * MIT LICENSE @@ -49,7 +49,7 @@ class Slim /** * @const string */ - const VERSION = '2.3.0'; + const VERSION = '2.3.2'; /** * @var \Slim\Helper\Set @@ -230,12 +230,12 @@ public function __set($name, $value) { $this->container[$name] = $value; } - + public function __isset($name) { return isset($this->container[$name]); } - + public function __unset($name) { unset($this->container[$name]); diff --git a/Slim/View.php b/Slim/View.php index e5be0abe3..60c04b51e 100644 --- a/Slim/View.php +++ b/Slim/View.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.0 + * @version 2.3.2 * @package Slim * * MIT LICENSE diff --git a/tests/EnvironmentTest.php b/tests/EnvironmentTest.php index e2f12d6fa..661d1cfb5 100644 --- a/tests/EnvironmentTest.php +++ b/tests/EnvironmentTest.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.0 + * @version 2.3.2 * * MIT LICENSE * diff --git a/tests/Helper/SetTest.php b/tests/Helper/SetTest.php index 86754811e..e6d0e677d 100644 --- a/tests/Helper/SetTest.php +++ b/tests/Helper/SetTest.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.0 + * @version 2.3.2 * * MIT LICENSE * diff --git a/tests/Http/CookiesTest.php b/tests/Http/CookiesTest.php index 33868cef0..8d1be1d23 100644 --- a/tests/Http/CookiesTest.php +++ b/tests/Http/CookiesTest.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.0 + * @version 2.3.2 * * MIT LICENSE * diff --git a/tests/Http/HeadersTest.php b/tests/Http/HeadersTest.php index e5fe17fe1..ad5dec6ac 100644 --- a/tests/Http/HeadersTest.php +++ b/tests/Http/HeadersTest.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.0 + * @version 2.3.2 * * MIT LICENSE * diff --git a/tests/Http/RequestTest.php b/tests/Http/RequestTest.php index 574fe1ff0..a560156c5 100644 --- a/tests/Http/RequestTest.php +++ b/tests/Http/RequestTest.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.0 + * @version 2.3.2 * * MIT LICENSE * diff --git a/tests/Http/ResponseTest.php b/tests/Http/ResponseTest.php index 85b857f35..b0a2eb41c 100644 --- a/tests/Http/ResponseTest.php +++ b/tests/Http/ResponseTest.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.0 + * @version 2.3.2 * * MIT LICENSE * diff --git a/tests/Http/UtilTest.php b/tests/Http/UtilTest.php index 03035149a..a23b3df1a 100644 --- a/tests/Http/UtilTest.php +++ b/tests/Http/UtilTest.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.0 + * @version 2.3.2 * * MIT LICENSE * diff --git a/tests/LogTest.php b/tests/LogTest.php index d56299f1f..9a96438e1 100644 --- a/tests/LogTest.php +++ b/tests/LogTest.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.0 + * @version 2.3.2 * * MIT LICENSE * diff --git a/tests/LogWriterTest.php b/tests/LogWriterTest.php index 839f09f6e..a328d6a91 100644 --- a/tests/LogWriterTest.php +++ b/tests/LogWriterTest.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.0 + * @version 2.3.2 * * MIT LICENSE * diff --git a/tests/Middleware/ContentTypesTest.php b/tests/Middleware/ContentTypesTest.php index d1a566b93..277c7a070 100644 --- a/tests/Middleware/ContentTypesTest.php +++ b/tests/Middleware/ContentTypesTest.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.0 + * @version 2.3.2 * * MIT LICENSE * diff --git a/tests/Middleware/FlashTest.php b/tests/Middleware/FlashTest.php index 82d7fbdcd..58b2cf5cf 100644 --- a/tests/Middleware/FlashTest.php +++ b/tests/Middleware/FlashTest.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.0 + * @version 2.3.2 * * MIT LICENSE * diff --git a/tests/Middleware/MethodOverrideTest.php b/tests/Middleware/MethodOverrideTest.php index af22ff185..2c27fcdb4 100644 --- a/tests/Middleware/MethodOverrideTest.php +++ b/tests/Middleware/MethodOverrideTest.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.0 + * @version 2.3.2 * * MIT LICENSE * diff --git a/tests/Middleware/PrettyExceptionsTest.php b/tests/Middleware/PrettyExceptionsTest.php index 28dabcc2f..0bdfacebb 100644 --- a/tests/Middleware/PrettyExceptionsTest.php +++ b/tests/Middleware/PrettyExceptionsTest.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.0 + * @version 2.3.2 * * MIT LICENSE * diff --git a/tests/Middleware/SessionCookieTest.php b/tests/Middleware/SessionCookieTest.php index 53a4e3fdc..068df670e 100644 --- a/tests/Middleware/SessionCookieTest.php +++ b/tests/Middleware/SessionCookieTest.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.0 + * @version 2.3.2 * * MIT LICENSE * diff --git a/tests/MiddlewareTest.php b/tests/MiddlewareTest.php index a95036a12..0fb13c45d 100644 --- a/tests/MiddlewareTest.php +++ b/tests/MiddlewareTest.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.0 + * @version 2.3.2 * * MIT LICENSE * diff --git a/tests/RouteTest.php b/tests/RouteTest.php index 31d8c4010..a7ba5ff54 100644 --- a/tests/RouteTest.php +++ b/tests/RouteTest.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.0 + * @version 2.3.2 * * MIT LICENSE * diff --git a/tests/RouterTest.php b/tests/RouterTest.php index 088c02f8a..f1c40b69b 100644 --- a/tests/RouterTest.php +++ b/tests/RouterTest.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.0 + * @version 2.3.2 * * MIT LICENSE * diff --git a/tests/SlimTest.php b/tests/SlimTest.php index e27c080ea..a3b5bb0da 100644 --- a/tests/SlimTest.php +++ b/tests/SlimTest.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.0 + * @version 2.3.2 * * MIT LICENSE * diff --git a/tests/ViewTest.php b/tests/ViewTest.php index 1f4255ad7..b81a1a17b 100644 --- a/tests/ViewTest.php +++ b/tests/ViewTest.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.0 + * @version 2.3.2 * * MIT LICENSE * From 2b12c9b076b78bdec1f30c51001ab752d282baf7 Mon Sep 17 00:00:00 2001 From: = Date: Sun, 29 Sep 2013 16:05:05 -0400 Subject: [PATCH 03/10] Bump version numbers --- Slim/Environment.php | 2 +- Slim/Exception/Pass.php | 2 +- Slim/Exception/Stop.php | 2 +- Slim/Helper/Set.php | 2 +- Slim/Http/Cookies.php | 2 +- Slim/Http/Headers.php | 2 +- Slim/Http/Request.php | 2 +- Slim/Http/Response.php | 2 +- Slim/Http/Util.php | 2 +- Slim/Log.php | 2 +- Slim/LogWriter.php | 2 +- Slim/Middleware.php | 2 +- Slim/Middleware/ContentTypes.php | 2 +- Slim/Middleware/MethodOverride.php | 2 +- Slim/Middleware/PrettyExceptions.php | 2 +- Slim/Middleware/SessionCookie.php | 2 +- Slim/Router.php | 2 +- Slim/Slim.php | 4 ++-- Slim/View.php | 2 +- tests/EnvironmentTest.php | 2 +- tests/Helper/SetTest.php | 2 +- tests/Http/CookiesTest.php | 2 +- tests/Http/HeadersTest.php | 2 +- tests/Http/RequestTest.php | 2 +- tests/Http/ResponseTest.php | 2 +- tests/Http/UtilTest.php | 2 +- tests/LogTest.php | 2 +- tests/LogWriterTest.php | 2 +- tests/Middleware/ContentTypesTest.php | 2 +- tests/Middleware/FlashTest.php | 2 +- tests/Middleware/MethodOverrideTest.php | 2 +- tests/Middleware/PrettyExceptionsTest.php | 2 +- tests/Middleware/SessionCookieTest.php | 2 +- tests/MiddlewareTest.php | 2 +- tests/RouteTest.php | 2 +- tests/RouterTest.php | 2 +- tests/SlimTest.php | 2 +- tests/ViewTest.php | 2 +- 38 files changed, 39 insertions(+), 39 deletions(-) diff --git a/Slim/Environment.php b/Slim/Environment.php index f18ee2e8d..f000f5d0f 100644 --- a/Slim/Environment.php +++ b/Slim/Environment.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.2 + * @version 2.3.3 * @package Slim * * MIT LICENSE diff --git a/Slim/Exception/Pass.php b/Slim/Exception/Pass.php index 1f6fb307c..5cd468fb9 100644 --- a/Slim/Exception/Pass.php +++ b/Slim/Exception/Pass.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.2 + * @version 2.3.3 * @package Slim * * MIT LICENSE diff --git a/Slim/Exception/Stop.php b/Slim/Exception/Stop.php index 5ef6ab5aa..66c61a601 100644 --- a/Slim/Exception/Stop.php +++ b/Slim/Exception/Stop.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.2 + * @version 2.3.3 * @package Slim * * MIT LICENSE diff --git a/Slim/Helper/Set.php b/Slim/Helper/Set.php index 166521126..df25cc0fb 100644 --- a/Slim/Helper/Set.php +++ b/Slim/Helper/Set.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.2 + * @version 2.3.3 * @package Slim * * MIT LICENSE diff --git a/Slim/Http/Cookies.php b/Slim/Http/Cookies.php index b9a1e6450..f0dc1331a 100644 --- a/Slim/Http/Cookies.php +++ b/Slim/Http/Cookies.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.2 + * @version 2.3.3 * @package Slim * * MIT LICENSE diff --git a/Slim/Http/Headers.php b/Slim/Http/Headers.php index 882cc074f..f1be97d4f 100644 --- a/Slim/Http/Headers.php +++ b/Slim/Http/Headers.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.2 + * @version 2.3.3 * @package Slim * * MIT LICENSE diff --git a/Slim/Http/Request.php b/Slim/Http/Request.php index 1f6e55ff5..fe97c0ecf 100644 --- a/Slim/Http/Request.php +++ b/Slim/Http/Request.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.2 + * @version 2.3.3 * @package Slim * * MIT LICENSE diff --git a/Slim/Http/Response.php b/Slim/Http/Response.php index 6f5922315..43c1807fe 100644 --- a/Slim/Http/Response.php +++ b/Slim/Http/Response.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.2 + * @version 2.3.3 * @package Slim * * MIT LICENSE diff --git a/Slim/Http/Util.php b/Slim/Http/Util.php index 8db3c9d5c..dd8744a8d 100644 --- a/Slim/Http/Util.php +++ b/Slim/Http/Util.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.2 + * @version 2.3.3 * @package Slim * * MIT LICENSE diff --git a/Slim/Log.php b/Slim/Log.php index e5b7caa82..5b88db846 100644 --- a/Slim/Log.php +++ b/Slim/Log.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.2 + * @version 2.3.3 * @package Slim * * MIT LICENSE diff --git a/Slim/LogWriter.php b/Slim/LogWriter.php index 02687b7db..4e29329eb 100644 --- a/Slim/LogWriter.php +++ b/Slim/LogWriter.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.2 + * @version 2.3.3 * @package Slim * * MIT LICENSE diff --git a/Slim/Middleware.php b/Slim/Middleware.php index 83c7cde0c..655915774 100644 --- a/Slim/Middleware.php +++ b/Slim/Middleware.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.2 + * @version 2.3.3 * @package Slim * * MIT LICENSE diff --git a/Slim/Middleware/ContentTypes.php b/Slim/Middleware/ContentTypes.php index 9aaf1c0a9..94b59476f 100644 --- a/Slim/Middleware/ContentTypes.php +++ b/Slim/Middleware/ContentTypes.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.2 + * @version 2.3.3 * @package Slim * * MIT LICENSE diff --git a/Slim/Middleware/MethodOverride.php b/Slim/Middleware/MethodOverride.php index b985c898e..d1deaa83f 100644 --- a/Slim/Middleware/MethodOverride.php +++ b/Slim/Middleware/MethodOverride.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.2 + * @version 2.3.3 * @package Slim * * MIT LICENSE diff --git a/Slim/Middleware/PrettyExceptions.php b/Slim/Middleware/PrettyExceptions.php index 6e82992cb..baea1520a 100644 --- a/Slim/Middleware/PrettyExceptions.php +++ b/Slim/Middleware/PrettyExceptions.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.2 + * @version 2.3.3 * @package Slim * * MIT LICENSE diff --git a/Slim/Middleware/SessionCookie.php b/Slim/Middleware/SessionCookie.php index 05cb14c21..ed2e181c6 100644 --- a/Slim/Middleware/SessionCookie.php +++ b/Slim/Middleware/SessionCookie.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.2 + * @version 2.3.3 * @package Slim * * MIT LICENSE diff --git a/Slim/Router.php b/Slim/Router.php index 85c921c80..f05adf856 100644 --- a/Slim/Router.php +++ b/Slim/Router.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.2 + * @version 2.3.3 * @package Slim * * MIT LICENSE diff --git a/Slim/Slim.php b/Slim/Slim.php index 321b51182..ac194b4c2 100644 --- a/Slim/Slim.php +++ b/Slim/Slim.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.2 + * @version 2.3.3 * @package Slim * * MIT LICENSE @@ -49,7 +49,7 @@ class Slim /** * @const string */ - const VERSION = '2.3.2'; + const VERSION = '2.3.3'; /** * @var \Slim\Helper\Set diff --git a/Slim/View.php b/Slim/View.php index 60c04b51e..df18a7389 100644 --- a/Slim/View.php +++ b/Slim/View.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.2 + * @version 2.3.3 * @package Slim * * MIT LICENSE diff --git a/tests/EnvironmentTest.php b/tests/EnvironmentTest.php index 661d1cfb5..b321b087f 100644 --- a/tests/EnvironmentTest.php +++ b/tests/EnvironmentTest.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.2 + * @version 2.3.3 * * MIT LICENSE * diff --git a/tests/Helper/SetTest.php b/tests/Helper/SetTest.php index e6d0e677d..cb55b9269 100644 --- a/tests/Helper/SetTest.php +++ b/tests/Helper/SetTest.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.2 + * @version 2.3.3 * * MIT LICENSE * diff --git a/tests/Http/CookiesTest.php b/tests/Http/CookiesTest.php index 8d1be1d23..7c584b439 100644 --- a/tests/Http/CookiesTest.php +++ b/tests/Http/CookiesTest.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.2 + * @version 2.3.3 * * MIT LICENSE * diff --git a/tests/Http/HeadersTest.php b/tests/Http/HeadersTest.php index ad5dec6ac..2ac9b00f3 100644 --- a/tests/Http/HeadersTest.php +++ b/tests/Http/HeadersTest.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.2 + * @version 2.3.3 * * MIT LICENSE * diff --git a/tests/Http/RequestTest.php b/tests/Http/RequestTest.php index a560156c5..7075b2ec3 100644 --- a/tests/Http/RequestTest.php +++ b/tests/Http/RequestTest.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.2 + * @version 2.3.3 * * MIT LICENSE * diff --git a/tests/Http/ResponseTest.php b/tests/Http/ResponseTest.php index b0a2eb41c..56a0c6c78 100644 --- a/tests/Http/ResponseTest.php +++ b/tests/Http/ResponseTest.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.2 + * @version 2.3.3 * * MIT LICENSE * diff --git a/tests/Http/UtilTest.php b/tests/Http/UtilTest.php index a23b3df1a..f438cc3bc 100644 --- a/tests/Http/UtilTest.php +++ b/tests/Http/UtilTest.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.2 + * @version 2.3.3 * * MIT LICENSE * diff --git a/tests/LogTest.php b/tests/LogTest.php index 9a96438e1..1b2ea608f 100644 --- a/tests/LogTest.php +++ b/tests/LogTest.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.2 + * @version 2.3.3 * * MIT LICENSE * diff --git a/tests/LogWriterTest.php b/tests/LogWriterTest.php index a328d6a91..474a8af9d 100644 --- a/tests/LogWriterTest.php +++ b/tests/LogWriterTest.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.2 + * @version 2.3.3 * * MIT LICENSE * diff --git a/tests/Middleware/ContentTypesTest.php b/tests/Middleware/ContentTypesTest.php index 277c7a070..088772c30 100644 --- a/tests/Middleware/ContentTypesTest.php +++ b/tests/Middleware/ContentTypesTest.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.2 + * @version 2.3.3 * * MIT LICENSE * diff --git a/tests/Middleware/FlashTest.php b/tests/Middleware/FlashTest.php index 58b2cf5cf..8874bd383 100644 --- a/tests/Middleware/FlashTest.php +++ b/tests/Middleware/FlashTest.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.2 + * @version 2.3.3 * * MIT LICENSE * diff --git a/tests/Middleware/MethodOverrideTest.php b/tests/Middleware/MethodOverrideTest.php index 2c27fcdb4..6dc607c86 100644 --- a/tests/Middleware/MethodOverrideTest.php +++ b/tests/Middleware/MethodOverrideTest.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.2 + * @version 2.3.3 * * MIT LICENSE * diff --git a/tests/Middleware/PrettyExceptionsTest.php b/tests/Middleware/PrettyExceptionsTest.php index 0bdfacebb..a251d2ee3 100644 --- a/tests/Middleware/PrettyExceptionsTest.php +++ b/tests/Middleware/PrettyExceptionsTest.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.2 + * @version 2.3.3 * * MIT LICENSE * diff --git a/tests/Middleware/SessionCookieTest.php b/tests/Middleware/SessionCookieTest.php index 068df670e..00313fc5a 100644 --- a/tests/Middleware/SessionCookieTest.php +++ b/tests/Middleware/SessionCookieTest.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.2 + * @version 2.3.3 * * MIT LICENSE * diff --git a/tests/MiddlewareTest.php b/tests/MiddlewareTest.php index 0fb13c45d..667a9c695 100644 --- a/tests/MiddlewareTest.php +++ b/tests/MiddlewareTest.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.2 + * @version 2.3.3 * * MIT LICENSE * diff --git a/tests/RouteTest.php b/tests/RouteTest.php index a7ba5ff54..dae792ad4 100644 --- a/tests/RouteTest.php +++ b/tests/RouteTest.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.2 + * @version 2.3.3 * * MIT LICENSE * diff --git a/tests/RouterTest.php b/tests/RouterTest.php index f1c40b69b..196503da3 100644 --- a/tests/RouterTest.php +++ b/tests/RouterTest.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.2 + * @version 2.3.3 * * MIT LICENSE * diff --git a/tests/SlimTest.php b/tests/SlimTest.php index a3b5bb0da..9e83a15e9 100644 --- a/tests/SlimTest.php +++ b/tests/SlimTest.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.2 + * @version 2.3.3 * * MIT LICENSE * diff --git a/tests/ViewTest.php b/tests/ViewTest.php index b81a1a17b..af8e0eba9 100644 --- a/tests/ViewTest.php +++ b/tests/ViewTest.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.3.2 + * @version 2.3.3 * * MIT LICENSE * From a35767746009ff818e6375b72f23a2cf7de5f1a4 Mon Sep 17 00:00:00 2001 From: = Date: Sun, 29 Sep 2013 16:06:05 -0400 Subject: [PATCH 04/10] Add HHVM compatibility --- Slim/Environment.php | 38 ++++++++++++-------------------------- tests/EnvironmentTest.php | 7 +++++++ 2 files changed, 19 insertions(+), 26 deletions(-) diff --git a/Slim/Environment.php b/Slim/Environment.php index f000f5d0f..e5ad74004 100644 --- a/Slim/Environment.php +++ b/Slim/Environment.php @@ -126,35 +126,21 @@ private function __construct($settings = null) //The IP $env['REMOTE_ADDR'] = $_SERVER['REMOTE_ADDR']; - /** - * Application paths - * - * This derives two paths: SCRIPT_NAME and PATH_INFO. The SCRIPT_NAME - * is the real, physical path to the application, be it in the root - * directory or a subdirectory of the public document root. The PATH_INFO is the - * virtual path to the requested resource within the application context. - * - * With htaccess, the SCRIPT_NAME will be an absolute path (without file name); - * if not using htaccess, it will also include the file name. If it is "/", - * it is set to an empty string (since it cannot have a trailing slash). - * - * The PATH_INFO will be an absolute path with a leading slash; this will be - * used for application routing. - */ - if (strpos($_SERVER['REQUEST_URI'], $_SERVER['SCRIPT_NAME']) === 0) { - $env['SCRIPT_NAME'] = $_SERVER['SCRIPT_NAME']; //Without URL rewrite + // Root URI (physical path) and resource URI (virtual path) + $scriptName = str_replace($_SERVER['DOCUMENT_ROOT'], '', $_SERVER['SCRIPT_FILENAME']); // <-- "/physical/index.php" + $requestUri = $_SERVER['REQUEST_URI']; // <-- "/physical/index.php/virtual?abc=123" or "/physical/virtual?abc=123" + $queryString = isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : ''; // <-- "abc=123" + if (strpos($requestUri, $scriptName) === false) { + // With rewriting + $env['SCRIPT_NAME'] = str_replace('/' . basename($scriptName), '', $scriptName); } else { - $env['SCRIPT_NAME'] = str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME'])); //With URL rewrite + // Without rewriting + $env['SCRIPT_NAME'] = $scriptName; } - $env['PATH_INFO'] = substr_replace($_SERVER['REQUEST_URI'], '', 0, strlen($env['SCRIPT_NAME'])); - if (strpos($env['PATH_INFO'], '?') !== false) { - $env['PATH_INFO'] = substr_replace($env['PATH_INFO'], '', strpos($env['PATH_INFO'], '?')); //query string is not removed automatically - } - $env['SCRIPT_NAME'] = rtrim($env['SCRIPT_NAME'], '/'); - $env['PATH_INFO'] = '/' . ltrim($env['PATH_INFO'], '/'); + $env['PATH_INFO'] = '/' . ltrim(str_replace(array($env['SCRIPT_NAME'], '?' . $queryString), '', $requestUri), '/'); - //The portion of the request URI following the '?' - $env['QUERY_STRING'] = isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : ''; + // Query string (without leading "?") + $env['QUERY_STRING'] = $queryString; //Name of server host that is running the script $env['SERVER_NAME'] = $_SERVER['SERVER_NAME']; diff --git a/tests/EnvironmentTest.php b/tests/EnvironmentTest.php index b321b087f..6113e6d11 100644 --- a/tests/EnvironmentTest.php +++ b/tests/EnvironmentTest.php @@ -43,6 +43,8 @@ class EnvironmentTest extends PHPUnit_Framework_TestCase */ public function setUp() { + $_SERVER['DOCUMENT_ROOT'] = '/var/www'; + $_SERVER['SCRIPT_FILENAME'] = '/var/www/foo/index.php'; $_SERVER['SERVER_NAME'] = 'slim'; $_SERVER['SERVER_PORT'] = '80'; $_SERVER['SCRIPT_NAME'] = '/foo/index.php'; @@ -106,6 +108,7 @@ public function testParsesPathsWithoutUrlRewriteInSubdirectory() */ public function testParsesPathsWithoutUrlRewriteInRootDirectory() { + $_SERVER['SCRIPT_FILENAME'] = '/var/www/index.php'; $_SERVER['REQUEST_URI'] = '/index.php/bar/xyz'; $_SERVER['SCRIPT_NAME'] = '/index.php'; $env = \Slim\Environment::getInstance(true); @@ -123,6 +126,7 @@ public function testParsesPathsWithoutUrlRewriteInRootDirectory() */ public function testParsesPathsWithoutUrlRewriteInRootDirectoryForAppRootUri() { + $_SERVER['SCRIPT_FILENAME'] = '/var/www/index.php'; $_SERVER['REQUEST_URI'] = '/index.php'; $_SERVER['SCRIPT_NAME'] = '/index.php'; unset($_SERVER['PATH_INFO']); @@ -157,6 +161,7 @@ public function testParsesPathsWithUrlRewriteInSubdirectory() */ public function testParsesPathsWithUrlRewriteInRootDirectory() { + $_SERVER['SCRIPT_FILENAME'] = '/var/www/index.php'; $_SERVER['SCRIPT_NAME'] = '/index.php'; $_SERVER['REQUEST_URI'] = '/bar/xyz'; unset($_SERVER['PATH_INFO']); @@ -175,6 +180,7 @@ public function testParsesPathsWithUrlRewriteInRootDirectory() */ public function testParsesPathsWithUrlRewriteInRootDirectoryForAppRootUri() { + $_SERVER['SCRIPT_FILENAME'] = '/var/www/index.php'; $_SERVER['REQUEST_URI'] = '/'; $_SERVER['SCRIPT_NAME'] = '/index.php'; unset($_SERVER['PATH_INFO']); @@ -224,6 +230,7 @@ public function testRemovesQueryStringFromPathInfo() */ public function testPathInfoRetainsUrlEncodedCharacters() { + $_SERVER['SCRIPT_FILENAME'] = '/var/www/index.php'; $_SERVER['SCRIPT_NAME'] = '/index.php'; $_SERVER['REQUEST_URI'] = '/foo/%23bar'; //<-- URL-encoded "#bar" $env = \Slim\Environment::getInstance(true); From 5eed4a5d156e785d3c3157f3c065f4e8c4710437 Mon Sep 17 00:00:00 2001 From: vagrant Date: Sun, 29 Sep 2013 23:26:23 +0000 Subject: [PATCH 05/10] Fix unit tests for HHVM --- Slim/Middleware/SessionCookie.php | 2 +- tests/Middleware/ContentTypesTest.php | 1 + tests/Middleware/SessionCookieTest.php | 7 +------ 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Slim/Middleware/SessionCookie.php b/Slim/Middleware/SessionCookie.php index ed2e181c6..7da0e9bf0 100644 --- a/Slim/Middleware/SessionCookie.php +++ b/Slim/Middleware/SessionCookie.php @@ -153,7 +153,7 @@ protected function saveSession() $this->settings['httponly'] ); } - session_destroy(); + // session_destroy(); } /******************************************************************************** diff --git a/tests/Middleware/ContentTypesTest.php b/tests/Middleware/ContentTypesTest.php index 088772c30..507e1c043 100644 --- a/tests/Middleware/ContentTypesTest.php +++ b/tests/Middleware/ContentTypesTest.php @@ -104,6 +104,7 @@ public function testParsesXml() */ public function testParsesXmlWithError() { + libxml_use_internal_errors(true); \Slim\Environment::mock(array( 'REQUEST_METHOD' => 'POST', 'CONTENT_TYPE' => 'application/xml', diff --git a/tests/Middleware/SessionCookieTest.php b/tests/Middleware/SessionCookieTest.php index 00313fc5a..7c96699d9 100644 --- a/tests/Middleware/SessionCookieTest.php +++ b/tests/Middleware/SessionCookieTest.php @@ -34,10 +34,6 @@ class SessionCookieTest extends PHPUnit_Framework_TestCase { public function setUp() { - if ( session_id() !== '' ) { - session_unset(); - session_destroy(); - } $_SESSION = array(); } @@ -138,8 +134,7 @@ public function testUnserializeErrorsAreCaughtAndLogged() ->getMock(); $logWriter->expects($this->once()) - ->method('write') - ->with('Error unserializing session cookie value! unserialize(): Error at offset 0 of 96 bytes', \Slim\Log::ERROR); + ->method('write'); $app = new \Slim\Slim(array( 'log.writer' => $logWriter From 29ad3bb0588b97af099a07267bfc32cef688ecb5 Mon Sep 17 00:00:00 2001 From: = Date: Sun, 29 Sep 2013 21:23:52 -0400 Subject: [PATCH 06/10] Remove vagrant files --- .vagrant.v1.1380248914 | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .vagrant.v1.1380248914 diff --git a/.vagrant.v1.1380248914 b/.vagrant.v1.1380248914 deleted file mode 100644 index d280fe710..000000000 --- a/.vagrant.v1.1380248914 +++ /dev/null @@ -1 +0,0 @@ -{"active":{"default":"d4f35030-4dba-4dbb-9110-ad346b2bbeb7"}} \ No newline at end of file From d4dbdaee4ffa9fc9d6715d7ba9b2530df664d3b8 Mon Sep 17 00:00:00 2001 From: = Date: Tue, 8 Oct 2013 13:18:08 -0400 Subject: [PATCH 07/10] Fix PrettyException middleware when custom log defined --- Slim/Middleware/PrettyExceptions.php | 1 + tests/Middleware/PrettyExceptionsTest.php | 28 +++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/Slim/Middleware/PrettyExceptions.php b/Slim/Middleware/PrettyExceptions.php index baea1520a..2834ba3f8 100644 --- a/Slim/Middleware/PrettyExceptions.php +++ b/Slim/Middleware/PrettyExceptions.php @@ -68,6 +68,7 @@ public function call() } catch (\Exception $e) { $log = $this->app->getLog(); // Force Slim to append log to env if not already $env = $this->app->environment(); + $env['slim.log'] = $log; $env['slim.log']->error($e); $this->app->contentType('text/html'); $this->app->response()->status(500); diff --git a/tests/Middleware/PrettyExceptionsTest.php b/tests/Middleware/PrettyExceptionsTest.php index a251d2ee3..8f917bbc0 100644 --- a/tests/Middleware/PrettyExceptionsTest.php +++ b/tests/Middleware/PrettyExceptionsTest.php @@ -122,4 +122,32 @@ public function testExceptionTypeIsInResponseBody() $this->assertContains('LogicException', $app->response()->body()); } + + /** + * Test with custom log + */ + public function testWithCustomLogWriter() + { + $this->setExpectedException('\LogicException'); + + \Slim\Environment::mock(array( + 'SCRIPT_NAME' => '/index.php', + 'PATH_INFO' => '/foo' + )); + $app = new \Slim\Slim(array( + 'log.enabled' => false + )); + $app->container->singleton('log', function () use ($app) { + return new \Slim\Log(new \Slim\LogWriter('php://temp')); + }); + $app->get('/foo', function () use ($app) { + throw new \LogicException('Test Message', 100); + }); + $mw = new \Slim\Middleware\PrettyExceptions(); + $mw->setApplication($app); + $mw->setNextMiddleware($app); + $mw->call(); + + $this->assertContains('LogicException', $app->response()->body()); + } } From 57f8fba3801177a80728507a683aa076f96ecc1e Mon Sep 17 00:00:00 2001 From: Samir Shah Date: Sun, 21 Jul 2013 07:23:20 +0300 Subject: [PATCH 08/10] Don't send any content when it's a HEAD request. --- Slim/Slim.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Slim/Slim.php b/Slim/Slim.php index ac194b4c2..618685292 100644 --- a/Slim/Slim.php +++ b/Slim/Slim.php @@ -1277,8 +1277,10 @@ public function run() } } - //Send body - echo $body; + //Send body, but only if it isn't a HEAD request + if (!$this->request->isHead()) { + echo $body; + } restore_error_handler(); } From 3dfc647235d03407c1a01c038c146e19ca09bd78 Mon Sep 17 00:00:00 2001 From: = Date: Tue, 8 Oct 2013 13:54:23 -0400 Subject: [PATCH 09/10] Add hhvm configuration example to README Fix inline doc versions in a few class files --- README.markdown | 22 ++++++++++++++++++++++ Slim/Middleware/Flash.php | 2 +- Slim/Route.php | 2 +- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/README.markdown b/README.markdown index 6bd9e2851..ed04fca11 100644 --- a/README.markdown +++ b/README.markdown @@ -71,6 +71,28 @@ The nginx configuration file should contain this code (along with other settings This assumes that Slim's `index.php` is in the root folder of your project (www root). +### HipHop Virtual Machine for PHP + +Your HipHop Virtual Machine configuration file should contain this code (along with other settings you may need). +Be sure you change the `ServerRoot` setting to point to your Slim app's document root directory. + + Server { + SourceRoot = /path/to/public/directory + } + + VirtualHost { + * { + Pattern = .* + RewriteRules { + * { + pattern = ^(.*)$ + to = index.php/$1 + qsa = true + } + } + } + } + #### lighttpd #### Your lighttpd configuration file should contain this code (along with other settings you may need). This code requires diff --git a/Slim/Middleware/Flash.php b/Slim/Middleware/Flash.php index 43ca9e960..87f21f8f1 100644 --- a/Slim/Middleware/Flash.php +++ b/Slim/Middleware/Flash.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.2.0 + * @version 2.3.3 * @package Slim * * MIT LICENSE diff --git a/Slim/Route.php b/Slim/Route.php index d1f7fbf77..f3ff026c9 100644 --- a/Slim/Route.php +++ b/Slim/Route.php @@ -6,7 +6,7 @@ * @copyright 2011 Josh Lockhart * @link http://www.slimframework.com * @license http://www.slimframework.com/license - * @version 2.0.0 + * @version 2.3.3 * @package Slim * * MIT LICENSE From 1817ff97604c99fe6bfd98862b269cab12000482 Mon Sep 17 00:00:00 2001 From: = Date: Tue, 8 Oct 2013 13:55:00 -0400 Subject: [PATCH 10/10] Fix README typo --- README.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index ed04fca11..2f154596f 100644 --- a/README.markdown +++ b/README.markdown @@ -71,7 +71,7 @@ The nginx configuration file should contain this code (along with other settings This assumes that Slim's `index.php` is in the root folder of your project (www root). -### HipHop Virtual Machine for PHP +#### HipHop Virtual Machine for PHP Your HipHop Virtual Machine configuration file should contain this code (along with other settings you may need). Be sure you change the `ServerRoot` setting to point to your Slim app's document root directory.