From f69edb5c80b5bff703a6cd4944da72f077ef2fe0 Mon Sep 17 00:00:00 2001 From: Kyle Robinson Young Date: Mon, 23 Jan 2012 16:01:38 -0800 Subject: [PATCH 1/7] Remove incorrect parameter in HtmlHelper::script docblock example Fixes #76 --- lib/Cake/View/Helper/HtmlHelper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/View/Helper/HtmlHelper.php b/lib/Cake/View/Helper/HtmlHelper.php index dd5157d3d..a8defad34 100644 --- a/lib/Cake/View/Helper/HtmlHelper.php +++ b/lib/Cake/View/Helper/HtmlHelper.php @@ -459,7 +459,7 @@ class HtmlHelper extends AppHelper { * * Add the script file to the `$scripts_for_layout` layout var: * - * `$this->Html->script('styles.js', null, array('inline' => false));` + * `$this->Html->script('styles.js', array('inline' => false));` * * ### Options * From 354716cf60d3c375771fd14f9e79fab4725e0f41 Mon Sep 17 00:00:00 2001 From: mark_story Date: Mon, 23 Jan 2012 20:22:06 -0500 Subject: [PATCH 2/7] Fix issues with sparse arrays in ThemeView. Fixes #2500 --- lib/Cake/View/ThemeView.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/Cake/View/ThemeView.php b/lib/Cake/View/ThemeView.php index 13cfcafb0..0e5957ba5 100644 --- a/lib/Cake/View/ThemeView.php +++ b/lib/Cake/View/ThemeView.php @@ -57,14 +57,13 @@ class ThemeView extends View { $themePaths = array(); if (!empty($this->theme)) { - $count = count($paths); - for ($i = 0; $i < $count; $i++) { - if (strpos($paths[$i], DS . 'Plugin' . DS) === false - && strpos($paths[$i], DS . 'Cake' . DS . 'View') === false) { + foreach ($paths as $path) { + if (strpos($path, DS . 'Plugin' . DS) === false + && strpos($path, DS . 'Cake' . DS . 'View') === false) { if ($plugin) { - $themePaths[] = $paths[$i] . 'Themed'. DS . $this->theme . DS . 'Plugin' . DS . $plugin . DS; + $themePaths[] = $path . 'Themed'. DS . $this->theme . DS . 'Plugin' . DS . $plugin . DS; } - $themePaths[] = $paths[$i] . 'Themed'. DS . $this->theme . DS; + $themePaths[] = $path . 'Themed'. DS . $this->theme . DS; } } $paths = array_merge($themePaths, $paths); From b8e27c7588dd6fa4fec3ccb31f30ad58cd1b5706 Mon Sep 17 00:00:00 2001 From: mark_story Date: Tue, 24 Jan 2012 20:32:06 -0500 Subject: [PATCH 3/7] Fix indentation. --- lib/Cake/Test/Case/Model/ModelWriteTest.php | 102 ++++++++++---------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/lib/Cake/Test/Case/Model/ModelWriteTest.php b/lib/Cake/Test/Case/Model/ModelWriteTest.php index d369de185..752b9ec85 100644 --- a/lib/Cake/Test/Case/Model/ModelWriteTest.php +++ b/lib/Cake/Test/Case/Model/ModelWriteTest.php @@ -24,62 +24,62 @@ require_once dirname(__FILE__) . DS . 'ModelTestBase.php'; */ class ModelWriteTest extends BaseModelTest { - /** - * testInsertAnotherHabtmRecordWithSameForeignKey method - * - * @access public - * @return void - */ - public function testInsertAnotherHabtmRecordWithSameForeignKey() { - $this->loadFixtures('JoinA', 'JoinB', 'JoinAB', 'JoinC', 'JoinAC'); - $TestModel = new JoinA(); +/** + * testInsertAnotherHabtmRecordWithSameForeignKey method + * + * @access public + * @return void + */ + public function testInsertAnotherHabtmRecordWithSameForeignKey() { + $this->loadFixtures('JoinA', 'JoinB', 'JoinAB', 'JoinC', 'JoinAC'); + $TestModel = new JoinA(); - $result = $TestModel->JoinAsJoinB->findById(1); - $expected = array( - 'JoinAsJoinB' => array( - 'id' => 1, - 'join_a_id' => 1, - 'join_b_id' => 2, - 'other' => 'Data for Join A 1 Join B 2', - 'created' => '2008-01-03 10:56:33', - 'updated' => '2008-01-03 10:56:33' - )); - $this->assertEquals($expected, $result); - - $TestModel->JoinAsJoinB->create(); - $data = array( + $result = $TestModel->JoinAsJoinB->findById(1); + $expected = array( + 'JoinAsJoinB' => array( + 'id' => 1, 'join_a_id' => 1, - 'join_b_id' => 1, - 'other' => 'Data for Join A 1 Join B 1', - 'created' => '2008-01-03 10:56:44', - 'updated' => '2008-01-03 10:56:44' - ); - $result = $TestModel->JoinAsJoinB->save($data); - $lastInsertId = $TestModel->JoinAsJoinB->getLastInsertID(); - $data['id'] = $lastInsertId; - $this->assertEquals($result, array('JoinAsJoinB' => $data)); - $this->assertTrue($lastInsertId != null); + 'join_b_id' => 2, + 'other' => 'Data for Join A 1 Join B 2', + 'created' => '2008-01-03 10:56:33', + 'updated' => '2008-01-03 10:56:33' + )); + $this->assertEquals($expected, $result); - $result = $TestModel->JoinAsJoinB->findById(1); - $expected = array( - 'JoinAsJoinB' => array( - 'id' => 1, - 'join_a_id' => 1, - 'join_b_id' => 2, - 'other' => 'Data for Join A 1 Join B 2', - 'created' => '2008-01-03 10:56:33', - 'updated' => '2008-01-03 10:56:33' - )); - $this->assertEquals($expected, $result); + $TestModel->JoinAsJoinB->create(); + $data = array( + 'join_a_id' => 1, + 'join_b_id' => 1, + 'other' => 'Data for Join A 1 Join B 1', + 'created' => '2008-01-03 10:56:44', + 'updated' => '2008-01-03 10:56:44' + ); + $result = $TestModel->JoinAsJoinB->save($data); + $lastInsertId = $TestModel->JoinAsJoinB->getLastInsertID(); + $data['id'] = $lastInsertId; + $this->assertEquals($result, array('JoinAsJoinB' => $data)); + $this->assertTrue($lastInsertId != null); - $updatedValue = 'UPDATED Data for Join A 1 Join B 2'; - $TestModel->JoinAsJoinB->id = 1; - $result = $TestModel->JoinAsJoinB->saveField('other', $updatedValue, false); - $this->assertFalse(empty($result)); + $result = $TestModel->JoinAsJoinB->findById(1); + $expected = array( + 'JoinAsJoinB' => array( + 'id' => 1, + 'join_a_id' => 1, + 'join_b_id' => 2, + 'other' => 'Data for Join A 1 Join B 2', + 'created' => '2008-01-03 10:56:33', + 'updated' => '2008-01-03 10:56:33' + )); + $this->assertEquals($expected, $result); - $result = $TestModel->JoinAsJoinB->findById(1); - $this->assertEquals($result['JoinAsJoinB']['other'], $updatedValue); - } + $updatedValue = 'UPDATED Data for Join A 1 Join B 2'; + $TestModel->JoinAsJoinB->id = 1; + $result = $TestModel->JoinAsJoinB->saveField('other', $updatedValue, false); + $this->assertFalse(empty($result)); + + $result = $TestModel->JoinAsJoinB->findById(1); + $this->assertEquals($result['JoinAsJoinB']['other'], $updatedValue); + } /** * testSaveDateAsFirstEntry method From dbece1f157d15615f0e9663737f0003a8d0e54bd Mon Sep 17 00:00:00 2001 From: mark_story Date: Tue, 24 Jan 2012 20:32:48 -0500 Subject: [PATCH 4/7] Add test for saveField() + foreign key. Closes #2507 --- lib/Cake/Test/Case/Model/ModelWriteTest.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Test/Case/Model/ModelWriteTest.php b/lib/Cake/Test/Case/Model/ModelWriteTest.php index 752b9ec85..2a29813ed 100644 --- a/lib/Cake/Test/Case/Model/ModelWriteTest.php +++ b/lib/Cake/Test/Case/Model/ModelWriteTest.php @@ -611,12 +611,26 @@ class ModelWriteTest extends BaseModelTest { $this->assertEquals($expected, $result); $TestModel->recursive = -1; - $result = $TestModel->read(array('id', 'user_id', 'title', 'body'), 1); + $TestModel->read(array('id', 'user_id', 'title', 'body'), 1); $TestModel->id = 1; $result = $TestModel->saveField('title', '', true); $this->assertFalse($result); + + $TestModel->recursive = -1; + $TestModel->id = 1; + $result = $TestModel->saveField('user_id', 9999); + $this->assertTrue((bool)$result); + + $result = $TestModel->read(array('id', 'user_id'), 1); + $expected = array('Article' => array( + 'id' => '1', + 'user_id' => '9999', + )); + $this->assertEquals($expected, $result); + + $this->loadFixtures('Node', 'Dependency'); $Node = new Node(); $Node->set('id', 1); From 6d69ec3a78179a1ea67bd36df4524eeb30687fcf Mon Sep 17 00:00:00 2001 From: Ceeram Date: Wed, 25 Jan 2012 10:12:59 +0100 Subject: [PATCH 5/7] update book link --- lib/Cake/Model/Model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/Model/Model.php b/lib/Cake/Model/Model.php index 5c6827b7f..2d7486e4f 100644 --- a/lib/Cake/Model/Model.php +++ b/lib/Cake/Model/Model.php @@ -1488,7 +1488,7 @@ class Model extends Object { * @param array $validate See $options param in Model::save(). Does not respect 'fieldList' key if passed * @return boolean See Model::save() * @see Model::save() - * @link http://book.cakephp.org/2.0/en/models/retrieving-your-data.html#model-read + * @link http://book.cakephp.org/2.0/en/models/saving-your-data.html#model-savefield-string-fieldname-string-fieldvalue-validate-false */ public function saveField($name, $value, $validate = false) { $id = $this->id; From f02a3b05318ab1725a1b58ab2eea1677c4c2a7f6 Mon Sep 17 00:00:00 2001 From: mark_story Date: Wed, 25 Jan 2012 21:03:03 -0500 Subject: [PATCH 6/7] Wrap aliases containing , in "" Fixes #2502 --- lib/Cake/Network/Email/CakeEmail.php | 3 +++ lib/Cake/Test/Case/Network/Email/CakeEmailTest.php | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/lib/Cake/Network/Email/CakeEmail.php b/lib/Cake/Network/Email/CakeEmail.php index bc5b821a7..69c3982c2 100644 --- a/lib/Cake/Network/Email/CakeEmail.php +++ b/lib/Cake/Network/Email/CakeEmail.php @@ -1109,6 +1109,9 @@ class CakeEmail { $restore = mb_internal_encoding(); mb_internal_encoding($this->_appCharset); } + if (strpos($text, ',') !== false) { + $text = '"' . $text . '"'; + } $return = mb_encode_mimeheader($text, $this->headerCharset, 'B'); if ($internalEncoding) { mb_internal_encoding($restore); diff --git a/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php b/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php index a3350efc2..a962bab1c 100644 --- a/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php +++ b/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php @@ -277,6 +277,14 @@ class CakeEmailTest extends CakeTestCase { $expected = array('CakePHP ', 'Cake '); $this->assertSame($expected, $result); + $result = $this->CakeEmail->formatAddress(array('me@example.com' => 'Last, First')); + $expected = array('"Last, First" '); + $this->assertSame($expected, $result); + + $result = $this->CakeEmail->formatAddress(array('me@example.com' => 'Last First')); + $expected = array('Last First '); + $this->assertSame($expected, $result); + $result = $this->CakeEmail->formatAddress(array('cake@cakephp.org' => 'ÄÖÜTest')); $expected = array('=?UTF-8?B?w4TDlsOcVGVzdA==?= '); $this->assertSame($expected, $result); From 00649cbdde579c3c573ef4a6c46717a4156e923d Mon Sep 17 00:00:00 2001 From: ADmad Date: Thu, 26 Jan 2012 17:56:42 +0530 Subject: [PATCH 7/7] Updating minimum PHP version requirement to 5.2.8 due to PHP bugs #44251 and #45748. Closes #2509 --- lib/Cake/Console/Templates/default/views/home.ctp | 6 +++--- lib/Cake/View/Pages/home.ctp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/Cake/Console/Templates/default/views/home.ctp b/lib/Cake/Console/Templates/default/views/home.ctp index 917d84ad7..54fa0fb9a 100644 --- a/lib/Cake/Console/Templates/default/views/home.ctp +++ b/lib/Cake/Console/Templates/default/views/home.ctp @@ -13,13 +13,13 @@ endif; ?>

