From c2c096428c43ba9116e5be4626cb3da266148bf4 Mon Sep 17 00:00:00 2001 From: mark_story Date: Sun, 21 Apr 2013 11:29:25 -0400 Subject: [PATCH 01/12] Uncomment test. I missed this earlier, because I'm a doofus. --- lib/Cake/Test/Case/View/Helper/FormHelperTest.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php index c07c85838..ed8f8a49a 100644 --- a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php @@ -2328,7 +2328,6 @@ class FormHelperTest extends CakeTestCase { * @return void */ public function testInputTimeWithIntervalAnd12HourFormat() { - /* $result = $this->Form->input('Model.start_time', array( 'type' => 'time', 'timeFormat' => 12, @@ -2348,7 +2347,6 @@ class FormHelperTest extends CakeTestCase { $this->assertContains('', $result); $this->assertContains('', $result); $this->assertContains('', $result); - */ $result = $this->Form->input('Model.start_time', array( 'type' => 'time', From 62660c67069f54b92f302cd2f0eff6ef075e3b2e Mon Sep 17 00:00:00 2001 From: mark_story Date: Sun, 21 Apr 2013 21:15:44 -0400 Subject: [PATCH 02/12] Re-assign $db after beforeSave. This allows model/behavior methods to change the datasource in the beforeSave callback. If you use drivers from different SQL platforms things will go very poorly. Fixes #3606 --- lib/Cake/Model/ConnectionManager.php | 3 +-- lib/Cake/Model/Model.php | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Model/ConnectionManager.php b/lib/Cake/Model/ConnectionManager.php index 4437ec435..eaa62bde6 100644 --- a/lib/Cake/Model/ConnectionManager.php +++ b/lib/Cake/Model/ConnectionManager.php @@ -86,8 +86,7 @@ class ConnectionManager { } if (!empty(self::$_dataSources[$name])) { - $return = self::$_dataSources[$name]; - return $return; + return self::$_dataSources[$name]; } if (empty(self::$_connectionsEnum[$name])) { diff --git a/lib/Cake/Model/Model.php b/lib/Cake/Model/Model.php index 61952a13d..035a062ef 100644 --- a/lib/Cake/Model/Model.php +++ b/lib/Cake/Model/Model.php @@ -1689,6 +1689,8 @@ class Model extends Object implements CakeEventListener { } } + $db = $this->getDataSource(); + if (empty($this->data[$this->alias][$this->primaryKey])) { unset($this->data[$this->alias][$this->primaryKey]); } From 880c70cc8c7977c6ac8d55b0d836c55a018dbcb8 Mon Sep 17 00:00:00 2001 From: Simon Males Date: Mon, 22 Apr 2013 11:52:03 +0800 Subject: [PATCH 03/12] No use of type key in ClassRegistry::init() --- lib/Cake/Utility/ClassRegistry.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/Utility/ClassRegistry.php b/lib/Cake/Utility/ClassRegistry.php index 6cea3be2b..ad054f52e 100644 --- a/lib/Cake/Utility/ClassRegistry.php +++ b/lib/Cake/Utility/ClassRegistry.php @@ -73,7 +73,7 @@ class ClassRegistry { * Examples * Simple Use: Get a Post model instance ```ClassRegistry::init('Post');``` * - * Expanded: ```array('class' => 'ClassName', 'alias' => 'AliasNameStoredInTheRegistry', 'type' => 'Model');``` + * Expanded: ```array('class' => 'ClassName', 'alias' => 'AliasNameStoredInTheRegistry');``` * * Model Classes can accept optional ```array('id' => $id, 'table' => $table, 'ds' => $ds, 'alias' => $alias);``` * From 77feac9ef6c9891ce4c55496d293c5b7d21aad08 Mon Sep 17 00:00:00 2001 From: Simon Males Date: Mon, 22 Apr 2013 11:46:23 +0800 Subject: [PATCH 04/12] Second parameter of ClassRegistry::init() is a boolean, not a string --- lib/Cake/Model/Behavior/TranslateBehavior.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/Model/Behavior/TranslateBehavior.php b/lib/Cake/Model/Behavior/TranslateBehavior.php index afcc8d8e6..a253b7007 100644 --- a/lib/Cake/Model/Behavior/TranslateBehavior.php +++ b/lib/Cake/Model/Behavior/TranslateBehavior.php @@ -539,7 +539,7 @@ class TranslateBehavior extends ModelBehavior { $className = $Model->translateModel; } - $this->runtime[$Model->alias]['model'] = ClassRegistry::init($className, 'Model'); + $this->runtime[$Model->alias]['model'] = ClassRegistry::init($className); } if (!empty($Model->translateTable) && $Model->translateTable !== $this->runtime[$Model->alias]['model']->useTable) { $this->runtime[$Model->alias]['model']->setSource($Model->translateTable); From 48fa358260838c4d7fb2dc7275e5cc11727ed9dc Mon Sep 17 00:00:00 2001 From: euromark Date: Mon, 22 Apr 2013 11:36:17 +0200 Subject: [PATCH 05/12] Remove leftover param that is now wrongly triggering "strict" --- lib/Cake/Test/Case/Model/ModelReadTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/Test/Case/Model/ModelReadTest.php b/lib/Cake/Test/Case/Model/ModelReadTest.php index aa7c279f9..93dfab10e 100644 --- a/lib/Cake/Test/Case/Model/ModelReadTest.php +++ b/lib/Cake/Test/Case/Model/ModelReadTest.php @@ -7765,7 +7765,7 @@ class ModelReadTest extends BaseModelTest { $this->assertEquals(4, $result[0][0]['other_field']); ClassRegistry::flush(); - $Writing = ClassRegistry::init(array('class' => 'Post', 'alias' => 'Writing'), 'Model'); + $Writing = ClassRegistry::init(array('class' => 'Post', 'alias' => 'Writing')); $Writing->virtualFields = array('two' => "1 + 1"); $result = $Writing->find('first'); $this->assertEquals(2, $result['Writing']['two']); From dbc2a7a9e4cda329304167a0738daba94327f5ed Mon Sep 17 00:00:00 2001 From: euromark Date: Tue, 23 Apr 2013 12:34:59 +0200 Subject: [PATCH 06/12] correct spelling mistake --- lib/Cake/Utility/Debugger.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/Utility/Debugger.php b/lib/Cake/Utility/Debugger.php index 7e9bfcba8..6aa7f98e9 100644 --- a/lib/Cake/Utility/Debugger.php +++ b/lib/Cake/Utility/Debugger.php @@ -421,7 +421,7 @@ class Debugger { } /** - * Wraps the highlight_string funciton in case the server API does not + * Wraps the highlight_string function in case the server API does not * implement the function as it is the case of the HipHop interpreter * * @param string $str the string to convert From ef90850801c6af07aafd889250c24d3c27fc312b Mon Sep 17 00:00:00 2001 From: Ceeram Date: Tue, 23 Apr 2013 12:54:48 +0200 Subject: [PATCH 07/12] Removing extra whitespace, phpcs fix --- lib/Cake/Model/Datasource/DboSource.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/Model/Datasource/DboSource.php b/lib/Cake/Model/Datasource/DboSource.php index f9b1a109c..c8d1c5725 100644 --- a/lib/Cake/Model/Datasource/DboSource.php +++ b/lib/Cake/Model/Datasource/DboSource.php @@ -2588,7 +2588,7 @@ class DboSource extends DataSource { } if (!preg_match($operatorMatch, trim($operator))) { - $operator .= is_array($value) ? ' IN' : ' ='; + $operator .= is_array($value) ? ' IN' : ' ='; } $operator = trim($operator); From baadaec608d11ad12431717e5ed14fa34d5a50d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20W=C3=BCrth?= Date: Tue, 23 Apr 2013 21:48:23 +0300 Subject: [PATCH 08/12] Fixed some typos in core.php --- app/Config/core.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Config/core.php b/app/Config/core.php index df16a8b98..d776d94a6 100644 --- a/app/Config/core.php +++ b/app/Config/core.php @@ -203,7 +203,7 @@ /** * Apply timestamps with the last modified time to static assets (js, css, images). - * Will append a querystring parameter containing the time the file was modified. This is + * Will append a query string parameter containing the time the file was modified. This is * useful for invalidating browser caches. * * Set to `true` to apply timestamps when debug > 0. Set to 'force' to always enable @@ -229,7 +229,7 @@ //Configure::write('Asset.filter.js', 'custom_javascript_output_filter.php'); /** - * The classname and database used in CakePHP's + * The class name and database used in CakePHP's * access control lists. */ Configure::write('Acl.classname', 'DbAcl'); @@ -309,7 +309,7 @@ * By default File is used, but for improved performance you should use APC. * * Note: 'default' and other application caches should be configured in app/Config/bootstrap.php. - * Please check the comments in boostrap.php for more info on the cache engines available + * Please check the comments in bootstrap.php for more info on the cache engines available * and their settings. */ $engine = 'File'; From 993ec1fed6d7d8acf134aa4409bc3b8de37429f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20W=C3=BCrth?= Date: Tue, 23 Apr 2013 21:50:26 +0300 Subject: [PATCH 09/12] Fixed some typos in core.php In sync with this one https://github.com/cakephp/cakephp/pull/1244 --- lib/Cake/Console/Templates/skel/Config/core.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Cake/Console/Templates/skel/Config/core.php b/lib/Cake/Console/Templates/skel/Config/core.php index df16a8b98..d776d94a6 100644 --- a/lib/Cake/Console/Templates/skel/Config/core.php +++ b/lib/Cake/Console/Templates/skel/Config/core.php @@ -203,7 +203,7 @@ /** * Apply timestamps with the last modified time to static assets (js, css, images). - * Will append a querystring parameter containing the time the file was modified. This is + * Will append a query string parameter containing the time the file was modified. This is * useful for invalidating browser caches. * * Set to `true` to apply timestamps when debug > 0. Set to 'force' to always enable @@ -229,7 +229,7 @@ //Configure::write('Asset.filter.js', 'custom_javascript_output_filter.php'); /** - * The classname and database used in CakePHP's + * The class name and database used in CakePHP's * access control lists. */ Configure::write('Acl.classname', 'DbAcl'); @@ -309,7 +309,7 @@ * By default File is used, but for improved performance you should use APC. * * Note: 'default' and other application caches should be configured in app/Config/bootstrap.php. - * Please check the comments in boostrap.php for more info on the cache engines available + * Please check the comments in bootstrap.php for more info on the cache engines available * and their settings. */ $engine = 'File'; From e144afead764bebb9ad86ef221fa535b0f0abcbe Mon Sep 17 00:00:00 2001 From: mark_story Date: Wed, 24 Apr 2013 14:37:16 -0400 Subject: [PATCH 10/12] Fix Vendor/bin/cake not working when installing CakePHP with composer. --- lib/Cake/Console/cake.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Console/cake.php b/lib/Cake/Console/cake.php index a4e0e2133..76aeb63ac 100644 --- a/lib/Cake/Console/cake.php +++ b/lib/Cake/Console/cake.php @@ -31,8 +31,14 @@ foreach ($paths as $path) { } if (!$found) { - $root = dirname(dirname(dirname(__FILE__))); - if (!include $root . $ds . $dispatcher) { + $rootInstall = dirname(dirname(dirname(__FILE__))) . $ds . $dispatcher; + $composerInstall = dirname(dirname(__FILE__)) . $ds. $dispatcher; + + if (file_exists($composerInstall)) { + include $composerInstall; + } elseif (file_exists($rootInstall)) { + include $rootInstall; + } else { trigger_error('Could not locate CakePHP core files.', E_USER_ERROR); } } else { From db6dd18f865359fa01e88d2691078dba383b753b Mon Sep 17 00:00:00 2001 From: Jose Lorenzo Rodriguez Date: Wed, 24 Apr 2013 22:33:24 +0200 Subject: [PATCH 11/12] Fixing case where it was possible to pass array data to FormAuthenticate fields --- .../Component/Auth/FormAuthenticate.php | 10 ++++----- .../Component/Auth/FormAuthenticateTest.php | 22 +++++++++++++++++++ 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/lib/Cake/Controller/Component/Auth/FormAuthenticate.php b/lib/Cake/Controller/Component/Auth/FormAuthenticate.php index 47b107e21..d856c0c32 100644 --- a/lib/Cake/Controller/Component/Auth/FormAuthenticate.php +++ b/lib/Cake/Controller/Component/Auth/FormAuthenticate.php @@ -49,11 +49,11 @@ class FormAuthenticate extends BaseAuthenticate { if (empty($request->data[$model])) { return false; } - if ( - empty($request->data[$model][$fields['username']]) || - empty($request->data[$model][$fields['password']]) - ) { - return false; + foreach (array($fields['username'], $fields['password']) as $field) { + $value = $request->data($model . '.' . $field); + if (empty($value) || !is_string($value)) { + return false; + } } return true; } diff --git a/lib/Cake/Test/Case/Controller/Component/Auth/FormAuthenticateTest.php b/lib/Cake/Test/Case/Controller/Component/Auth/FormAuthenticateTest.php index 851951004..c3cc7d6bd 100644 --- a/lib/Cake/Test/Case/Controller/Component/Auth/FormAuthenticateTest.php +++ b/lib/Cake/Test/Case/Controller/Component/Auth/FormAuthenticateTest.php @@ -115,6 +115,28 @@ class FormAuthenticateTest extends CakeTestCase { $this->assertFalse($this->auth->authenticate($request, $this->response)); } +/** + * test authenticate field is not string + * + * @return void + */ + public function testAuthenticateFieldsAreNotString() { + $request = new CakeRequest('posts/index', false); + $request->data = array( + 'User' => array( + 'user' => array('mariano', 'phpnut'), + 'password' => 'my password' + )); + $this->assertFalse($this->auth->authenticate($request, $this->response)); + + $request->data = array( + 'User' => array( + 'user' => 'mariano', + 'password' => array('password1', 'password2') + )); + $this->assertFalse($this->auth->authenticate($request, $this->response)); + } + /** * test the authenticate method * From c19e3d075e7901555343e9ac7944134ab657f33d Mon Sep 17 00:00:00 2001 From: Jose Lorenzo Rodriguez Date: Wed, 24 Apr 2013 23:19:51 +0200 Subject: [PATCH 12/12] Update version number to 2.3.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 3043388a4..a35672d14 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.3.2 +2.3.3