From bf7d01ac66682cd6aea5a3f7c010164c8670a48a Mon Sep 17 00:00:00 2001 From: ndm2 Date: Fri, 18 Jul 2014 14:53:22 +0200 Subject: [PATCH 01/13] Make SMTP auth reply code checks work properly. --- lib/Cake/Network/Email/SmtpTransport.php | 20 +++-- .../Case/Network/Email/SmtpTransportTest.php | 83 +++++++++++++++++++ 2 files changed, 95 insertions(+), 8 deletions(-) diff --git a/lib/Cake/Network/Email/SmtpTransport.php b/lib/Cake/Network/Email/SmtpTransport.php index e4dd51d43..c2009b475 100644 --- a/lib/Cake/Network/Email/SmtpTransport.php +++ b/lib/Cake/Network/Email/SmtpTransport.php @@ -191,18 +191,22 @@ class SmtpTransport extends AbstractTransport { */ protected function _auth() { if (isset($this->_config['username']) && isset($this->_config['password'])) { - $authRequired = $this->_smtpSend('AUTH LOGIN', '334|503'); - if ($authRequired == '334') { - if (!$this->_smtpSend(base64_encode($this->_config['username']), '334')) { + $replyCode = $this->_smtpSend('AUTH LOGIN', '334|500|502|504'); + if ($replyCode == '334') { + try { + $this->_smtpSend(base64_encode($this->_config['username']), '334'); + } catch (SocketException $e) { throw new SocketException(__d('cake_dev', 'SMTP server did not accept the username.')); } - if (!$this->_smtpSend(base64_encode($this->_config['password']), '235')) { + try { + $this->_smtpSend(base64_encode($this->_config['password']), '235'); + } catch (SocketException $e) { throw new SocketException(__d('cake_dev', 'SMTP server did not accept the password.')); } - } elseif ($authRequired == '504') { - throw new SocketException(__d('cake_dev', 'SMTP authentication method not allowed, check if SMTP server requires TLS')); - } elseif ($authRequired != '503') { - throw new SocketException(__d('cake_dev', 'SMTP does not require authentication.')); + } elseif ($replyCode == '504') { + throw new SocketException(__d('cake_dev', 'SMTP authentication method not allowed, check if SMTP server requires TLS.')); + } else { + throw new SocketException(__d('cake_dev', 'AUTH command not recognized or not implemented, SMTP server may not require authentication.')); } } } diff --git a/lib/Cake/Test/Case/Network/Email/SmtpTransportTest.php b/lib/Cake/Test/Case/Network/Email/SmtpTransportTest.php index 1eecd8893..880039737 100644 --- a/lib/Cake/Test/Case/Network/Email/SmtpTransportTest.php +++ b/lib/Cake/Test/Case/Network/Email/SmtpTransportTest.php @@ -223,6 +223,89 @@ class SmtpTransportTest extends CakeTestCase { $this->SmtpTransport->auth(); } +/** + * testAuthNotRecognized method + * + * @expectedException SocketException + * @expectedExceptionMessage AUTH command not recognized or not implemented, SMTP server may not require authentication. + * @return void + */ + public function testAuthNotRecognized() { + $this->socket->expects($this->at(0))->method('write')->with("AUTH LOGIN\r\n"); + $this->socket->expects($this->at(1))->method('read')->will($this->returnValue(false)); + $this->socket->expects($this->at(2))->method('read')->will($this->returnValue("500 5.3.3 Unrecognized command\r\n")); + $this->SmtpTransport->config(array('username' => 'mark', 'password' => 'story')); + $this->SmtpTransport->auth(); + } + +/** + * testAuthNotImplemented method + * + * @expectedException SocketException + * @expectedExceptionMessage AUTH command not recognized or not implemented, SMTP server may not require authentication. + * @return void + */ + public function testAuthNotImplemented() { + $this->socket->expects($this->at(0))->method('write')->with("AUTH LOGIN\r\n"); + $this->socket->expects($this->at(1))->method('read')->will($this->returnValue(false)); + $this->socket->expects($this->at(2))->method('read')->will($this->returnValue("502 5.3.3 Command not implemented\r\n")); + $this->SmtpTransport->config(array('username' => 'mark', 'password' => 'story')); + $this->SmtpTransport->auth(); + } + +/** + * testAuthBadSequence method + * + * @expectedException SocketException + * @return void + */ + public function testAuthBadSequence() { + $this->socket->expects($this->at(0))->method('write')->with("AUTH LOGIN\r\n"); + $this->socket->expects($this->at(1))->method('read')->will($this->returnValue(false)); + $this->socket->expects($this->at(2))->method('read')->will($this->returnValue("503 5.5.1 Already authenticated\r\n")); + $this->SmtpTransport->config(array('username' => 'mark', 'password' => 'story')); + $this->SmtpTransport->auth(); + } + +/** + * testAuthBadUsername method + * + * @expectedException SocketException + * @expectedExceptionMessage SMTP server did not accept the username. + * @return void + */ + public function testAuthBadUsername() { + $this->socket->expects($this->at(0))->method('write')->with("AUTH LOGIN\r\n"); + $this->socket->expects($this->at(1))->method('read')->will($this->returnValue(false)); + $this->socket->expects($this->at(2))->method('read')->will($this->returnValue("334 Login\r\n")); + $this->socket->expects($this->at(3))->method('write')->with("bWFyaw==\r\n"); + $this->socket->expects($this->at(4))->method('read')->will($this->returnValue(false)); + $this->socket->expects($this->at(5))->method('read')->will($this->returnValue("535 5.7.8 Authentication failed\r\n")); + $this->SmtpTransport->config(array('username' => 'mark', 'password' => 'story')); + $this->SmtpTransport->auth(); + } + +/** + * testAuthBadPassword method + * + * @expectedException SocketException + * @expectedExceptionMessage SMTP server did not accept the password. + * @return void + */ + public function testAuthBadPassword() { + $this->socket->expects($this->at(0))->method('write')->with("AUTH LOGIN\r\n"); + $this->socket->expects($this->at(1))->method('read')->will($this->returnValue(false)); + $this->socket->expects($this->at(2))->method('read')->will($this->returnValue("334 Login\r\n")); + $this->socket->expects($this->at(3))->method('write')->with("bWFyaw==\r\n"); + $this->socket->expects($this->at(4))->method('read')->will($this->returnValue(false)); + $this->socket->expects($this->at(5))->method('read')->will($this->returnValue("334 Pass\r\n")); + $this->socket->expects($this->at(6))->method('write')->with("c3Rvcnk=\r\n"); + $this->socket->expects($this->at(7))->method('read')->will($this->returnValue(false)); + $this->socket->expects($this->at(8))->method('read')->will($this->returnValue("535 5.7.8 Authentication failed\r\n")); + $this->SmtpTransport->config(array('username' => 'mark', 'password' => 'story')); + $this->SmtpTransport->auth(); + } + /** * testAuthNoAuth method * From f03bf8067c81fe8aa1b5b7a05c3bae84434a8256 Mon Sep 17 00:00:00 2001 From: ndm2 Date: Fri, 18 Jul 2014 14:56:10 +0200 Subject: [PATCH 02/13] Add some more exception message checks --- lib/Cake/Test/Case/Network/Email/SmtpTransportTest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/Cake/Test/Case/Network/Email/SmtpTransportTest.php b/lib/Cake/Test/Case/Network/Email/SmtpTransportTest.php index 880039737..7c4076439 100644 --- a/lib/Cake/Test/Case/Network/Email/SmtpTransportTest.php +++ b/lib/Cake/Test/Case/Network/Email/SmtpTransportTest.php @@ -130,6 +130,7 @@ class SmtpTransportTest extends CakeTestCase { * testConnectEhloTlsOnNonTlsServer method * * @expectedException SocketException + * @expectedExceptionMessage SMTP server did not accept the connection or trying to connect to non TLS SMTP server using TLS. * @return void */ public function testConnectEhloTlsOnNonTlsServer() { @@ -150,6 +151,7 @@ class SmtpTransportTest extends CakeTestCase { * testConnectEhloNoTlsOnRequiredTlsServer method * * @expectedException SocketException + * @expectedExceptionMessage SMTP authentication method not allowed, check if SMTP server requires TLS. * @return void */ public function testConnectEhloNoTlsOnRequiredTlsServer() { @@ -189,6 +191,7 @@ class SmtpTransportTest extends CakeTestCase { * testConnectFail method * * @expectedException SocketException + * @expectedExceptionMessage SMTP server did not accept the connection. * @return void */ public function testConnectFail() { @@ -257,6 +260,7 @@ class SmtpTransportTest extends CakeTestCase { * testAuthBadSequence method * * @expectedException SocketException + * @expectedExceptionMessage SMTP Error: 503 5.5.1 Already authenticated * @return void */ public function testAuthBadSequence() { From 0dfce1abf34316f3be16e9e248860f84f94686e7 Mon Sep 17 00:00:00 2001 From: mark_story Date: Sat, 19 Jul 2014 19:57:33 -0400 Subject: [PATCH 03/13] Add `.` to the list of allowed characters. This was missed when the email validation rules were relaxed in dc34d80f6f622e883b8c7db9ef489bd514c8701f. Fixes #4027 --- lib/Cake/Network/Email/CakeEmail.php | 2 +- lib/Cake/Test/Case/Network/Email/CakeEmailTest.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Cake/Network/Email/CakeEmail.php b/lib/Cake/Network/Email/CakeEmail.php index 46bb4dc38..15db67455 100644 --- a/lib/Cake/Network/Email/CakeEmail.php +++ b/lib/Cake/Network/Email/CakeEmail.php @@ -320,7 +320,7 @@ class CakeEmail { * * @var string */ - protected $_emailPattern = '/^((?:[\p{L}0-9!#$%&\'*+\/=?^_`{|}~-]+)*@[\p{L}0-9-.]+)$/ui'; + protected $_emailPattern = '/^((?:[\p{L}0-9.!#$%&\'*+\/=?^_`{|}~-]+)*@[\p{L}0-9-.]+)$/ui'; /** * The class name used for email configuration. diff --git a/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php b/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php index 366867de8..b91e66e80 100644 --- a/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php +++ b/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php @@ -251,7 +251,7 @@ class CakeEmailTest extends CakeTestCase { $list = array( 'root@localhost' => 'root', 'bjørn@hammeröath.com' => 'Bjorn', - 'cake@cakephp.org' => 'Cake PHP', + 'cake.php@cakephp.org' => 'Cake PHP', 'cake-php@googlegroups.com' => 'Cake Groups', 'root@cakephp.org' ); @@ -259,7 +259,7 @@ class CakeEmailTest extends CakeTestCase { $expected = array( 'root@localhost' => 'root', 'bjørn@hammeröath.com' => 'Bjorn', - 'cake@cakephp.org' => 'Cake PHP', + 'cake.php@cakephp.org' => 'Cake PHP', 'cake-php@googlegroups.com' => 'Cake Groups', 'root@cakephp.org' => 'root@cakephp.org' ); @@ -271,7 +271,7 @@ class CakeEmailTest extends CakeTestCase { $expected = array( 'root@localhost' => 'root', 'bjørn@hammeröath.com' => 'Bjorn', - 'cake@cakephp.org' => 'Cake PHP', + 'cake.php@cakephp.org' => 'Cake PHP', 'cake-php@googlegroups.com' => 'Cake Groups', 'root@cakephp.org' => 'root@cakephp.org', 'jrbasso@cakephp.org' => 'jrbasso@cakephp.org', From ac9af7e3269f956b5a030a1bb6e6b95325af8b9c Mon Sep 17 00:00:00 2001 From: mark_story Date: Sun, 20 Jul 2014 22:20:47 -0400 Subject: [PATCH 04/13] Update version number to 2.5.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 501a5d314..ff82793c8 100644 --- a/lib/Cake/VERSION.txt +++ b/lib/Cake/VERSION.txt @@ -17,4 +17,4 @@ // @license http://www.opensource.org/licenses/mit-license.php MIT License // +--------------------------------------------------------------------------------------------+ // //////////////////////////////////////////////////////////////////////////////////////////////////// -2.5.2 +2.5.3 From cec7d5d03a7bbb80179c934ae7ae1d6fe0e8c961 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20W=C3=BCrth?= Date: Mon, 21 Jul 2014 10:08:43 +0200 Subject: [PATCH 05/13] Added NetBeans project folder to .gitignore Refs https://github.com/cakephp/cakephp/commit/78fb9b559ab1745a7255583231694be99cec65c5#commitcomment-7077015 --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index a755f4f5d..349903082 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ # IDE and editor specific files # ################################# +/nbproject .idea # OS generated files # From b129ce512e6739e8e8ad86153d1ea59372cdfe9c Mon Sep 17 00:00:00 2001 From: mark_story Date: Mon, 21 Jul 2014 21:30:05 -0400 Subject: [PATCH 06/13] Update db_acl.sql to use correct column names. The column names added in bb15271 were incorrect. Fixes #4052 --- app/Config/Schema/db_acl.sql | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Config/Schema/db_acl.sql b/app/Config/Schema/db_acl.sql index ece2ee125..30cbe0675 100644 --- a/app/Config/Schema/db_acl.sql +++ b/app/Config/Schema/db_acl.sql @@ -41,12 +41,13 @@ CREATE TABLE aros ( ); /* this indexes will improve acl perfomance */ -CREATE INDEX idx_acos_lft_rght ON `acos` (`lft`, `rhgt`); +CREATE INDEX idx_acos_lft_rght ON `acos` (`lft`, `rght`); CREATE INDEX idx_acos_alias ON `acos` (`alias`); -CREATE INDEX idx_aros_lft_rght ON `aros` (`lft`, `rhgt`); +h +CREATE INDEX idx_aros_lft_rght ON `aros` (`lft`, `rght`); CREATE INDEX idx_aros_alias ON `aros` (`alias`); -CREATE INDEX idx_aco_id ON `aros_acos` (`aco_id`); \ No newline at end of file +CREATE INDEX idx_aco_id ON `aros_acos` (`aco_id`); From 9b8e6403fde46f20b6b5cf943e85c733ac3d0f93 Mon Sep 17 00:00:00 2001 From: mark_story Date: Mon, 21 Jul 2014 21:31:05 -0400 Subject: [PATCH 07/13] Add indexes to db_acl.sql in skel directory. Copy changes in app/Config/Schema into the skel directory. Refs #4052 --- .../Templates/skel/Config/Schema/db_acl.sql | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Console/Templates/skel/Config/Schema/db_acl.sql b/lib/Cake/Console/Templates/skel/Config/Schema/db_acl.sql index 274780e26..30cbe0675 100644 --- a/lib/Cake/Console/Templates/skel/Config/Schema/db_acl.sql +++ b/lib/Cake/Console/Templates/skel/Config/Schema/db_acl.sql @@ -38,4 +38,16 @@ CREATE TABLE aros ( lft INTEGER(10) DEFAULT NULL, rght INTEGER(10) DEFAULT NULL, PRIMARY KEY (id) -); \ No newline at end of file +); + +/* this indexes will improve acl perfomance */ +CREATE INDEX idx_acos_lft_rght ON `acos` (`lft`, `rght`); + +CREATE INDEX idx_acos_alias ON `acos` (`alias`); + +h +CREATE INDEX idx_aros_lft_rght ON `aros` (`lft`, `rght`); + +CREATE INDEX idx_aros_alias ON `aros` (`alias`); + +CREATE INDEX idx_aco_id ON `aros_acos` (`aco_id`); From b61972871a61f0f6ed064600d678d57009f4b6be Mon Sep 17 00:00:00 2001 From: David Steinsland Date: Tue, 22 Jul 2014 13:21:42 +0200 Subject: [PATCH 08/13] Fixed sending of headers when ajaxLogin is set --- lib/Cake/Controller/Component/AuthComponent.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Controller/Component/AuthComponent.php b/lib/Cake/Controller/Component/AuthComponent.php index b5cdda8bc..5435862f6 100644 --- a/lib/Cake/Controller/Component/AuthComponent.php +++ b/lib/Cake/Controller/Component/AuthComponent.php @@ -367,7 +367,8 @@ class AuthComponent extends Component { if (!empty($this->ajaxLogin)) { $controller->response->statusCode(403); $controller->viewPath = 'Elements'; - echo $controller->render($this->ajaxLogin, $this->RequestHandler->ajaxLayout); + $response = $controller->render($this->ajaxLogin, $this->RequestHandler->ajaxLayout); + $response->send(); $this->_stop(); return false; } From d98abc58d16c241ac8e847fb66fbb975aba29822 Mon Sep 17 00:00:00 2001 From: David Steinsland Date: Tue, 22 Jul 2014 14:45:18 +0200 Subject: [PATCH 09/13] Added test case for CakeResponse::send() and ajaxLogin --- .../Component/AuthComponentTest.php | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php b/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php index be974fd11..22f451973 100644 --- a/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php @@ -1155,6 +1155,36 @@ class AuthComponentTest extends CakeTestCase { unset($_SERVER['HTTP_X_REQUESTED_WITH']); } +/** + * testAjaxLoginResponseCode + * + * @return void + */ + public function testAjaxLoginResponseCode() { + App::build(array( + 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS) + )); + $_SERVER['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest'; + + $url = '/ajax_auth/add'; + $this->Auth->request->addParams(Router::parse($url)); + $this->Auth->request->query['url'] = ltrim($url, '/'); + $this->Auth->request->base = ''; + $this->Auth->ajaxLogin = 'test_element'; + + Router::setRequestInfo($this->Auth->request); + + $this->Controller->response = $this->getMock('CakeResponse', array('send')); + $this->Controller->response->expects($this->once())->method('send'); + $this->Auth->initialize($this->Controller); + + $result = $this->Auth->startup($this->Controller); + + $this->assertFalse($result); + $this->assertEquals('this is the test element', $this->Controller->response->body()); + unset($_SERVER['HTTP_X_REQUESTED_WITH']); + } + /** * testLoginActionRedirect method * From 6e777a54a3804585ff4f4bc266a74f8a196df13e Mon Sep 17 00:00:00 2001 From: David Steinsland Date: Tue, 22 Jul 2014 15:05:06 +0200 Subject: [PATCH 10/13] Mocking _sendHeader instead of send() --- .../Test/Case/Controller/Component/AuthComponentTest.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php b/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php index 22f451973..a0e8d284f 100644 --- a/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php @@ -1174,8 +1174,10 @@ class AuthComponentTest extends CakeTestCase { Router::setRequestInfo($this->Auth->request); - $this->Controller->response = $this->getMock('CakeResponse', array('send')); - $this->Controller->response->expects($this->once())->method('send'); + $this->Controller->response = $this->getMock('CakeResponse', array('_sendHeader')); + $this->Controller->response->expects($this->at(0)) + ->method('_sendHeader') + ->with('HTTP/1.1 403 Forbidden', null); $this->Auth->initialize($this->Controller); $result = $this->Auth->startup($this->Controller); From 08de917b3c8dabdf5cb88381ce655ddeb3d37005 Mon Sep 17 00:00:00 2001 From: mark_story Date: Tue, 22 Jul 2014 09:38:30 -0400 Subject: [PATCH 11/13] Fix accidental typo in SQL file. Fixes #4061 --- app/Config/Schema/db_acl.sql | 1 - lib/Cake/Console/Templates/skel/Config/Schema/db_acl.sql | 1 - 2 files changed, 2 deletions(-) diff --git a/app/Config/Schema/db_acl.sql b/app/Config/Schema/db_acl.sql index 30cbe0675..0bf3f7687 100644 --- a/app/Config/Schema/db_acl.sql +++ b/app/Config/Schema/db_acl.sql @@ -45,7 +45,6 @@ CREATE INDEX idx_acos_lft_rght ON `acos` (`lft`, `rght`); CREATE INDEX idx_acos_alias ON `acos` (`alias`); -h CREATE INDEX idx_aros_lft_rght ON `aros` (`lft`, `rght`); CREATE INDEX idx_aros_alias ON `aros` (`alias`); diff --git a/lib/Cake/Console/Templates/skel/Config/Schema/db_acl.sql b/lib/Cake/Console/Templates/skel/Config/Schema/db_acl.sql index 30cbe0675..0bf3f7687 100644 --- a/lib/Cake/Console/Templates/skel/Config/Schema/db_acl.sql +++ b/lib/Cake/Console/Templates/skel/Config/Schema/db_acl.sql @@ -45,7 +45,6 @@ CREATE INDEX idx_acos_lft_rght ON `acos` (`lft`, `rght`); CREATE INDEX idx_acos_alias ON `acos` (`alias`); -h CREATE INDEX idx_aros_lft_rght ON `aros` (`lft`, `rght`); CREATE INDEX idx_aros_alias ON `aros` (`alias`); From aad89444d19a5e74b3a7043a3edf49273175c7eb Mon Sep 17 00:00:00 2001 From: Rachman Chavik Date: Thu, 24 Jul 2014 15:58:34 +0700 Subject: [PATCH 12/13] Fix: Blackholed request when POSTing to a URL with space Eg: Actual Posted URL: /admin/settings/settings/prefix/Access%20Control $_GET value: /admin/settings/settings/prefix/Access_Control Since $unsetUrl differs, the $_GET value will get copied in to CakeRequest::$query, causing CakeRequest::here() to return: /admin/settings/settings/prefix/Access%20Control?%2Fadmin%2Fsettings%2Fsettings%2Fprefix%2FAccess_Control= This confuses SecurityComponent in the following line: https://github.com/cakephp/cakephp/blob/f23d811ff59c50ef278e98bb75f4ec1e7e54a5b3/lib/Cake/Controller/Component/SecurityComponent.php#L514 --- lib/Cake/Network/CakeRequest.php | 2 +- lib/Cake/Test/Case/Network/CakeRequestTest.php | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Network/CakeRequest.php b/lib/Cake/Network/CakeRequest.php index 7e1a740d7..d119e92d4 100644 --- a/lib/Cake/Network/CakeRequest.php +++ b/lib/Cake/Network/CakeRequest.php @@ -207,7 +207,7 @@ class CakeRequest implements ArrayAccess { $query = $_GET; } - $unsetUrl = '/' . str_replace('.', '_', urldecode($this->url)); + $unsetUrl = '/' . str_replace(array('.', ' '), '_', urldecode($this->url)); unset($query[$unsetUrl]); unset($query[$this->base . $unsetUrl]); if (strpos($this->url, '?') !== false) { diff --git a/lib/Cake/Test/Case/Network/CakeRequestTest.php b/lib/Cake/Test/Case/Network/CakeRequestTest.php index 391452072..0ce3ae59d 100644 --- a/lib/Cake/Test/Case/Network/CakeRequestTest.php +++ b/lib/Cake/Test/Case/Network/CakeRequestTest.php @@ -2144,6 +2144,20 @@ class CakeRequestTest extends CakeTestCase { $this->assertEquals('/posts/base_path/1/name:value?test=value', $result); } +/** + * Test the here() with space in URL + * + * @return void + */ + public function testHereWithSpaceInUrl() { + Configure::write('App.base', ''); + $_GET = array('/admin/settings/settings/prefix/Access_Control' => ''); + $request = new CakeRequest('/admin/settings/settings/prefix/Access%20Control'); + + $result = $request->here(); + $this->assertEquals('/admin/settings/settings/prefix/Access%20Control', $result); + } + /** * Test the input() method. * From 99d6932eccce211ce5cb9a25a00074d95e1bae02 Mon Sep 17 00:00:00 2001 From: euromark Date: Thu, 24 Jul 2014 18:43:48 +0200 Subject: [PATCH 13/13] Fix project baking --- lib/Cake/Console/Command/Task/ProjectTask.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Console/Command/Task/ProjectTask.php b/lib/Cake/Console/Command/Task/ProjectTask.php index 51cda2bd6..c3345ffa7 100644 --- a/lib/Cake/Console/Command/Task/ProjectTask.php +++ b/lib/Cake/Console/Command/Task/ProjectTask.php @@ -237,8 +237,8 @@ class ProjectTask extends AppShell { $File = new File($path . 'Console' . DS . 'cake.php'); $contents = $File->read(); if (preg_match('/(__CAKE_PATH__)/', $contents, $match)) { - $root = strpos(CAKE_CORE_INCLUDE_PATH, '/') === 0 ? " \$ds . '" : "'"; - $replacement = $root . str_replace(DS, "' . \$ds . '", trim(CAKE_CORE_INCLUDE_PATH, DS)) . "'"; + $root = strpos(CAKE_CORE_INCLUDE_PATH, '/') === 0 ? " DS . '" : "'"; + $replacement = $root . str_replace(DS, "' . DS . '", trim(CAKE_CORE_INCLUDE_PATH, DS)) . "'"; $result = str_replace($match[0], $replacement, $contents); if ($File->write($result)) { return true;