=')): + if (version_compare(PHP_VERSION, '5.2.8', '>=')): echo ''; - echo __d('cake_dev', 'Your version of PHP is 5.2.6 or higher.'); + echo __d('cake_dev', 'Your version of PHP is 5.2.8 or higher.'); echo ''; else: echo ''; - echo __d('cake_dev', 'Your version of PHP is too low. You need PHP 5.2.6 or higher to use CakePHP.'); + echo __d('cake_dev', 'Your version of PHP is too low. You need PHP 5.2.8 or higher to use CakePHP.'); echo ''; endif; ?> diff --git a/lib/Cake/View/Pages/home.ctp b/lib/Cake/View/Pages/home.ctp index 612023ea7..2fac59aad 100644 --- a/lib/Cake/View/Pages/home.ctp +++ b/lib/Cake/View/Pages/home.ctp @@ -37,13 +37,13 @@ endif;

=')): + if (version_compare(PHP_VERSION, '5.2.8', '>=')): echo ''; - echo __d('cake_dev', 'Your version of PHP is 5.2.6 or higher.'); + echo __d('cake_dev', 'Your version of PHP is 5.2.8 or higher.'); echo ''; else: echo ''; - echo __d('cake_dev', 'Your version of PHP is too low. You need PHP 5.2.6 or higher to use CakePHP.'); + echo __d('cake_dev', 'Your version of PHP is too low. You need PHP 5.2.8 or higher to use CakePHP.'); echo ''; endif; ?>