diff --git a/app/Config/core.php b/app/Config/core.php index d386d4a75..e85f1d224 100644 --- a/app/Config/core.php +++ b/app/Config/core.php @@ -206,7 +206,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 @@ -232,7 +232,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'); @@ -312,7 +312,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'; diff --git a/lib/Cake/Console/Templates/skel/Config/core.php b/lib/Cake/Console/Templates/skel/Config/core.php index 2694d999f..868efb301 100644 --- a/lib/Cake/Console/Templates/skel/Config/core.php +++ b/lib/Cake/Console/Templates/skel/Config/core.php @@ -197,7 +197,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 @@ -223,7 +223,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'); @@ -303,7 +303,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'; 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 { 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/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); 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/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); diff --git a/lib/Cake/Model/Model.php b/lib/Cake/Model/Model.php index a1fb7a524..38f3a25e6 100644 --- a/lib/Cake/Model/Model.php +++ b/lib/Cake/Model/Model.php @@ -1694,6 +1694,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]); } 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 * 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']); 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', 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);``` * 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