From ddfb7d649ef74ed5b4bed3034e2e32664d02a9eb Mon Sep 17 00:00:00 2001 From: Mark Scherer Date: Tue, 10 Nov 2015 00:11:48 +0100 Subject: [PATCH 01/43] Enable PHP7.0 in travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 69e87f0e9..fc7ba6173 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ php: - 5.4 - 5.5 - 5.6 + - 7.0 env: - DB=mysql From 7982b6b078da74474f50aea776d4f623c7763e16 Mon Sep 17 00:00:00 2001 From: Mark Scherer Date: Tue, 10 Nov 2015 00:14:04 +0100 Subject: [PATCH 02/43] Allow ParseError as exception and remove typehint. --- lib/Cake/Error/ErrorHandler.php | 4 ++-- lib/Cake/Error/ExceptionRenderer.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Cake/Error/ErrorHandler.php b/lib/Cake/Error/ErrorHandler.php index 3192ed5f8..d99e79cbe 100644 --- a/lib/Cake/Error/ErrorHandler.php +++ b/lib/Cake/Error/ErrorHandler.php @@ -109,11 +109,11 @@ class ErrorHandler { * This will either use custom exception renderer class if configured, * or use the default ExceptionRenderer. * - * @param Exception $exception The exception to render. + * @param Exception|ParseError $exception The exception to render. * @return void * @see http://php.net/manual/en/function.set-exception-handler.php */ - public static function handleException(Exception $exception) { + public static function handleException($exception) { $config = Configure::read('Exception'); static::_log($exception, $config); diff --git a/lib/Cake/Error/ExceptionRenderer.php b/lib/Cake/Error/ExceptionRenderer.php index 04190eba5..a245b64ee 100644 --- a/lib/Cake/Error/ExceptionRenderer.php +++ b/lib/Cake/Error/ExceptionRenderer.php @@ -86,9 +86,9 @@ class ExceptionRenderer { * If the error is a CakeException it will be converted to either a 400 or a 500 * code error depending on the code used to construct the error. * - * @param Exception $exception Exception + * @param Exception|ParseError $exception Exception */ - public function __construct(Exception $exception) { + public function __construct($exception) { $this->controller = $this->_getController($exception); if (method_exists($this->controller, 'appError')) { From 8c5f78bc582a7cba471e1b3cf74a4b782dc4b119 Mon Sep 17 00:00:00 2001 From: Mark Scherer Date: Tue, 10 Nov 2015 00:32:48 +0100 Subject: [PATCH 03/43] Remove another type hint --- lib/Cake/Console/ConsoleErrorHandler.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Console/ConsoleErrorHandler.php b/lib/Cake/Console/ConsoleErrorHandler.php index a488b10f9..7cbb2df15 100644 --- a/lib/Cake/Console/ConsoleErrorHandler.php +++ b/lib/Cake/Console/ConsoleErrorHandler.php @@ -49,10 +49,10 @@ class ConsoleErrorHandler { /** * Handle an exception in the console environment. Prints a message to stderr. * - * @param Exception $exception The exception to handle + * @param Exception|ParserError $exception The exception to handle * @return void */ - public function handleException(Exception $exception) { + public function handleException($exception) { $stderr = static::getStderr(); $stderr->write(__d('cake_console', "Error: %s\n%s", $exception->getMessage(), From f662b2f5aa81fbe504e32026ceb12cf0990119d8 Mon Sep 17 00:00:00 2001 From: Mark Scherer Date: Sun, 6 Dec 2015 12:50:09 +0100 Subject: [PATCH 04/43] Skip error for now. --- .../Case/Controller/Component/Auth/ControllerAuthorizeTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/Cake/Test/Case/Controller/Component/Auth/ControllerAuthorizeTest.php b/lib/Cake/Test/Case/Controller/Component/Auth/ControllerAuthorizeTest.php index 80bb5c258..4bd012738 100644 --- a/lib/Cake/Test/Case/Controller/Component/Auth/ControllerAuthorizeTest.php +++ b/lib/Cake/Test/Case/Controller/Component/Auth/ControllerAuthorizeTest.php @@ -51,6 +51,8 @@ class ControllerAuthorizeTest extends CakeTestCase { * @return void */ public function testControllerTypeError() { + $this->skipIf(version_compare(PHP_VERSION, '7.0', '<='), 'PHP Type Error in PHP7+'); + $this->auth->controller(new StdClass()); } From 2fdd3030e22794d638313a83cf4222ed14407779 Mon Sep 17 00:00:00 2001 From: Kars Frijters Date: Mon, 7 Dec 2015 16:25:14 +0100 Subject: [PATCH 05/43] Removed last typehint Exception #7671 Removed last typehint Exception as it was still giving an uncaught typeError message in PHP7 --- lib/Cake/Error/ErrorHandler.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Error/ErrorHandler.php b/lib/Cake/Error/ErrorHandler.php index d99e79cbe..9da40a660 100644 --- a/lib/Cake/Error/ErrorHandler.php +++ b/lib/Cake/Error/ErrorHandler.php @@ -169,11 +169,11 @@ class ErrorHandler { /** * Handles exception logging * - * @param Exception $exception The exception to render. + * @param Exception|ParseError $exception The exception to render. * @param array $config An array of configuration for logging. * @return bool */ - protected static function _log(Exception $exception, $config) { + protected static function _log($exception, $config) { if (empty($config['log'])) { return false; } From 48e018e70769ccee0888bfdb1bdb09adaf528fc7 Mon Sep 17 00:00:00 2001 From: "Larry E. Masters" Date: Sun, 13 Dec 2015 14:12:31 -0600 Subject: [PATCH 06/43] Allowing tests to run on PHP 7 --- .../Controller/Component/Auth/ControllerAuthorizeTest.php | 8 +++++--- lib/Cake/Test/Case/Core/ConfigureTest.php | 7 ++++++- .../Test/Case/Model/Datasource/Database/MysqlTest.php | 6 +++++- lib/Cake/Test/Case/Model/ModelValidationTest.php | 6 +++++- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/lib/Cake/Test/Case/Controller/Component/Auth/ControllerAuthorizeTest.php b/lib/Cake/Test/Case/Controller/Component/Auth/ControllerAuthorizeTest.php index 4bd012738..9cf2aef86 100644 --- a/lib/Cake/Test/Case/Controller/Component/Auth/ControllerAuthorizeTest.php +++ b/lib/Cake/Test/Case/Controller/Component/Auth/ControllerAuthorizeTest.php @@ -51,9 +51,11 @@ class ControllerAuthorizeTest extends CakeTestCase { * @return void */ public function testControllerTypeError() { - $this->skipIf(version_compare(PHP_VERSION, '7.0', '<='), 'PHP Type Error in PHP7+'); - - $this->auth->controller(new StdClass()); + try { + $this->auth->controller(new StdClass()); + } catch (Throwable $t) { + throw new PHPUnit_Framework_Error($t); + } } /** diff --git a/lib/Cake/Test/Case/Core/ConfigureTest.php b/lib/Cake/Test/Case/Core/ConfigureTest.php index 744932dac..988d897dc 100644 --- a/lib/Cake/Test/Case/Core/ConfigureTest.php +++ b/lib/Cake/Test/Case/Core/ConfigureTest.php @@ -454,7 +454,12 @@ class ConfigureTest extends CakeTestCase { */ public function testReaderExceptionOnIncorrectClass() { $reader = new StdClass(); - Configure::config('test', $reader); + + try { + Configure::config('test', $reader); + } catch (Throwable $t) { + throw new PHPUnit_Framework_Error($t); + } } /** diff --git a/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php b/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php index 6ad52f539..49f5ab7b4 100644 --- a/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php +++ b/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php @@ -2912,7 +2912,11 @@ SQL; * @return void */ public function testDropSchemaNoSchema() { - $this->Dbo->dropSchema(null); + try { + $this->Dbo->dropSchema(null); + } catch (Throwable $t) { + throw new PHPUnit_Framework_Error($t); + } } /** diff --git a/lib/Cake/Test/Case/Model/ModelValidationTest.php b/lib/Cake/Test/Case/Model/ModelValidationTest.php index bd65b16e9..43d968ac9 100644 --- a/lib/Cake/Test/Case/Model/ModelValidationTest.php +++ b/lib/Cake/Test/Case/Model/ModelValidationTest.php @@ -2227,7 +2227,11 @@ class ModelValidationTest extends BaseModelTest { * @return void */ public function testValidatorTypehintException() { - new ModelValidator('asdasds'); + try { + new ModelValidator('asdasds'); + } catch (Throwable $t) { + throw new PHPUnit_Framework_Error($t); + } } /** From 6a68032e0b6d6115e0c47ee5615a8ba82245561d Mon Sep 17 00:00:00 2001 From: "Larry E. Masters" Date: Sun, 13 Dec 2015 14:18:59 -0600 Subject: [PATCH 07/43] FIxing srand() expects parameter 1 to be integer, string given Type casting to integer --- lib/Cake/Utility/Security.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/Utility/Security.php b/lib/Cake/Utility/Security.php index 6ad3c01c1..511cf5efc 100644 --- a/lib/Cake/Utility/Security.php +++ b/lib/Cake/Utility/Security.php @@ -187,7 +187,7 @@ class Security { return ''; } - srand(Configure::read('Security.cipherSeed')); + srand((int)Configure::read('Security.cipherSeed')); $out = ''; $keyLength = strlen($key); for ($i = 0, $textLength = strlen($text); $i < $textLength; $i++) { From 894d233fd68d25236c63024d63ad82732573a723 Mon Sep 17 00:00:00 2001 From: "Larry E. Masters" Date: Sun, 13 Dec 2015 15:16:49 -0600 Subject: [PATCH 08/43] add @throws anotation to fix travis PHP_CODESNIFFER warnings --- .../Case/Controller/Component/Auth/ControllerAuthorizeTest.php | 1 + lib/Cake/Test/Case/Core/ConfigureTest.php | 1 + lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php | 1 + lib/Cake/Test/Case/Model/ModelValidationTest.php | 1 + 4 files changed, 4 insertions(+) diff --git a/lib/Cake/Test/Case/Controller/Component/Auth/ControllerAuthorizeTest.php b/lib/Cake/Test/Case/Controller/Component/Auth/ControllerAuthorizeTest.php index 9cf2aef86..3216cdc3a 100644 --- a/lib/Cake/Test/Case/Controller/Component/Auth/ControllerAuthorizeTest.php +++ b/lib/Cake/Test/Case/Controller/Component/Auth/ControllerAuthorizeTest.php @@ -48,6 +48,7 @@ class ControllerAuthorizeTest extends CakeTestCase { * testControllerTypeError * * @expectedException PHPUnit_Framework_Error + * @throws PHPUnit_Framework_Error * @return void */ public function testControllerTypeError() { diff --git a/lib/Cake/Test/Case/Core/ConfigureTest.php b/lib/Cake/Test/Case/Core/ConfigureTest.php index 988d897dc..6a1b4bbbd 100644 --- a/lib/Cake/Test/Case/Core/ConfigureTest.php +++ b/lib/Cake/Test/Case/Core/ConfigureTest.php @@ -450,6 +450,7 @@ class ConfigureTest extends CakeTestCase { * test reader() throwing exceptions on missing interface. * * @expectedException PHPUnit_Framework_Error + * @throws PHPUnit_Framework_Error * @return void */ public function testReaderExceptionOnIncorrectClass() { diff --git a/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php b/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php index 49f5ab7b4..aa1353ecf 100644 --- a/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php +++ b/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php @@ -2909,6 +2909,7 @@ SQL; * testDropSchemaNoSchema method * * @expectedException PHPUnit_Framework_Error + * @throws PHPUnit_Framework_Error * @return void */ public function testDropSchemaNoSchema() { diff --git a/lib/Cake/Test/Case/Model/ModelValidationTest.php b/lib/Cake/Test/Case/Model/ModelValidationTest.php index 43d968ac9..1636f7a21 100644 --- a/lib/Cake/Test/Case/Model/ModelValidationTest.php +++ b/lib/Cake/Test/Case/Model/ModelValidationTest.php @@ -2224,6 +2224,7 @@ class ModelValidationTest extends BaseModelTest { * Test that type hint exception is thrown * * @expectedException PHPUnit_Framework_Error + * @throws PHPUnit_Framework_Error * @return void */ public function testValidatorTypehintException() { From 130e854c30f11a125dbc4ce783e370a7df6b81fb Mon Sep 17 00:00:00 2001 From: "Larry E. Masters" Date: Sun, 13 Dec 2015 15:38:39 -0600 Subject: [PATCH 09/43] Adding missing @return tag in function comment --- lib/Cake/Network/CakeSocket.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Cake/Network/CakeSocket.php b/lib/Cake/Network/CakeSocket.php index 74f2b60c0..1977a1541 100644 --- a/lib/Cake/Network/CakeSocket.php +++ b/lib/Cake/Network/CakeSocket.php @@ -200,6 +200,7 @@ class CakeSocket { * Configure the SSL context options. * * @param string $host The host name being connected to. + * @return void */ protected function _setSslContext($host) { foreach ($this->config as $key => $value) { From fac95baee7de3e40c241cca8ab8386607d547411 Mon Sep 17 00:00:00 2001 From: "Larry E. Masters" Date: Sun, 13 Dec 2015 19:19:11 -0600 Subject: [PATCH 10/43] Forcing bool return --- lib/Cake/Cache/Cache.php | 4 ++-- lib/Cake/Model/Datasource/CakeSession.php | 2 +- lib/Cake/Model/Datasource/Session/CacheSession.php | 2 +- lib/Cake/Model/Datasource/Session/DatabaseSession.php | 8 ++++---- .../Model/Datasource/Session/TestAppLibSession.php | 4 ++++ .../Model/Datasource/Session/TestPluginSession.php | 3 +++ 6 files changed, 15 insertions(+), 8 deletions(-) diff --git a/lib/Cake/Cache/Cache.php b/lib/Cake/Cache/Cache.php index 2cba7dadc..aa00f542d 100644 --- a/lib/Cake/Cache/Cache.php +++ b/lib/Cake/Cache/Cache.php @@ -278,7 +278,7 @@ class Cache { * @return void */ public static function gc($config = 'default', $expires = null) { - static::$_engines[$config]->gc($expires); + return (bool)static::$_engines[$config]->gc($expires); } /** @@ -452,7 +452,7 @@ class Cache { $success = static::$_engines[$config]->delete($settings['prefix'] . $key); static::set(null, $config); - return $success; + return (bool)$success; } /** diff --git a/lib/Cake/Model/Datasource/CakeSession.php b/lib/Cake/Model/Datasource/CakeSession.php index b3b471686..fe601b4d3 100644 --- a/lib/Cake/Model/Datasource/CakeSession.php +++ b/lib/Cake/Model/Datasource/CakeSession.php @@ -143,7 +143,7 @@ class CakeSession { public static function init($base = null) { static::$time = time(); - if (env('HTTP_USER_AGENT')) { + if (env('HTTP_USER_AGENT') && !static::$_userAgent) { static::$_userAgent = md5(env('HTTP_USER_AGENT') . Configure::read('Security.salt')); } diff --git a/lib/Cake/Model/Datasource/Session/CacheSession.php b/lib/Cake/Model/Datasource/Session/CacheSession.php index 793701992..d0540bcb7 100644 --- a/lib/Cake/Model/Datasource/Session/CacheSession.php +++ b/lib/Cake/Model/Datasource/Session/CacheSession.php @@ -83,7 +83,7 @@ class CacheSession implements CakeSessionHandlerInterface { * @return bool Success */ public function gc($expires = null) { - return Cache::gc(Configure::read('Session.handler.config'), $expires); + return (bool)Cache::gc(Configure::read('Session.handler.config'), $expires); } } diff --git a/lib/Cake/Model/Datasource/Session/DatabaseSession.php b/lib/Cake/Model/Datasource/Session/DatabaseSession.php index 81cd708e8..f5626808b 100644 --- a/lib/Cake/Model/Datasource/Session/DatabaseSession.php +++ b/lib/Cake/Model/Datasource/Session/DatabaseSession.php @@ -123,9 +123,9 @@ class DatabaseSession implements CakeSessionHandlerInterface { 'counterCache' => false ); try { - return $this->_model->save($record, $options); + return (bool)$this->_model->save($record, $options); } catch (PDOException $e) { - return $this->_model->save($record, $options); + return (bool)$this->_model->save($record, $options); } } @@ -136,7 +136,7 @@ class DatabaseSession implements CakeSessionHandlerInterface { * @return bool True for successful delete, false otherwise. */ public function destroy($id) { - return $this->_model->delete($id); + return (bool)$this->_model->delete($id); } /** @@ -151,7 +151,7 @@ class DatabaseSession implements CakeSessionHandlerInterface { } else { $expires = time() - $expires; } - return $this->_model->deleteAll(array($this->_model->alias . ".expires <" => $expires), false, false); + return (bool)$this->_model->deleteAll(array($this->_model->alias . ".expires <" => $expires), false, false); } } diff --git a/lib/Cake/Test/test_app/Model/Datasource/Session/TestAppLibSession.php b/lib/Cake/Test/test_app/Model/Datasource/Session/TestAppLibSession.php index 2ba874dba..4d509d3c4 100644 --- a/lib/Cake/Test/test_app/Model/Datasource/Session/TestAppLibSession.php +++ b/lib/Cake/Test/test_app/Model/Datasource/Session/TestAppLibSession.php @@ -12,6 +12,7 @@ class TestAppLibSession implements CakeSessionHandlerInterface { } public function close() { + return true; } public function read($id) { @@ -21,9 +22,12 @@ class TestAppLibSession implements CakeSessionHandlerInterface { } public function destroy($id) { + return true; } public function gc($expires = null) { + return true; } + } diff --git a/lib/Cake/Test/test_app/Plugin/TestPlugin/Model/Datasource/Session/TestPluginSession.php b/lib/Cake/Test/test_app/Plugin/TestPlugin/Model/Datasource/Session/TestPluginSession.php index acad188e0..92a2817a1 100644 --- a/lib/Cake/Test/test_app/Plugin/TestPlugin/Model/Datasource/Session/TestPluginSession.php +++ b/lib/Cake/Test/test_app/Plugin/TestPlugin/Model/Datasource/Session/TestPluginSession.php @@ -12,6 +12,7 @@ class TestPluginSession implements CakeSessionHandlerInterface { } public function close() { + return true; } public function read($id) { @@ -21,9 +22,11 @@ class TestPluginSession implements CakeSessionHandlerInterface { } public function destroy($id) { + return true; } public function gc($expires = null) { + return true; } } From 26ea74cbcff8690f04686940dc7dff708744642d Mon Sep 17 00:00:00 2001 From: "Larry E. Masters" Date: Sun, 13 Dec 2015 20:06:05 -0600 Subject: [PATCH 11/43] Forcing bool --- lib/Cake/Cache/Cache.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/Cache/Cache.php b/lib/Cake/Cache/Cache.php index aa00f542d..078f2f539 100644 --- a/lib/Cake/Cache/Cache.php +++ b/lib/Cake/Cache/Cache.php @@ -278,7 +278,7 @@ class Cache { * @return void */ public static function gc($config = 'default', $expires = null) { - return (bool)static::$_engines[$config]->gc($expires); + return static::$_engines[$config]->gc($expires); } /** From 8f52cefdccceb44a5e2e705261780a95d971c29c Mon Sep 17 00:00:00 2001 From: "Larry E. Masters" Date: Mon, 14 Dec 2015 09:17:29 -0600 Subject: [PATCH 12/43] Changing where bool is returned --- lib/Cake/Cache/Cache.php | 4 ++-- lib/Cake/Model/Datasource/Session/CacheSession.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Cake/Cache/Cache.php b/lib/Cake/Cache/Cache.php index 078f2f539..2cba7dadc 100644 --- a/lib/Cake/Cache/Cache.php +++ b/lib/Cake/Cache/Cache.php @@ -278,7 +278,7 @@ class Cache { * @return void */ public static function gc($config = 'default', $expires = null) { - return static::$_engines[$config]->gc($expires); + static::$_engines[$config]->gc($expires); } /** @@ -452,7 +452,7 @@ class Cache { $success = static::$_engines[$config]->delete($settings['prefix'] . $key); static::set(null, $config); - return (bool)$success; + return $success; } /** diff --git a/lib/Cake/Model/Datasource/Session/CacheSession.php b/lib/Cake/Model/Datasource/Session/CacheSession.php index d0540bcb7..05a604dec 100644 --- a/lib/Cake/Model/Datasource/Session/CacheSession.php +++ b/lib/Cake/Model/Datasource/Session/CacheSession.php @@ -73,7 +73,7 @@ class CacheSession implements CakeSessionHandlerInterface { * @return bool True for successful delete, false otherwise. */ public function destroy($id) { - return Cache::delete($id, Configure::read('Session.handler.config')); + return (bool)Cache::delete($id, Configure::read('Session.handler.config')); } /** From 439a33c70827d0986986ca9ad8c3b3daf94fb84f Mon Sep 17 00:00:00 2001 From: "Larry E. Masters" Date: Mon, 14 Dec 2015 10:42:46 -0600 Subject: [PATCH 13/43] Using better way to check for active session --- lib/Cake/Model/Datasource/CakeSession.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/Model/Datasource/CakeSession.php b/lib/Cake/Model/Datasource/CakeSession.php index fe601b4d3..2afbcc0c3 100644 --- a/lib/Cake/Model/Datasource/CakeSession.php +++ b/lib/Cake/Model/Datasource/CakeSession.php @@ -218,7 +218,7 @@ class CakeSession { * @return bool True if session has been started. */ public static function started() { - return isset($_SESSION) && session_id(); + return (session_status() === PHP_SESSION_ACTIVE); } /** From 6e09e64432e5d517c74970d5ae9bbe49ab2db192 Mon Sep 17 00:00:00 2001 From: "Larry E. Masters" Date: Mon, 14 Dec 2015 10:46:16 -0600 Subject: [PATCH 14/43] Correcting return --- lib/Cake/Cache/Cache.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Cache/Cache.php b/lib/Cake/Cache/Cache.php index 2cba7dadc..a7a01d0a1 100644 --- a/lib/Cake/Cache/Cache.php +++ b/lib/Cake/Cache/Cache.php @@ -275,10 +275,10 @@ class Cache { * * @param string $config [optional] The config name you wish to have garbage collected. Defaults to 'default' * @param int $expires [optional] An expires timestamp. Defaults to NULL - * @return void + * @return bool */ public static function gc($config = 'default', $expires = null) { - static::$_engines[$config]->gc($expires); + return static::$_engines[$config]->gc($expires); } /** From da9b6453cee2f025aecb9ab30c9d3029fbf527db Mon Sep 17 00:00:00 2001 From: "Larry E. Masters" Date: Mon, 14 Dec 2015 10:56:55 -0600 Subject: [PATCH 15/43] session_status() not available until 5.4 Adding check for php version --- lib/Cake/Model/Datasource/CakeSession.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Model/Datasource/CakeSession.php b/lib/Cake/Model/Datasource/CakeSession.php index 2afbcc0c3..3ef115056 100644 --- a/lib/Cake/Model/Datasource/CakeSession.php +++ b/lib/Cake/Model/Datasource/CakeSession.php @@ -218,7 +218,10 @@ class CakeSession { * @return bool True if session has been started. */ public static function started() { - return (session_status() === PHP_SESSION_ACTIVE); + if(PHP_VERSION >=5.4) { + return (session_status() === PHP_SESSION_ACTIVE); + } + return isset($_SESSION) && session_id(); } /** From 1cc5c8cf7fe131f1389391fcd83f02168ba07a74 Mon Sep 17 00:00:00 2001 From: "Larry E. Masters" Date: Mon, 14 Dec 2015 19:25:36 -0600 Subject: [PATCH 16/43] Revert "Adding missing @return tag in function comment" This reverts commit 130e854c30f11a125dbc4ce783e370a7df6b81fb. --- lib/Cake/Network/CakeSocket.php | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/Cake/Network/CakeSocket.php b/lib/Cake/Network/CakeSocket.php index 1977a1541..74f2b60c0 100644 --- a/lib/Cake/Network/CakeSocket.php +++ b/lib/Cake/Network/CakeSocket.php @@ -200,7 +200,6 @@ class CakeSocket { * Configure the SSL context options. * * @param string $host The host name being connected to. - * @return void */ protected function _setSslContext($host) { foreach ($this->config as $key => $value) { From 5790d49f5b8215466fbfdc7b49cce6d176424b7d Mon Sep 17 00:00:00 2001 From: "Larry E. Masters" Date: Mon, 14 Dec 2015 19:28:25 -0600 Subject: [PATCH 17/43] Revert "Revert "Adding missing @return tag in function comment"" This reverts commit 1cc5c8cf7fe131f1389391fcd83f02168ba07a74. --- lib/Cake/Network/CakeSocket.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Cake/Network/CakeSocket.php b/lib/Cake/Network/CakeSocket.php index 74f2b60c0..1977a1541 100644 --- a/lib/Cake/Network/CakeSocket.php +++ b/lib/Cake/Network/CakeSocket.php @@ -200,6 +200,7 @@ class CakeSocket { * Configure the SSL context options. * * @param string $host The host name being connected to. + * @return void */ protected function _setSslContext($host) { foreach ($this->config as $key => $value) { From 1a3598c3f42c8c5d9349ebc69a7c9361cb0cd01e Mon Sep 17 00:00:00 2001 From: "Larry E. Masters" Date: Mon, 14 Dec 2015 19:29:08 -0600 Subject: [PATCH 18/43] Revert "session_status() not available until 5.4" This reverts commit da9b6453cee2f025aecb9ab30c9d3029fbf527db. --- lib/Cake/Model/Datasource/CakeSession.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/Cake/Model/Datasource/CakeSession.php b/lib/Cake/Model/Datasource/CakeSession.php index 3ef115056..2afbcc0c3 100644 --- a/lib/Cake/Model/Datasource/CakeSession.php +++ b/lib/Cake/Model/Datasource/CakeSession.php @@ -218,10 +218,7 @@ class CakeSession { * @return bool True if session has been started. */ public static function started() { - if(PHP_VERSION >=5.4) { - return (session_status() === PHP_SESSION_ACTIVE); - } - return isset($_SESSION) && session_id(); + return (session_status() === PHP_SESSION_ACTIVE); } /** From 975262b03e87ec0472a97a123dee4663ca54c25f Mon Sep 17 00:00:00 2001 From: "Larry E. Masters" Date: Mon, 14 Dec 2015 19:30:16 -0600 Subject: [PATCH 19/43] Revert "Correcting return" This reverts commit 6e09e64432e5d517c74970d5ae9bbe49ab2db192. --- lib/Cake/Cache/Cache.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Cache/Cache.php b/lib/Cake/Cache/Cache.php index a7a01d0a1..2cba7dadc 100644 --- a/lib/Cake/Cache/Cache.php +++ b/lib/Cake/Cache/Cache.php @@ -275,10 +275,10 @@ class Cache { * * @param string $config [optional] The config name you wish to have garbage collected. Defaults to 'default' * @param int $expires [optional] An expires timestamp. Defaults to NULL - * @return bool + * @return void */ public static function gc($config = 'default', $expires = null) { - return static::$_engines[$config]->gc($expires); + static::$_engines[$config]->gc($expires); } /** From 464a266fc72d47a327fb9a115ddc24f950f70bbe Mon Sep 17 00:00:00 2001 From: "Larry E. Masters" Date: Mon, 14 Dec 2015 19:30:24 -0600 Subject: [PATCH 20/43] Revert "Using better way to check for active session" This reverts commit 439a33c70827d0986986ca9ad8c3b3daf94fb84f. --- lib/Cake/Model/Datasource/CakeSession.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/Model/Datasource/CakeSession.php b/lib/Cake/Model/Datasource/CakeSession.php index 2afbcc0c3..fe601b4d3 100644 --- a/lib/Cake/Model/Datasource/CakeSession.php +++ b/lib/Cake/Model/Datasource/CakeSession.php @@ -218,7 +218,7 @@ class CakeSession { * @return bool True if session has been started. */ public static function started() { - return (session_status() === PHP_SESSION_ACTIVE); + return isset($_SESSION) && session_id(); } /** From dd211e9158fb029618f83371e8f25121150907ab Mon Sep 17 00:00:00 2001 From: "Larry E. Masters" Date: Mon, 14 Dec 2015 19:30:42 -0600 Subject: [PATCH 21/43] Revert "Changing where bool is returned" This reverts commit 8f52cefdccceb44a5e2e705261780a95d971c29c. --- lib/Cake/Cache/Cache.php | 4 ++-- lib/Cake/Model/Datasource/Session/CacheSession.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Cake/Cache/Cache.php b/lib/Cake/Cache/Cache.php index 2cba7dadc..078f2f539 100644 --- a/lib/Cake/Cache/Cache.php +++ b/lib/Cake/Cache/Cache.php @@ -278,7 +278,7 @@ class Cache { * @return void */ public static function gc($config = 'default', $expires = null) { - static::$_engines[$config]->gc($expires); + return static::$_engines[$config]->gc($expires); } /** @@ -452,7 +452,7 @@ class Cache { $success = static::$_engines[$config]->delete($settings['prefix'] . $key); static::set(null, $config); - return $success; + return (bool)$success; } /** diff --git a/lib/Cake/Model/Datasource/Session/CacheSession.php b/lib/Cake/Model/Datasource/Session/CacheSession.php index 05a604dec..d0540bcb7 100644 --- a/lib/Cake/Model/Datasource/Session/CacheSession.php +++ b/lib/Cake/Model/Datasource/Session/CacheSession.php @@ -73,7 +73,7 @@ class CacheSession implements CakeSessionHandlerInterface { * @return bool True for successful delete, false otherwise. */ public function destroy($id) { - return (bool)Cache::delete($id, Configure::read('Session.handler.config')); + return Cache::delete($id, Configure::read('Session.handler.config')); } /** From 572ca1458b16a84fbfcf82f297df106c219f03a6 Mon Sep 17 00:00:00 2001 From: "Larry E. Masters" Date: Mon, 14 Dec 2015 19:30:52 -0600 Subject: [PATCH 22/43] Revert "Forcing bool" This reverts commit 26ea74cbcff8690f04686940dc7dff708744642d. --- lib/Cake/Cache/Cache.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/Cache/Cache.php b/lib/Cake/Cache/Cache.php index 078f2f539..aa00f542d 100644 --- a/lib/Cake/Cache/Cache.php +++ b/lib/Cake/Cache/Cache.php @@ -278,7 +278,7 @@ class Cache { * @return void */ public static function gc($config = 'default', $expires = null) { - return static::$_engines[$config]->gc($expires); + return (bool)static::$_engines[$config]->gc($expires); } /** From 577e1b089f259b0dc4cdd9845348e8003b1028b3 Mon Sep 17 00:00:00 2001 From: "Larry E. Masters" Date: Mon, 14 Dec 2015 19:31:08 -0600 Subject: [PATCH 23/43] Revert "Forcing bool return" This reverts commit fac95baee7de3e40c241cca8ab8386607d547411. --- lib/Cake/Cache/Cache.php | 4 ++-- lib/Cake/Model/Datasource/CakeSession.php | 2 +- lib/Cake/Model/Datasource/Session/CacheSession.php | 2 +- lib/Cake/Model/Datasource/Session/DatabaseSession.php | 8 ++++---- .../Model/Datasource/Session/TestAppLibSession.php | 4 ---- .../Model/Datasource/Session/TestPluginSession.php | 3 --- 6 files changed, 8 insertions(+), 15 deletions(-) diff --git a/lib/Cake/Cache/Cache.php b/lib/Cake/Cache/Cache.php index aa00f542d..2cba7dadc 100644 --- a/lib/Cake/Cache/Cache.php +++ b/lib/Cake/Cache/Cache.php @@ -278,7 +278,7 @@ class Cache { * @return void */ public static function gc($config = 'default', $expires = null) { - return (bool)static::$_engines[$config]->gc($expires); + static::$_engines[$config]->gc($expires); } /** @@ -452,7 +452,7 @@ class Cache { $success = static::$_engines[$config]->delete($settings['prefix'] . $key); static::set(null, $config); - return (bool)$success; + return $success; } /** diff --git a/lib/Cake/Model/Datasource/CakeSession.php b/lib/Cake/Model/Datasource/CakeSession.php index fe601b4d3..b3b471686 100644 --- a/lib/Cake/Model/Datasource/CakeSession.php +++ b/lib/Cake/Model/Datasource/CakeSession.php @@ -143,7 +143,7 @@ class CakeSession { public static function init($base = null) { static::$time = time(); - if (env('HTTP_USER_AGENT') && !static::$_userAgent) { + if (env('HTTP_USER_AGENT')) { static::$_userAgent = md5(env('HTTP_USER_AGENT') . Configure::read('Security.salt')); } diff --git a/lib/Cake/Model/Datasource/Session/CacheSession.php b/lib/Cake/Model/Datasource/Session/CacheSession.php index d0540bcb7..793701992 100644 --- a/lib/Cake/Model/Datasource/Session/CacheSession.php +++ b/lib/Cake/Model/Datasource/Session/CacheSession.php @@ -83,7 +83,7 @@ class CacheSession implements CakeSessionHandlerInterface { * @return bool Success */ public function gc($expires = null) { - return (bool)Cache::gc(Configure::read('Session.handler.config'), $expires); + return Cache::gc(Configure::read('Session.handler.config'), $expires); } } diff --git a/lib/Cake/Model/Datasource/Session/DatabaseSession.php b/lib/Cake/Model/Datasource/Session/DatabaseSession.php index f5626808b..81cd708e8 100644 --- a/lib/Cake/Model/Datasource/Session/DatabaseSession.php +++ b/lib/Cake/Model/Datasource/Session/DatabaseSession.php @@ -123,9 +123,9 @@ class DatabaseSession implements CakeSessionHandlerInterface { 'counterCache' => false ); try { - return (bool)$this->_model->save($record, $options); + return $this->_model->save($record, $options); } catch (PDOException $e) { - return (bool)$this->_model->save($record, $options); + return $this->_model->save($record, $options); } } @@ -136,7 +136,7 @@ class DatabaseSession implements CakeSessionHandlerInterface { * @return bool True for successful delete, false otherwise. */ public function destroy($id) { - return (bool)$this->_model->delete($id); + return $this->_model->delete($id); } /** @@ -151,7 +151,7 @@ class DatabaseSession implements CakeSessionHandlerInterface { } else { $expires = time() - $expires; } - return (bool)$this->_model->deleteAll(array($this->_model->alias . ".expires <" => $expires), false, false); + return $this->_model->deleteAll(array($this->_model->alias . ".expires <" => $expires), false, false); } } diff --git a/lib/Cake/Test/test_app/Model/Datasource/Session/TestAppLibSession.php b/lib/Cake/Test/test_app/Model/Datasource/Session/TestAppLibSession.php index 4d509d3c4..2ba874dba 100644 --- a/lib/Cake/Test/test_app/Model/Datasource/Session/TestAppLibSession.php +++ b/lib/Cake/Test/test_app/Model/Datasource/Session/TestAppLibSession.php @@ -12,7 +12,6 @@ class TestAppLibSession implements CakeSessionHandlerInterface { } public function close() { - return true; } public function read($id) { @@ -22,12 +21,9 @@ class TestAppLibSession implements CakeSessionHandlerInterface { } public function destroy($id) { - return true; } public function gc($expires = null) { - return true; } - } diff --git a/lib/Cake/Test/test_app/Plugin/TestPlugin/Model/Datasource/Session/TestPluginSession.php b/lib/Cake/Test/test_app/Plugin/TestPlugin/Model/Datasource/Session/TestPluginSession.php index 92a2817a1..acad188e0 100644 --- a/lib/Cake/Test/test_app/Plugin/TestPlugin/Model/Datasource/Session/TestPluginSession.php +++ b/lib/Cake/Test/test_app/Plugin/TestPlugin/Model/Datasource/Session/TestPluginSession.php @@ -12,7 +12,6 @@ class TestPluginSession implements CakeSessionHandlerInterface { } public function close() { - return true; } public function read($id) { @@ -22,11 +21,9 @@ class TestPluginSession implements CakeSessionHandlerInterface { } public function destroy($id) { - return true; } public function gc($expires = null) { - return true; } } From 776c128fe02e043ed4b6b97f67e65db3f4396c42 Mon Sep 17 00:00:00 2001 From: "Larry E. Masters" Date: Tue, 22 Dec 2015 16:15:53 -0500 Subject: [PATCH 24/43] Adding boolean return in Cache::gc --- lib/Cake/Cache/Cache.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Cache/Cache.php b/lib/Cake/Cache/Cache.php index 2cba7dadc..f4be0c148 100644 --- a/lib/Cake/Cache/Cache.php +++ b/lib/Cake/Cache/Cache.php @@ -275,10 +275,10 @@ class Cache { * * @param string $config [optional] The config name you wish to have garbage collected. Defaults to 'default' * @param int $expires [optional] An expires timestamp. Defaults to NULL - * @return void + * @return boolean */ public static function gc($config = 'default', $expires = null) { - static::$_engines[$config]->gc($expires); + return static::$_engines[$config]->gc($expires); } /** From dd11c630692d03f35aecd5d9b70a8d555cab3d9c Mon Sep 17 00:00:00 2001 From: "Larry E. Masters" Date: Tue, 22 Dec 2015 16:19:51 -0500 Subject: [PATCH 25/43] Changing return types read now returns empty string instead of false when read method returns an empty value. write, destroy and gc will return boolean type --- lib/Cake/Model/Datasource/Session/CacheSession.php | 12 ++++++++---- .../Model/Datasource/Session/DatabaseSession.php | 14 ++++++++------ 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/lib/Cake/Model/Datasource/Session/CacheSession.php b/lib/Cake/Model/Datasource/Session/CacheSession.php index 793701992..3e214dd04 100644 --- a/lib/Cake/Model/Datasource/Session/CacheSession.php +++ b/lib/Cake/Model/Datasource/Session/CacheSession.php @@ -52,7 +52,11 @@ class CacheSession implements CakeSessionHandlerInterface { * @return mixed The value of the key or false if it does not exist */ public function read($id) { - return Cache::read($id, Configure::read('Session.handler.config')); + $data = Cache::read($id, Configure::read('Session.handler.config')); + if(empty($data)){ + return ''; + } + return $data; } /** @@ -63,7 +67,7 @@ class CacheSession implements CakeSessionHandlerInterface { * @return bool True for successful write, false otherwise. */ public function write($id, $data) { - return Cache::write($id, $data, Configure::read('Session.handler.config')); + return (bool)Cache::write($id, $data, Configure::read('Session.handler.config')); } /** @@ -73,7 +77,7 @@ class CacheSession implements CakeSessionHandlerInterface { * @return bool True for successful delete, false otherwise. */ public function destroy($id) { - return Cache::delete($id, Configure::read('Session.handler.config')); + return (bool)Cache::delete($id, Configure::read('Session.handler.config')); } /** @@ -83,7 +87,7 @@ class CacheSession implements CakeSessionHandlerInterface { * @return bool Success */ public function gc($expires = null) { - return Cache::gc(Configure::read('Session.handler.config'), $expires); + return (bool)Cache::gc(Configure::read('Session.handler.config'), $expires); } } diff --git a/lib/Cake/Model/Datasource/Session/DatabaseSession.php b/lib/Cake/Model/Datasource/Session/DatabaseSession.php index 81cd708e8..2649cdfaf 100644 --- a/lib/Cake/Model/Datasource/Session/DatabaseSession.php +++ b/lib/Cake/Model/Datasource/Session/DatabaseSession.php @@ -93,10 +93,10 @@ class DatabaseSession implements CakeSessionHandlerInterface { )); if (empty($row[$this->_model->alias]['data'])) { - return false; + return ''; } - return $row[$this->_model->alias]['data']; + return (string)$row[$this->_model->alias]['data']; } /** @@ -123,9 +123,9 @@ class DatabaseSession implements CakeSessionHandlerInterface { 'counterCache' => false ); try { - return $this->_model->save($record, $options); + return (bool)$this->_model->save($record, $options); } catch (PDOException $e) { - return $this->_model->save($record, $options); + return (bool)$this->_model->save($record, $options); } } @@ -136,7 +136,8 @@ class DatabaseSession implements CakeSessionHandlerInterface { * @return bool True for successful delete, false otherwise. */ public function destroy($id) { - return $this->_model->delete($id); + return true; + return (bool)$this->_model->delete($id); } /** @@ -151,7 +152,8 @@ class DatabaseSession implements CakeSessionHandlerInterface { } else { $expires = time() - $expires; } - return $this->_model->deleteAll(array($this->_model->alias . ".expires <" => $expires), false, false); + $this->_model->deleteAll(array($this->_model->alias . ".expires <" => $expires), false, false); + return true; } } From 1c593eea6327a9f542880d7909898cc7b9416215 Mon Sep 17 00:00:00 2001 From: "Larry E. Masters" Date: Tue, 22 Dec 2015 16:20:24 -0500 Subject: [PATCH 26/43] Adding return types to Session test classes. --- .../test_app/Model/Datasource/Session/TestAppLibSession.php | 5 +++++ .../Model/Datasource/Session/TestPluginSession.php | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/lib/Cake/Test/test_app/Model/Datasource/Session/TestAppLibSession.php b/lib/Cake/Test/test_app/Model/Datasource/Session/TestAppLibSession.php index 2ba874dba..d4ac56fd8 100644 --- a/lib/Cake/Test/test_app/Model/Datasource/Session/TestAppLibSession.php +++ b/lib/Cake/Test/test_app/Model/Datasource/Session/TestAppLibSession.php @@ -12,18 +12,23 @@ class TestAppLibSession implements CakeSessionHandlerInterface { } public function close() { + return true; } public function read($id) { + return ''; } public function write($id, $data) { + return true; } public function destroy($id) { + return true; } public function gc($expires = null) { + return true; } } diff --git a/lib/Cake/Test/test_app/Plugin/TestPlugin/Model/Datasource/Session/TestPluginSession.php b/lib/Cake/Test/test_app/Plugin/TestPlugin/Model/Datasource/Session/TestPluginSession.php index acad188e0..b297fb47f 100644 --- a/lib/Cake/Test/test_app/Plugin/TestPlugin/Model/Datasource/Session/TestPluginSession.php +++ b/lib/Cake/Test/test_app/Plugin/TestPlugin/Model/Datasource/Session/TestPluginSession.php @@ -12,18 +12,23 @@ class TestPluginSession implements CakeSessionHandlerInterface { } public function close() { + return true; } public function read($id) { + return ''; } public function write($id, $data) { + return true; } public function destroy($id) { + return true; } public function gc($expires = null) { + return true; } } From 9abb4e19f238f21d22d3cf460471b73643939def Mon Sep 17 00:00:00 2001 From: "Larry E. Masters" Date: Tue, 22 Dec 2015 16:22:34 -0500 Subject: [PATCH 27/43] Removing forced return true --- lib/Cake/Model/Datasource/Session/DatabaseSession.php | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/Cake/Model/Datasource/Session/DatabaseSession.php b/lib/Cake/Model/Datasource/Session/DatabaseSession.php index 2649cdfaf..282cb4cfc 100644 --- a/lib/Cake/Model/Datasource/Session/DatabaseSession.php +++ b/lib/Cake/Model/Datasource/Session/DatabaseSession.php @@ -136,7 +136,6 @@ class DatabaseSession implements CakeSessionHandlerInterface { * @return bool True for successful delete, false otherwise. */ public function destroy($id) { - return true; return (bool)$this->_model->delete($id); } From 46d385ac73cc420aaceee9611ca6af4bec27709a Mon Sep 17 00:00:00 2001 From: "Larry E. Masters" Date: Sun, 27 Dec 2015 22:25:23 -0500 Subject: [PATCH 28/43] Should be able to write a file with no data in it. --- lib/Cake/Cache/Engine/FileEngine.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Cache/Engine/FileEngine.php b/lib/Cake/Cache/Engine/FileEngine.php index 80f0f2d6b..916368cd7 100644 --- a/lib/Cake/Cache/Engine/FileEngine.php +++ b/lib/Cake/Cache/Engine/FileEngine.php @@ -108,8 +108,8 @@ class FileEngine extends CacheEngine { * @param int $duration How long to cache the data, in seconds * @return bool True if the data was successfully cached, false on failure */ - public function write($key, $data, $duration) { - if ($data === '' || !$this->_init) { + public function write($key, $data = null, $duration) { + if (!$this->_init) { return false; } From 3c21f4a8aff965b16d22554974808026942258ca Mon Sep 17 00:00:00 2001 From: "Larry E. Masters" Date: Mon, 28 Dec 2015 11:18:03 -0500 Subject: [PATCH 29/43] Fixes session_write_close(): Skipping numeric key 0 error --- .../Test/Case/Controller/Component/SessionComponentTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/Test/Case/Controller/Component/SessionComponentTest.php b/lib/Cake/Test/Case/Controller/Component/SessionComponentTest.php index fa7bae08b..b885dfcfe 100644 --- a/lib/Cake/Test/Case/Controller/Component/SessionComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/SessionComponentTest.php @@ -115,7 +115,7 @@ class SessionComponentTest extends CakeTestCase { */ public function setUp() { parent::setUp(); - $_SESSION = null; + $_SESSION = array(); $this->ComponentCollection = new ComponentCollection(); } From 1fd329311b6dfb46e5df70bdff7b1d4a4cabda33 Mon Sep 17 00:00:00 2001 From: "Larry E. Masters" Date: Mon, 28 Dec 2015 11:29:17 -0500 Subject: [PATCH 30/43] Fixes tests to expect changes made to read and write methods - This could be a possible BC change Since php 7 expects write to return true or false this needed to change, previous implementation would return the values sent to write on success and false on failure. Similar change to read method test CakeSession::read() now returns results or ''. --- .../Session/DatabaseSessionTest.php | 29 +++++-------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/lib/Cake/Test/Case/Model/Datasource/Session/DatabaseSessionTest.php b/lib/Cake/Test/Case/Model/Datasource/Session/DatabaseSessionTest.php index da19cfcc6..b529f803e 100644 --- a/lib/Cake/Test/Case/Model/Datasource/Session/DatabaseSessionTest.php +++ b/lib/Cake/Test/Case/Model/Datasource/Session/DatabaseSessionTest.php @@ -122,19 +122,8 @@ class DatabaseSessionTest extends CakeTestCase { * @return void */ public function testWrite() { - $result = $this->storage->write('foo', 'Some value'); - $expected = array( - 'Session' => array( - 'id' => 'foo', - 'data' => 'Some value', - ) - ); - $expires = $result['Session']['expires']; - unset($result['Session']['expires']); - $this->assertEquals($expected, $result); - - $expected = time() + (Configure::read('Session.timeout') * 60); - $this->assertWithinMargin($expires, $expected, 1); + $this->storage->write('foo', 'Some value'); + $this->assertEquals($this->storage->read('foo'), 'Some value'); } /** @@ -154,13 +143,8 @@ class DatabaseSessionTest extends CakeTestCase { */ public function testRead() { $this->storage->write('foo', 'Some value'); - - $result = $this->storage->read('foo'); - $expected = 'Some value'; - $this->assertEquals($expected, $result); - - $result = $this->storage->read('made up value'); - $this->assertFalse($result); + $this->assertEquals($this->storage->read('foo'), 'Some value'); + $this->assertSame('', $this->storage->read('made up value')); } /** @@ -172,7 +156,8 @@ class DatabaseSessionTest extends CakeTestCase { $this->storage->write('foo', 'Some value'); $this->assertTrue($this->storage->destroy('foo'), 'Destroy failed'); - $this->assertFalse($this->storage->read('foo'), 'Value still present.'); + $this->assertSame($this->storage->read('foo'), ''); + } /** @@ -189,7 +174,7 @@ class DatabaseSessionTest extends CakeTestCase { sleep(1); $storage->gc(); - $this->assertFalse($storage->read('foo')); + $this->assertSame($storage->read('foo'), ''); } /** From 5c3bc44ef5c3cffb648352203feee762418442a5 Mon Sep 17 00:00:00 2001 From: "Larry E. Masters" Date: Mon, 28 Dec 2015 11:41:23 -0500 Subject: [PATCH 31/43] Initial fixes for failing session tests --- lib/Cake/Model/Datasource/CakeSession.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Model/Datasource/CakeSession.php b/lib/Cake/Model/Datasource/CakeSession.php index b3b471686..6d792ab44 100644 --- a/lib/Cake/Model/Datasource/CakeSession.php +++ b/lib/Cake/Model/Datasource/CakeSession.php @@ -218,7 +218,7 @@ class CakeSession { * @return bool True if session has been started. */ public static function started() { - return isset($_SESSION) && session_id(); + return (isset($_SESSION) && session_id()) || isset($_SESSION) && (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg'); } /** @@ -461,7 +461,14 @@ class CakeSession { } if (static::started()) { + if(session_id() && isset($_SESSION)){ + session_write_close(); + } + session_start(); session_destroy(); + if (isset($_COOKIE[static::_cookieName()])){ + unset($_COOKIE[static::_cookieName()]); + } } $_SESSION = null; @@ -753,7 +760,11 @@ class CakeSession { if (isset($_COOKIE[session_name()])) { setcookie(Configure::read('Session.cookie'), '', time() - 42000, static::$path); } - session_regenerate_id(true); + if (!headers_sent()){ + session_write_close(); + session_start(); + session_regenerate_id(true); + } } /** From 33f2f4686879299c5d03603224722836e31c1b8a Mon Sep 17 00:00:00 2001 From: "Larry E. Masters" Date: Mon, 28 Dec 2015 11:52:19 -0500 Subject: [PATCH 32/43] Refactoring and emoving one isset check --- lib/Cake/Model/Datasource/CakeSession.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/Model/Datasource/CakeSession.php b/lib/Cake/Model/Datasource/CakeSession.php index 6d792ab44..054779d6d 100644 --- a/lib/Cake/Model/Datasource/CakeSession.php +++ b/lib/Cake/Model/Datasource/CakeSession.php @@ -218,7 +218,7 @@ class CakeSession { * @return bool True if session has been started. */ public static function started() { - return (isset($_SESSION) && session_id()) || isset($_SESSION) && (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg'); + return (isset($_SESSION) && (session_id() || (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg'))); } /** From c2449c9d16a0a1290f350337ab520fd80c0bf53e Mon Sep 17 00:00:00 2001 From: "Larry E. Masters" Date: Mon, 28 Dec 2015 15:34:04 -0500 Subject: [PATCH 33/43] Fixing Code Sniffer errors --- lib/Cake/Cache/Cache.php | 2 +- lib/Cake/Cache/Engine/FileEngine.php | 2 +- lib/Cake/Model/Datasource/Session/CacheSession.php | 2 +- .../Test/Case/Model/Datasource/Session/DatabaseSessionTest.php | 1 - 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/Cake/Cache/Cache.php b/lib/Cake/Cache/Cache.php index f4be0c148..a7a01d0a1 100644 --- a/lib/Cake/Cache/Cache.php +++ b/lib/Cake/Cache/Cache.php @@ -275,7 +275,7 @@ class Cache { * * @param string $config [optional] The config name you wish to have garbage collected. Defaults to 'default' * @param int $expires [optional] An expires timestamp. Defaults to NULL - * @return boolean + * @return bool */ public static function gc($config = 'default', $expires = null) { return static::$_engines[$config]->gc($expires); diff --git a/lib/Cake/Cache/Engine/FileEngine.php b/lib/Cake/Cache/Engine/FileEngine.php index 916368cd7..d650e60ee 100644 --- a/lib/Cake/Cache/Engine/FileEngine.php +++ b/lib/Cake/Cache/Engine/FileEngine.php @@ -108,7 +108,7 @@ class FileEngine extends CacheEngine { * @param int $duration How long to cache the data, in seconds * @return bool True if the data was successfully cached, false on failure */ - public function write($key, $data = null, $duration) { + public function write($key, $data, $duration) { if (!$this->_init) { return false; } diff --git a/lib/Cake/Model/Datasource/Session/CacheSession.php b/lib/Cake/Model/Datasource/Session/CacheSession.php index 3e214dd04..81ad780dc 100644 --- a/lib/Cake/Model/Datasource/Session/CacheSession.php +++ b/lib/Cake/Model/Datasource/Session/CacheSession.php @@ -53,7 +53,7 @@ class CacheSession implements CakeSessionHandlerInterface { */ public function read($id) { $data = Cache::read($id, Configure::read('Session.handler.config')); - if(empty($data)){ + if (empty($data)){ return ''; } return $data; diff --git a/lib/Cake/Test/Case/Model/Datasource/Session/DatabaseSessionTest.php b/lib/Cake/Test/Case/Model/Datasource/Session/DatabaseSessionTest.php index b529f803e..f00a20188 100644 --- a/lib/Cake/Test/Case/Model/Datasource/Session/DatabaseSessionTest.php +++ b/lib/Cake/Test/Case/Model/Datasource/Session/DatabaseSessionTest.php @@ -157,7 +157,6 @@ class DatabaseSessionTest extends CakeTestCase { $this->assertTrue($this->storage->destroy('foo'), 'Destroy failed'); $this->assertSame($this->storage->read('foo'), ''); - } /** From 027e32ce00bd2d297a77f970b25f815f5801988f Mon Sep 17 00:00:00 2001 From: "Larry E. Masters" Date: Mon, 28 Dec 2015 17:19:31 -0500 Subject: [PATCH 34/43] Reverted change setting $_SESSION to an array. Commenting out a test that is invalid. This test creates a numeric key of 0 in $_SESSION which is not a valid session key. This causes error - session_write_close(): Skipping numeric key 0 error. --- .../Test/Case/Controller/Component/SessionComponentTest.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Test/Case/Controller/Component/SessionComponentTest.php b/lib/Cake/Test/Case/Controller/Component/SessionComponentTest.php index b885dfcfe..5ece8f39b 100644 --- a/lib/Cake/Test/Case/Controller/Component/SessionComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/SessionComponentTest.php @@ -115,7 +115,7 @@ class SessionComponentTest extends CakeTestCase { */ public function setUp() { parent::setUp(); - $_SESSION = array(); + $_SESSION = null; $this->ComponentCollection = new ComponentCollection(); } @@ -202,7 +202,8 @@ class SessionComponentTest extends CakeTestCase { $this->assertEquals($Session->read('Test'), $array); $Session->delete('Test'); - $this->assertTrue($Session->write(array('Test'), 'some value')); + //This test creates a numeric key 0 which is not a valid session key + //$this->assertTrue($Session->write(array('Test'), 'some value')); $this->assertTrue($Session->write(array('Test' => 'some value'))); $this->assertEquals('some value', $Session->read('Test')); $Session->delete('Test'); From a59ea1371239c6d2a31e5be01d06b8d0c12d4d85 Mon Sep 17 00:00:00 2001 From: "Larry E. Masters" Date: Mon, 28 Dec 2015 17:26:35 -0500 Subject: [PATCH 35/43] Fixes SessionComponentTest::testSessionValid. Refactored _hasSession and other erros on php 7 init would always set CakeSession::$_userAgent. --- lib/Cake/Model/Datasource/CakeSession.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/Cake/Model/Datasource/CakeSession.php b/lib/Cake/Model/Datasource/CakeSession.php index 054779d6d..ec5e172cb 100644 --- a/lib/Cake/Model/Datasource/CakeSession.php +++ b/lib/Cake/Model/Datasource/CakeSession.php @@ -143,7 +143,7 @@ class CakeSession { public static function init($base = null) { static::$time = time(); - if (env('HTTP_USER_AGENT')) { + if (env('HTTP_USER_AGENT') && !static::$_userAgent) { static::$_userAgent = md5(env('HTTP_USER_AGENT') . Configure::read('Security.salt')); } @@ -202,7 +202,6 @@ class CakeSession { $id = static::id(); static::_startSession(); - if (!$id && static::started()) { static::_checkValid(); } @@ -218,7 +217,10 @@ class CakeSession { * @return bool True if session has been started. */ public static function started() { - return (isset($_SESSION) && (session_id() || (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg'))); + if (PHP_VERSION >=5.4) { + return isset($_SESSION) && (session_status() === PHP_SESSION_ACTIVE); + } + return isset($_SESSION) && session_id(); } /** @@ -461,10 +463,10 @@ class CakeSession { } if (static::started()) { - if(session_id() && isset($_SESSION)){ + if (session_id() && static::_hasSession()){ session_write_close(); + session_start(); } - session_start(); session_destroy(); if (isset($_COOKIE[static::_cookieName()])){ unset($_COOKIE[static::_cookieName()]); @@ -591,7 +593,7 @@ class CakeSession { * @return bool */ protected static function _hasSession() { - return static::started() || isset($_COOKIE[static::_cookieName()]); + return static::started() || isset($_COOKIE[session_name()]) || (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg'); } /** From 34b4261e6db33127c6f484122928c11cbf34208f Mon Sep 17 00:00:00 2001 From: "Larry E. Masters" Date: Mon, 28 Dec 2015 17:42:56 -0500 Subject: [PATCH 36/43] Fixes: A non well formed numeric value encountered - php 7 --- lib/Cake/Test/Case/View/JsonViewTest.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Test/Case/View/JsonViewTest.php b/lib/Cake/Test/Case/View/JsonViewTest.php index aa5027ae1..d90596f47 100644 --- a/lib/Cake/Test/Case/View/JsonViewTest.php +++ b/lib/Cake/Test/Case/View/JsonViewTest.php @@ -362,7 +362,9 @@ class JsonViewTest extends CakeTestCase { $Controller = new Controller($Request, $Response); // non utf-8 stuff - $data = array('data' => array('foo' => 'bar' . chr('0x97'))); + $bar = 'bar'; + $bar .= chr(0x97); + $data = array('data' => array('foo' => $bar)); $Controller->set($data); $Controller->set('_serialize', 'data'); From a02fb9e77141b0bfc25a26c45741842ad8cc9614 Mon Sep 17 00:00:00 2001 From: "Larry E. Masters" Date: Mon, 28 Dec 2015 18:40:14 -0500 Subject: [PATCH 37/43] Fixing code sniffer errors --- lib/Cake/Model/Datasource/CakeSession.php | 8 ++++---- lib/Cake/Model/Datasource/Session/CacheSession.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/Cake/Model/Datasource/CakeSession.php b/lib/Cake/Model/Datasource/CakeSession.php index ec5e172cb..35c55e1ef 100644 --- a/lib/Cake/Model/Datasource/CakeSession.php +++ b/lib/Cake/Model/Datasource/CakeSession.php @@ -217,7 +217,7 @@ class CakeSession { * @return bool True if session has been started. */ public static function started() { - if (PHP_VERSION >=5.4) { + if (PHP_VERSION >= 5.4) { return isset($_SESSION) && (session_status() === PHP_SESSION_ACTIVE); } return isset($_SESSION) && session_id(); @@ -463,12 +463,12 @@ class CakeSession { } if (static::started()) { - if (session_id() && static::_hasSession()){ + if (session_id() && static::_hasSession()) { session_write_close(); session_start(); } session_destroy(); - if (isset($_COOKIE[static::_cookieName()])){ + if (isset($_COOKIE[static::_cookieName()])) { unset($_COOKIE[static::_cookieName()]); } } @@ -762,7 +762,7 @@ class CakeSession { if (isset($_COOKIE[session_name()])) { setcookie(Configure::read('Session.cookie'), '', time() - 42000, static::$path); } - if (!headers_sent()){ + if (!headers_sent()) { session_write_close(); session_start(); session_regenerate_id(true); diff --git a/lib/Cake/Model/Datasource/Session/CacheSession.php b/lib/Cake/Model/Datasource/Session/CacheSession.php index 81ad780dc..ce846176f 100644 --- a/lib/Cake/Model/Datasource/Session/CacheSession.php +++ b/lib/Cake/Model/Datasource/Session/CacheSession.php @@ -53,7 +53,7 @@ class CacheSession implements CakeSessionHandlerInterface { */ public function read($id) { $data = Cache::read($id, Configure::read('Session.handler.config')); - if (empty($data)){ + if (empty($data)) { return ''; } return $data; From a966e465459c33db66196ca913620552ec609d65 Mon Sep 17 00:00:00 2001 From: "Larry E. Masters" Date: Mon, 28 Dec 2015 23:26:06 -0500 Subject: [PATCH 38/43] Allowing returning numeric 0 from read --- lib/Cake/Model/Datasource/Session/CacheSession.php | 3 ++- lib/Cake/Model/Datasource/Session/DatabaseSession.php | 2 +- .../Test/Case/Model/Datasource/Session/CacheSessionTest.php | 2 ++ .../Test/Case/Model/Datasource/Session/DatabaseSessionTest.php | 3 +++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Model/Datasource/Session/CacheSession.php b/lib/Cake/Model/Datasource/Session/CacheSession.php index ce846176f..35f40d56e 100644 --- a/lib/Cake/Model/Datasource/Session/CacheSession.php +++ b/lib/Cake/Model/Datasource/Session/CacheSession.php @@ -53,7 +53,8 @@ class CacheSession implements CakeSessionHandlerInterface { */ public function read($id) { $data = Cache::read($id, Configure::read('Session.handler.config')); - if (empty($data)) { + + if (!is_numeric($data) && empty($data)) { return ''; } return $data; diff --git a/lib/Cake/Model/Datasource/Session/DatabaseSession.php b/lib/Cake/Model/Datasource/Session/DatabaseSession.php index 282cb4cfc..145b47249 100644 --- a/lib/Cake/Model/Datasource/Session/DatabaseSession.php +++ b/lib/Cake/Model/Datasource/Session/DatabaseSession.php @@ -92,7 +92,7 @@ class DatabaseSession implements CakeSessionHandlerInterface { 'conditions' => array($this->_model->alias . '.' . $this->_model->primaryKey => $id) )); - if (empty($row[$this->_model->alias]['data'])) { + if (!is_numeric($row[$this->_model->alias]['data']) && empty($row[$this->_model->alias]['data'])) { return ''; } diff --git a/lib/Cake/Test/Case/Model/Datasource/Session/CacheSessionTest.php b/lib/Cake/Test/Case/Model/Datasource/Session/CacheSessionTest.php index 553f70bf4..387c05fc1 100644 --- a/lib/Cake/Test/Case/Model/Datasource/Session/CacheSessionTest.php +++ b/lib/Cake/Test/Case/Model/Datasource/Session/CacheSessionTest.php @@ -104,6 +104,8 @@ class CacheSessionTest extends CakeTestCase { public function testRead() { $this->storage->write('test_one', 'Some other value'); $this->assertEquals('Some other value', $this->storage->read('test_one'), 'Incorrect value.'); + $this->storage->write('test_two', 0); + $this->assertEquals(0, $this->storage->read('test_two')); } /** diff --git a/lib/Cake/Test/Case/Model/Datasource/Session/DatabaseSessionTest.php b/lib/Cake/Test/Case/Model/Datasource/Session/DatabaseSessionTest.php index f00a20188..ca33856c4 100644 --- a/lib/Cake/Test/Case/Model/Datasource/Session/DatabaseSessionTest.php +++ b/lib/Cake/Test/Case/Model/Datasource/Session/DatabaseSessionTest.php @@ -144,7 +144,10 @@ class DatabaseSessionTest extends CakeTestCase { public function testRead() { $this->storage->write('foo', 'Some value'); $this->assertEquals($this->storage->read('foo'), 'Some value'); + $this->storage->write('bar', 0); + $this->assertEquals(0, $this->storage->read('bar')); $this->assertSame('', $this->storage->read('made up value')); + } /** From a1e140cbe0521d2ae4462ab97a5179e474b8924d Mon Sep 17 00:00:00 2001 From: "Larry E. Masters" Date: Mon, 28 Dec 2015 23:26:58 -0500 Subject: [PATCH 39/43] Removing check for set key --- lib/Cake/Model/Datasource/CakeSession.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/Cake/Model/Datasource/CakeSession.php b/lib/Cake/Model/Datasource/CakeSession.php index 35c55e1ef..1cf5b6135 100644 --- a/lib/Cake/Model/Datasource/CakeSession.php +++ b/lib/Cake/Model/Datasource/CakeSession.php @@ -468,9 +468,7 @@ class CakeSession { session_start(); } session_destroy(); - if (isset($_COOKIE[static::_cookieName()])) { - unset($_COOKIE[static::_cookieName()]); - } + unset($_COOKIE[static::_cookieName()]); } $_SESSION = null; From bc005cd014925ee0bc151994edc736c5c77a93a6 Mon Sep 17 00:00:00 2001 From: "Larry E. Masters" Date: Mon, 28 Dec 2015 23:32:18 -0500 Subject: [PATCH 40/43] Fixing Undefined index: Session --- lib/Cake/Model/Datasource/Session/DatabaseSession.php | 4 ++++ .../Case/Model/Datasource/Session/DatabaseSessionTest.php | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Model/Datasource/Session/DatabaseSession.php b/lib/Cake/Model/Datasource/Session/DatabaseSession.php index 145b47249..0a8b3c25a 100644 --- a/lib/Cake/Model/Datasource/Session/DatabaseSession.php +++ b/lib/Cake/Model/Datasource/Session/DatabaseSession.php @@ -92,6 +92,10 @@ class DatabaseSession implements CakeSessionHandlerInterface { 'conditions' => array($this->_model->alias . '.' . $this->_model->primaryKey => $id) )); + if(empty($row[$this->_model->alias])){ + return ''; + } + if (!is_numeric($row[$this->_model->alias]['data']) && empty($row[$this->_model->alias]['data'])) { return ''; } diff --git a/lib/Cake/Test/Case/Model/Datasource/Session/DatabaseSessionTest.php b/lib/Cake/Test/Case/Model/Datasource/Session/DatabaseSessionTest.php index ca33856c4..fb5b0bfef 100644 --- a/lib/Cake/Test/Case/Model/Datasource/Session/DatabaseSessionTest.php +++ b/lib/Cake/Test/Case/Model/Datasource/Session/DatabaseSessionTest.php @@ -147,7 +147,6 @@ class DatabaseSessionTest extends CakeTestCase { $this->storage->write('bar', 0); $this->assertEquals(0, $this->storage->read('bar')); $this->assertSame('', $this->storage->read('made up value')); - } /** From b1d93377b6a2bafbce95661407044082abd8d4dd Mon Sep 17 00:00:00 2001 From: "Larry E. Masters" Date: Mon, 28 Dec 2015 23:36:37 -0500 Subject: [PATCH 41/43] Removing invalid test --- .../Test/Case/Controller/Component/SessionComponentTest.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/Cake/Test/Case/Controller/Component/SessionComponentTest.php b/lib/Cake/Test/Case/Controller/Component/SessionComponentTest.php index 5ece8f39b..48b1fb576 100644 --- a/lib/Cake/Test/Case/Controller/Component/SessionComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/SessionComponentTest.php @@ -201,9 +201,7 @@ class SessionComponentTest extends CakeTestCase { $this->assertTrue($Session->write('Test', $array)); $this->assertEquals($Session->read('Test'), $array); $Session->delete('Test'); - - //This test creates a numeric key 0 which is not a valid session key - //$this->assertTrue($Session->write(array('Test'), 'some value')); + $this->assertTrue($Session->write(array('Test' => 'some value'))); $this->assertEquals('some value', $Session->read('Test')); $Session->delete('Test'); From 6ee621011bbae2a6615edb40801098a5d8c43931 Mon Sep 17 00:00:00 2001 From: "Larry E. Masters" Date: Mon, 28 Dec 2015 23:50:35 -0500 Subject: [PATCH 42/43] Using function_exists instead of using constant --- lib/Cake/Model/Datasource/CakeSession.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/Model/Datasource/CakeSession.php b/lib/Cake/Model/Datasource/CakeSession.php index 1cf5b6135..147cc102b 100644 --- a/lib/Cake/Model/Datasource/CakeSession.php +++ b/lib/Cake/Model/Datasource/CakeSession.php @@ -217,7 +217,7 @@ class CakeSession { * @return bool True if session has been started. */ public static function started() { - if (PHP_VERSION >= 5.4) { + if (function_exists('session_status')) { return isset($_SESSION) && (session_status() === PHP_SESSION_ACTIVE); } return isset($_SESSION) && session_id(); From e7a313edeee5a16e45a697d7b54dd72bb334976d Mon Sep 17 00:00:00 2001 From: "Larry E. Masters" Date: Tue, 29 Dec 2015 00:06:44 -0500 Subject: [PATCH 43/43] getting sloppy as I get older, fixing code sniffer errors --- lib/Cake/Model/Datasource/Session/DatabaseSession.php | 2 +- .../Test/Case/Controller/Component/SessionComponentTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Model/Datasource/Session/DatabaseSession.php b/lib/Cake/Model/Datasource/Session/DatabaseSession.php index 0a8b3c25a..cd4b904a8 100644 --- a/lib/Cake/Model/Datasource/Session/DatabaseSession.php +++ b/lib/Cake/Model/Datasource/Session/DatabaseSession.php @@ -92,7 +92,7 @@ class DatabaseSession implements CakeSessionHandlerInterface { 'conditions' => array($this->_model->alias . '.' . $this->_model->primaryKey => $id) )); - if(empty($row[$this->_model->alias])){ + if (empty($row[$this->_model->alias])) { return ''; } diff --git a/lib/Cake/Test/Case/Controller/Component/SessionComponentTest.php b/lib/Cake/Test/Case/Controller/Component/SessionComponentTest.php index 48b1fb576..294d46670 100644 --- a/lib/Cake/Test/Case/Controller/Component/SessionComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/SessionComponentTest.php @@ -201,7 +201,7 @@ class SessionComponentTest extends CakeTestCase { $this->assertTrue($Session->write('Test', $array)); $this->assertEquals($Session->read('Test'), $array); $Session->delete('Test'); - + $this->assertTrue($Session->write(array('Test' => 'some value'))); $this->assertEquals('some value', $Session->read('Test')); $Session->delete('Test');