From c26df7001b95e1a319b8f58d2f1aca82dd87f833 Mon Sep 17 00:00:00 2001 From: mark_story Date: Tue, 22 May 2012 21:37:45 -0400 Subject: [PATCH 1/4] Update version number to 2.1.3 --- lib/Cake/VERSION.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/VERSION.txt b/lib/Cake/VERSION.txt index 2225bff48..292511c5b 100644 --- a/lib/Cake/VERSION.txt +++ b/lib/Cake/VERSION.txt @@ -17,4 +17,4 @@ // @license MIT License (http://www.opensource.org/licenses/mit-license.php) // +--------------------------------------------------------------------------------------------+ // //////////////////////////////////////////////////////////////////////////////////////////////////// -2.1.2 +2.1.3 From 5270721adee6aa4b2d07a61f589f729092ab9632 Mon Sep 17 00:00:00 2001 From: mark_story Date: Tue, 22 May 2012 22:33:46 -0400 Subject: [PATCH 2/4] Remove bonus intval() It caused issues when getting numeric keys that exceeded PHP_INT_MAX. Fixes #2897 --- lib/Cake/Test/Case/Utility/SetTest.php | 14 ++++++++++++++ lib/Cake/Utility/Set.php | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Test/Case/Utility/SetTest.php b/lib/Cake/Test/Case/Utility/SetTest.php index 7c6b7fcb2..293ee8576 100644 --- a/lib/Cake/Test/Case/Utility/SetTest.php +++ b/lib/Cake/Test/Case/Utility/SetTest.php @@ -1657,6 +1657,20 @@ class SetTest extends CakeTestCase { $this->assertEquals($expected, $result); } +/** + * test classicExtract with keys that exceed 32bit max int. + * + * @return void + */ + public function testClassicExtractMaxInt() { + $data = array( + 'Data' => array( + '13376924712' => 'abc' + ) + ); + $this->assertEquals('abc', Set::classicExtract($data, 'Data.13376924712')); + } + /** * testInsert method * diff --git a/lib/Cake/Utility/Set.php b/lib/Cake/Utility/Set.php index e568763ba..430824274 100644 --- a/lib/Cake/Utility/Set.php +++ b/lib/Cake/Utility/Set.php @@ -603,8 +603,8 @@ class Set { foreach ($path as $i => $key) { if (is_numeric($key) && intval($key) > 0 || $key === '0') { - if (isset($data[intval($key)])) { - $data = $data[intval($key)]; + if (isset($data[$key])) { + $data = $data[$key]; } else { return null; } From aa85451159d4875d3f3cf8e82cd0106816bd7e2c Mon Sep 17 00:00:00 2001 From: mark_story Date: Wed, 23 May 2012 19:52:29 -0400 Subject: [PATCH 3/4] Fix incorrect return type. --- lib/Cake/Network/CakeRequest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/Network/CakeRequest.php b/lib/Cake/Network/CakeRequest.php index e665db301..2b272b815 100644 --- a/lib/Cake/Network/CakeRequest.php +++ b/lib/Cake/Network/CakeRequest.php @@ -615,7 +615,7 @@ class CakeRequest implements ArrayAccess { /** * Get the host that the request was handled on. * - * @return void + * @return string */ public function host() { return env('HTTP_HOST'); From b27a3aab7b1c416c3c9f3472dea6b14bb5156983 Mon Sep 17 00:00:00 2001 From: mark_story Date: Wed, 23 May 2012 22:25:19 -0400 Subject: [PATCH 4/4] Set session.gc_maxlifetime by default. In the default case of using files for sessions, files could be garbage collected earlier than expected based on other session settings. Always set session.gc_maxlifetime so session files are garbage collected correctly. Fixes #2901 --- lib/Cake/Model/Datasource/CakeSession.php | 3 +++ lib/Cake/Test/Case/Model/Datasource/CakeSessionTest.php | 2 ++ 2 files changed, 5 insertions(+) diff --git a/lib/Cake/Model/Datasource/CakeSession.php b/lib/Cake/Model/Datasource/CakeSession.php index ddd73a633..46facb37b 100644 --- a/lib/Cake/Model/Datasource/CakeSession.php +++ b/lib/Cake/Model/Datasource/CakeSession.php @@ -470,6 +470,9 @@ class CakeSession { if (!empty($sessionConfig['handler'])) { $sessionConfig['ini']['session.save_handler'] = 'user'; } + if (!isset($sessionConfig['ini']['session.gc_maxlifetime'])) { + $sessionConfig['ini']['session.gc_maxlifetime'] = $sessionConfig['timeout'] * 60; + } if (empty($_SESSION)) { if (!empty($sessionConfig['ini']) && is_array($sessionConfig['ini'])) { diff --git a/lib/Cake/Test/Case/Model/Datasource/CakeSessionTest.php b/lib/Cake/Test/Case/Model/Datasource/CakeSessionTest.php index a62951cc2..21b220800 100644 --- a/lib/Cake/Test/Case/Model/Datasource/CakeSessionTest.php +++ b/lib/Cake/Test/Case/Model/Datasource/CakeSessionTest.php @@ -715,6 +715,8 @@ class CakeSessionTest extends CakeTestCase { TestCakeSession::start(); $this->assertEquals(400, Configure::read('Session.cookieTimeout')); $this->assertEquals(400, Configure::read('Session.timeout')); + $this->assertEquals(400 * 60, ini_get('session.cookie_lifetime')); + $this->assertEquals(400 * 60, ini_get('session.gc_maxlifetime')); $_SESSION = null; Configure::write('Session', array(