diff --git a/app/Config/bootstrap.php b/app/Config/bootstrap.php index 66f3ce5730f..287fc9469ab 100644 --- a/app/Config/bootstrap.php +++ b/app/Config/bootstrap.php @@ -89,17 +89,24 @@ * The settings below can be used to set additional paths to models, views and controllers. * * App::build(array( - * 'Plugin' => array('/full/path/to/plugins/', '/next/full/path/to/plugins/'), - * 'Model' => array('/full/path/to/models/', '/next/full/path/to/models/'), - * 'View' => array('/full/path/to/views/', '/next/full/path/to/views/'), - * 'Controller' => array('/full/path/to/controllers/', '/next/full/path/to/controllers/'), - * 'Model/Datasource' => array('/full/path/to/datasources/', '/next/full/path/to/datasources/'), - * 'Model/Behavior' => array('/full/path/to/behaviors/', '/next/full/path/to/behaviors/'), - * 'Controller/Component' => array('/full/path/to/components/', '/next/full/path/to/components/'), - * 'View/Helper' => array('/full/path/to/helpers/', '/next/full/path/to/helpers/'), - * 'Vendor' => array('/full/path/to/vendors/', '/next/full/path/to/vendors/'), - * 'Console/Command' => array('/full/path/to/shells/', '/next/full/path/to/shells/'), - * 'Locale' => array('/full/path/to/locale/', '/next/full/path/to/locale/') + * 'Model' => array('/path/to/models', '/next/path/to/models'), + * 'Model/Behavior' => array('/path/to/behaviors', '/next/path/to/behaviors'), + * 'Model/Datasource' => array('/path/to/datasources', '/next/path/to/datasources'), + * 'Model/Datasource/Database' => array('/path/to/databases', '/next/path/to/database'), + * 'Model/Datasource/Session' => array('/path/to/sessions', '/next/path/to/sessions'), + * 'Controller' => array('/path/to/controllers', '/next/path/to/controllers'), + * 'Controller/Component' => array('/path/to/components', '/next/path/to/components'), + * 'Controller/Component/Auth' => array('/path/to/auths', '/next/path/to/auths'), + * 'Controller/Component/Acl' => array('/path/to/acls', '/next/path/to/acls'), + * 'View' => array('/path/to/views', '/next/path/to/views'), + * 'View/Helper' => array('/path/to/helpers', '/next/path/to/helpers'), + * 'Console' => array('/path/to/consoles', '/next/path/to/consoles'), + * 'Console/Command' => array('/path/to/commands', '/next/path/to/commands'), + * 'Console/Command/Task' => array('/path/to/tasks', '/next/path/to/tasks'), + * 'Lib' => array('/path/to/libs', '/next/path/to/libs'), + * 'Locale' => array('/path/to/locales', '/next/path/to/locales'), + * 'Vendor' => array('/path/to/vendors', '/next/path/to/vendors'), + * 'Plugin' => array('/path/to/plugins', '/next/path/to/plugins'), * )); * */ diff --git a/lib/Cake/Console/Command/Task/ExtractTask.php b/lib/Cake/Console/Command/Task/ExtractTask.php index 24c3e50c611..147a10a6da2 100644 --- a/lib/Cake/Console/Command/Task/ExtractTask.php +++ b/lib/Cake/Console/Command/Task/ExtractTask.php @@ -464,6 +464,8 @@ protected function _processValidationRules($field, $rules, $file, $domain) { * @return void */ protected function _buildFiles() { + $paths = $this->_paths; + $paths[] = realpath(APP) . DS; foreach ($this->_translations as $domain => $translations) { foreach ($translations as $msgid => $details) { $plural = $details['msgid_plural']; @@ -474,7 +476,7 @@ protected function _buildFiles() { $occurrences[] = $file . ':' . implode(';', $lines); } $occurrences = implode("\n#: ", $occurrences); - $header = '#: ' . str_replace($this->_paths, '', $occurrences) . "\n"; + $header = '#: ' . str_replace($paths, '', $occurrences) . "\n"; if ($plural === false) { $sentence = "msgid \"{$msgid}\"\n"; diff --git a/lib/Cake/Console/Templates/skel/Config/bootstrap.php b/lib/Cake/Console/Templates/skel/Config/bootstrap.php index b2087767ed9..4b1ed7de046 100644 --- a/lib/Cake/Console/Templates/skel/Config/bootstrap.php +++ b/lib/Cake/Console/Templates/skel/Config/bootstrap.php @@ -30,17 +30,24 @@ * The settings below can be used to set additional paths to models, views and controllers. * * App::build(array( - * 'Plugin' => array('/full/path/to/plugins/', '/next/full/path/to/plugins/'), - * 'Model' => array('/full/path/to/models/', '/next/full/path/to/models/'), - * 'View' => array('/full/path/to/views/', '/next/full/path/to/views/'), - * 'Controller' => array('/full/path/to/controllers/', '/next/full/path/to/controllers/'), - * 'Model/Datasource' => array('/full/path/to/datasources/', '/next/full/path/to/datasources/'), - * 'Model/Behavior' => array('/full/path/to/behaviors/', '/next/full/path/to/behaviors/'), - * 'Controller/Component' => array('/full/path/to/components/', '/next/full/path/to/components/'), - * 'View/Helper' => array('/full/path/to/helpers/', '/next/full/path/to/helpers/'), - * 'Vendor' => array('/full/path/to/vendors/', '/next/full/path/to/vendors/'), - * 'Console/Command' => array('/full/path/to/shells/', '/next/full/path/to/shells/'), - * 'Locale' => array('/full/path/to/locale/', '/next/full/path/to/locale/') + * 'Model' => array('/path/to/models', '/next/path/to/models'), + * 'Model/Behavior' => array('/path/to/behaviors', '/next/path/to/behaviors'), + * 'Model/Datasource' => array('/path/to/datasources', '/next/path/to/datasources'), + * 'Model/Datasource/Database' => array('/path/to/databases', '/next/path/to/database'), + * 'Model/Datasource/Session' => array('/path/to/sessions', '/next/path/to/sessions'), + * 'Controller' => array('/path/to/controllers', '/next/path/to/controllers'), + * 'Controller/Component' => array('/path/to/components', '/next/path/to/components'), + * 'Controller/Component/Auth' => array('/path/to/auths', '/next/path/to/auths'), + * 'Controller/Component/Acl' => array('/path/to/acls', '/next/path/to/acls'), + * 'View' => array('/path/to/views', '/next/path/to/views'), + * 'View/Helper' => array('/path/to/helpers', '/next/path/to/helpers'), + * 'Console' => array('/path/to/consoles', '/next/path/to/consoles'), + * 'Console/Command' => array('/path/to/commands', '/next/path/to/commands'), + * 'Console/Command/Task' => array('/path/to/tasks', '/next/path/to/tasks'), + * 'Lib' => array('/path/to/libs', '/next/path/to/libs'), + * 'Locale' => array('/path/to/locales', '/next/path/to/locales'), + * 'Vendor' => array('/path/to/vendors', '/next/path/to/vendors'), + * 'Plugin' => array('/path/to/plugins', '/next/path/to/plugins'), * )); * */ @@ -83,4 +90,4 @@ Configure::write('Dispatcher.filters', array( 'AssetDispatcher', 'CacheDispatcher' -)); \ No newline at end of file +)); diff --git a/lib/Cake/Controller/Component/EmailComponent.php b/lib/Cake/Controller/Component/EmailComponent.php index 5b2dd1d9f33..4bb1782d414 100644 --- a/lib/Cake/Controller/Component/EmailComponent.php +++ b/lib/Cake/Controller/Component/EmailComponent.php @@ -420,31 +420,6 @@ protected function _findFiles($attachment) { return null; } -/** - * Encode the specified string using the current charset - * - * @param string $subject String to encode - * @return string Encoded string - */ - protected function _encode($subject) { - $subject = $this->_strip($subject); - - $nl = "\r\n"; - if ($this->delivery == 'mail') { - $nl = ''; - } - $internalEncoding = function_exists('mb_internal_encoding'); - if ($internalEncoding) { - $restore = mb_internal_encoding(); - mb_internal_encoding($this->charset); - } - $return = mb_encode_mimeheader($subject, $this->charset, 'B', $nl); - if ($internalEncoding) { - mb_internal_encoding($restore); - } - return $return; - } - /** * Format addresses to be an array with email as key and alias as value * @@ -455,7 +430,7 @@ protected function _formatAddresses($addresses) { $formatted = array(); foreach ($addresses as $address) { if (preg_match('/((.*))?\s?<(.+)>/', $address, $matches) && !empty($matches[2])) { - $formatted[$this->_strip($matches[3])] = $this->_encode($matches[2]); + $formatted[$this->_strip($matches[3])] = $matches[2]; } else { $address = $this->_strip($address); $formatted[$address] = $address; diff --git a/lib/Cake/Test/Case/Controller/Component/EmailComponentTest.php b/lib/Cake/Test/Case/Controller/Component/EmailComponentTest.php index fdfee55e58d..80abc7fb0a2 100644 --- a/lib/Cake/Test/Case/Controller/Component/EmailComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/EmailComponentTest.php @@ -868,4 +868,22 @@ public function testMessageId() { $this->assertNotRegExp('/Message-ID:/', $result); } +/** + * Make sure from/to are not double encoded when UTF-8 is present + */ + public function testEncodingFrom() { + $this->Controller->EmailTest->to = 'Teßt '; + $this->Controller->EmailTest->from = 'Teßt '; + $this->Controller->EmailTest->subject = 'Cake Debug Test'; + $this->Controller->EmailTest->replyTo = 'noreply@example.com'; + $this->Controller->EmailTest->template = null; + + $this->Controller->EmailTest->delivery = 'DebugComp'; + $this->assertTrue($this->Controller->EmailTest->send('This is the body of the message')); + $result = DebugCompTransport::$lastEmail; + + $this->assertContains('From: =?UTF-8?B?VGXDn3Qg?= ', $result); + $this->assertContains('To: =?UTF-8?B?VGXDn3Qg?= ', $result); + } + } diff --git a/lib/Cake/Test/Case/TestSuite/CakeTestSuiteTest.php b/lib/Cake/Test/Case/TestSuite/CakeTestSuiteTest.php index c98c4c6c308..a8dbaf3c022 100644 --- a/lib/Cake/Test/Case/TestSuite/CakeTestSuiteTest.php +++ b/lib/Cake/Test/Case/TestSuite/CakeTestSuiteTest.php @@ -76,6 +76,29 @@ public function testAddTestDirectoryRecursiveWithHidden() { $suite->addTestDirectoryRecursive($Folder->pwd()); + $Folder->delete(); + } + +/** + * testAddTestDirectoryRecursiveWithNonPhp + * + * @return void + */ + public function testAddTestDirectoryRecursiveWithNonPhp() { + $this->skipIf(!is_writeable(TMP), 'Cant addTestDirectoryRecursiveWithNonPhp unless the tmp folder is writable.'); + + $Folder = new Folder(TMP . 'MyTestFolder', true, 0777); + touch($Folder->path . DS . 'BackupTest.php~'); + touch($Folder->path . DS . 'SomeNotesTest.txt'); + touch($Folder->path . DS . 'NotHiddenTest.php'); + + $suite = $this->getMock('CakeTestSuite', array('addTestFile')); + $suite + ->expects($this->exactly(1)) + ->method('addTestFile'); + + $suite->addTestDirectoryRecursive($Folder->pwd()); + $Folder->delete(); } } diff --git a/lib/Cake/Test/Case/Utility/InflectorTest.php b/lib/Cake/Test/Case/Utility/InflectorTest.php index 9709b03d209..d5683680ac6 100644 --- a/lib/Cake/Test/Case/Utility/InflectorTest.php +++ b/lib/Cake/Test/Case/Utility/InflectorTest.php @@ -108,6 +108,7 @@ public function testInflectingSingulars() { $this->assertEquals(Inflector::singularize('cafes'), 'cafe'); $this->assertEquals(Inflector::singularize('roofs'), 'roof'); $this->assertEquals(Inflector::singularize('foes'), 'foe'); + $this->assertEquals(Inflector::singularize('databases'), 'database'); $this->assertEquals(Inflector::singularize(''), ''); } diff --git a/lib/Cake/TestSuite/CakeTestSuite.php b/lib/Cake/TestSuite/CakeTestSuite.php index 9752ddc681c..ca478a0d25b 100644 --- a/lib/Cake/TestSuite/CakeTestSuite.php +++ b/lib/Cake/TestSuite/CakeTestSuite.php @@ -37,7 +37,9 @@ public function addTestDirectory($directory = '.') { list($dirs, $files) = $Folder->read(true, true, true); foreach ($files as $file) { - $this->addTestFile($file); + if (substr($file, -4) === '.php') { + $this->addTestFile($file); + } } } @@ -52,7 +54,9 @@ public function addTestDirectoryRecursive($directory = '.') { $files = $Folder->tree(null, true, 'files'); foreach ($files as $file) { - $this->addTestFile($file); + if (substr($file, -4) === '.php') { + $this->addTestFile($file); + } } } diff --git a/lib/Cake/Utility/Inflector.php b/lib/Cake/Utility/Inflector.php index aff1627f1b6..7cfc04aa26b 100644 --- a/lib/Cake/Utility/Inflector.php +++ b/lib/Cake/Utility/Inflector.php @@ -124,7 +124,7 @@ class Inflector { '/(drive)s$/i' => '\1', '/([^fo])ves$/i' => '\1fe', '/(^analy)ses$/i' => '\1sis', - '/(analy|ba|diagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i' => '\1\2sis', + '/(analy|diagno|^ba|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i' => '\1\2sis', '/([ti])a$/i' => '\1um', '/(p)eople$/i' => '\1\2erson', '/(m)en$/i' => '\1an',