From 3c46b8a491c29bd0a61eb60b1ebf42bb00872d53 Mon Sep 17 00:00:00 2001 From: Matt Creenan Date: Mon, 6 May 2013 13:00:06 -0300 Subject: [PATCH 1/7] Fix typo in link to cakephp book documentation --- lib/Cake/View/Helper/SessionHelper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/View/Helper/SessionHelper.php b/lib/Cake/View/Helper/SessionHelper.php index 86158b962..c48439d20 100644 --- a/lib/Cake/View/Helper/SessionHelper.php +++ b/lib/Cake/View/Helper/SessionHelper.php @@ -64,7 +64,7 @@ class SessionHelper extends AppHelper { * In your view: `$this->Session->error();` * * @return string last error - * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/session.html#displaying-notifcations-or-flash-messages + * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/session.html#displaying-notifications-or-flash-messages */ public function error() { return CakeSession::error(); From 36a51bdad5e7d21177b8fdbb3470399f9a73367c Mon Sep 17 00:00:00 2001 From: ADmad Date: Mon, 6 May 2013 22:03:45 +0530 Subject: [PATCH 2/7] Avoid fail due to postgres ordering --- .../Case/Controller/Component/PaginatorComponentTest.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php b/lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php index f660ecd90..e4e72a469 100644 --- a/lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php @@ -891,7 +891,7 @@ class PaginatorComponentTest extends CakeTestCase { /** * Test that a really REALLY large page number gets clamped to the max page size. - * + * * * @expectedException NotFoundException * @return void @@ -1138,7 +1138,9 @@ class PaginatorComponentTest extends CakeTestCase { ); $Controller->passedArgs = array('sort' => 'PaginatorControllerPost.title', 'dir' => 'asc'); $result = $Controller->paginate('PaginatorControllerComment'); - $this->assertEquals(array(1, 2, 3, 4, 5, 6), Hash::extract($result, '{n}.PaginatorControllerComment.id')); + $result = Hash::extract($result, '{n}.PaginatorControllerComment.id'); + sort($result); + $this->assertEquals(array(1, 2, 3, 4, 5, 6), $result); } /** From 43b77bc0b518ace76d9c848015b200b8e6efe8bc Mon Sep 17 00:00:00 2001 From: ADmad Date: Tue, 7 May 2013 03:30:19 +0530 Subject: [PATCH 3/7] Move App::uses() calls above the class. Improve docblock for Object::log(). --- lib/Cake/Core/Object.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/Cake/Core/Object.php b/lib/Cake/Core/Object.php index bf1466ad9..2e1bd3f56 100644 --- a/lib/Cake/Core/Object.php +++ b/lib/Cake/Core/Object.php @@ -14,6 +14,8 @@ * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ +App::uses('CakeLog', 'Log'); +App::uses('Dispatcher', 'Routing'); App::uses('Set', 'Utility'); /** @@ -68,7 +70,6 @@ class Object { if (empty($url)) { return false; } - App::uses('Dispatcher', 'Routing'); if (($index = array_search('return', $extra)) !== false) { $extra['return'] = 0; $extra['autoRender'] = 1; @@ -147,12 +148,13 @@ class Object { * Convenience method to write a message to CakeLog. See CakeLog::write() * for more information on writing to logs. * - * @param string $msg Log message - * @param integer $type Error type constant. Defined in app/Config/core.php. - * @return boolean Success of log write + * @param string $msg Log message. + * @param integer|string $type Type of message being written. Either a valid + * LOG_* constant or a string matching the recognized levels. + * @return boolean Success of log write. + * @see CakeLog::write() */ public function log($msg, $type = LOG_ERR) { - App::uses('CakeLog', 'Log'); if (!is_string($msg)) { $msg = print_r($msg, true); } From 06e7ba66c92e12cad5c9f97ae3000612326c2e05 Mon Sep 17 00:00:00 2001 From: mark_story Date: Mon, 6 May 2013 23:03:20 -0400 Subject: [PATCH 4/7] Update docs for Security::cipher() This method is not cryptographically strong. Note that, and the issues related to suhosin. Related to #GH-1100 --- lib/Cake/Utility/Security.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Utility/Security.php b/lib/Cake/Utility/Security.php index 390819f93..57d0e0af8 100644 --- a/lib/Cake/Utility/Security.php +++ b/lib/Cake/Utility/Security.php @@ -168,11 +168,19 @@ class Security { } /** - * Encrypts/Decrypts a text using the given key. + * Runs $text through a XOR cipher. + * + * *Note* This is not a cryptographically strong method and should not be used + * for sensitive data. Additionally this method does *not* work in environments + * where suhosin is enabled. + * + * Instead you should use Security::rijndael() when you need strong + * encryption. * * @param string $text Encrypted string to decrypt, normal string to encrypt * @param string $key Key to use * @return string Encrypted/Decrypted string + * @deprecated This method will be removed in 3.x */ public static function cipher($text, $key) { if (empty($key)) { From 372089797f333ec23d5c541d6791e93651c05f99 Mon Sep 17 00:00:00 2001 From: ADmad Date: Tue, 7 May 2013 23:23:07 +0530 Subject: [PATCH 5/7] Fix test --- .../Component/PaginatorComponentTest.php | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php b/lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php index e4e72a469..06f0b7595 100644 --- a/lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php @@ -570,7 +570,7 @@ class PaginatorComponentTest extends CakeTestCase { public function testPaginateSpecialType() { $Controller = new PaginatorTestController($this->request); $Controller->uses = array('PaginatorControllerPost', 'PaginatorControllerComment'); - $Controller->passedArgs[] = '1'; + $Controller->request->params['pass'][] = '1'; $Controller->params['url'] = array(); $Controller->constructClasses(); @@ -1083,7 +1083,7 @@ class PaginatorComponentTest extends CakeTestCase { $Controller = new Controller($this->request); $Controller->uses = array('PaginatorControllerPost', 'ControllerComment'); - $Controller->passedArgs[] = '1'; + $Controller->request->params['pass'][] = '1'; $Controller->constructClasses(); $Controller->request->params['named'] = array( @@ -1134,13 +1134,26 @@ class PaginatorComponentTest extends CakeTestCase { ), false); $Controller->paginate = array( - 'fields' => array('PaginatorControllerComment.id', 'title', 'PaginatorControllerPost.title'), + 'fields' => array( + 'PaginatorControllerComment.id', + 'title', + 'PaginatorControllerPost.title' + ), ); - $Controller->passedArgs = array('sort' => 'PaginatorControllerPost.title', 'dir' => 'asc'); - $result = $Controller->paginate('PaginatorControllerComment'); - $result = Hash::extract($result, '{n}.PaginatorControllerComment.id'); + $Controller->request->params['named'] = array( + 'sort' => 'PaginatorControllerPost.title', + 'direction' => 'desc' + ); + $result = Hash::extract( + $Controller->paginate('PaginatorControllerComment'), + '{n}.PaginatorControllerComment.id' + ); + $result1 = array_splice($result, 0, 2); + sort($result1); + $this->assertEquals(array(5, 6), $result1); + sort($result); - $this->assertEquals(array(1, 2, 3, 4, 5, 6), $result); + $this->assertEquals(array(1, 2, 3, 4), $result); } /** From 91319bbe7bc665befc67a5d2e6db6490354819fb Mon Sep 17 00:00:00 2001 From: ADmad Date: Wed, 8 May 2013 01:43:27 +0530 Subject: [PATCH 6/7] Fix disabled attribute check. Fixes #3818 --- .../Test/Case/View/Helper/FormHelperTest.php | 22 +++++++++++++++++++ lib/Cake/View/Helper/FormHelper.php | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php index cb2349909..3f6e26458 100644 --- a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php @@ -2205,6 +2205,28 @@ class FormHelperTest extends CakeTestCase { '/div' ); $this->assertTags($result, $expected); + + $result = $this->Form->input('User.disabled', array( + 'label' => 'Disabled', + 'type' => 'checkbox', + 'data-foo' => 'disabled' + )); + $expected = array( + 'div' => array('class' => 'input checkbox'), + 'input' => array('type' => 'hidden', 'name' => 'data[User][disabled]', 'value' => '0', 'id' => 'UserDisabled_'), + array('input' => array( + 'type' => 'checkbox', + 'name' => 'data[User][disabled]', + 'value' => '1', + 'id' => 'UserDisabled', + 'data-foo' => 'disabled' + )), + 'label' => array('for' => 'UserDisabled'), + 'Disabled', + '/label', + '/div' + ); + $this->assertTags($result, $expected); } /** diff --git a/lib/Cake/View/Helper/FormHelper.php b/lib/Cake/View/Helper/FormHelper.php index 7e98cc0d4..ad331a8d7 100644 --- a/lib/Cake/View/Helper/FormHelper.php +++ b/lib/Cake/View/Helper/FormHelper.php @@ -2809,7 +2809,7 @@ class FormHelper extends AppHelper { } $disabledIndex = array_search('disabled', $options, true); - if ($disabledIndex !== false) { + if (is_int($disabledIndex)) { unset($options[$disabledIndex]); $options['disabled'] = true; } From eee37bb04e582842d8c7bbdabd03680b6e31fe6b Mon Sep 17 00:00:00 2001 From: mark_story Date: Tue, 7 May 2013 21:57:06 -0400 Subject: [PATCH 7/7] Improve docs for AclShell. --- lib/Cake/Console/Command/AclShell.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Cake/Console/Command/AclShell.php b/lib/Cake/Console/Command/AclShell.php index 8e3297c9b..18bcf77f5 100644 --- a/lib/Cake/Console/Command/AclShell.php +++ b/lib/Cake/Console/Command/AclShell.php @@ -377,6 +377,7 @@ class AclShell extends AppShell { 'help' => __d('cake_console', 'Create a new ACL node'), 'parser' => array( 'description' => __d('cake_console', 'Creates a new ACL object under the parent'), + 'epilog' => __d('cake_console', 'You can use `root` as the parent when creating nodes to create top level nodes.'), 'arguments' => array( 'type' => $type, 'parent' => array(