diff --git a/.travis.yml b/.travis.yml index a84bb5115..8a2335a5c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ php: - 5.3 - 5.4 - 5.5 + - 5.6 env: - DB=mysql diff --git a/lib/Cake/Controller/Controller.php b/lib/Cake/Controller/Controller.php index 00b80fb2f..ca311fe86 100644 --- a/lib/Cake/Controller/Controller.php +++ b/lib/Cake/Controller/Controller.php @@ -970,7 +970,7 @@ class Controller extends Object implements CakeEventListener { $referer = $this->request->referer($local); if ($referer === '/' && $default) { - return Router::url($default, true); + return Router::url($default, !$local); } return $referer; } diff --git a/lib/Cake/Model/Model.php b/lib/Cake/Model/Model.php index 2b6840943..0d6c19594 100644 --- a/lib/Cake/Model/Model.php +++ b/lib/Cake/Model/Model.php @@ -2108,7 +2108,7 @@ class Model extends Object implements CakeEventListener { protected function _prepareUpdateFields($data) { $foreignKeys = array(); foreach ($this->belongsTo as $assoc => $info) { - if ($info['counterCache']) { + if (isset($info['counterCache']) && $info['counterCache']) { $foreignKeys[$assoc] = $info['foreignKey']; } } diff --git a/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php b/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php index 5c061d938..8a4af98aa 100644 --- a/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php @@ -959,7 +959,7 @@ class AuthComponentTest extends CakeTestCase { array($CakeRequest, $CakeResponse) ); - $expected = Router::url($this->Auth->loginRedirect, true); + $expected = Router::url($this->Auth->loginRedirect); $Controller->expects($this->once()) ->method('redirect') ->with($this->equalTo($expected)); diff --git a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php index 5d59d6941..de3d8d001 100755 --- a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php @@ -1294,7 +1294,7 @@ class FormHelperTest extends CakeTestCase { * * @return void */ - public function testFormSecuredFileInput() { + public function testSecuredFileInput() { $this->Form->request['_Token'] = array('key' => 'testKey'); $this->assertEquals(array(), $this->Form->fields); @@ -1311,7 +1311,7 @@ class FormHelperTest extends CakeTestCase { * * @return void */ - public function testFormSecuredMultipleSelect() { + public function testSecuredMultipleSelect() { $this->Form->request['_Token'] = array('key' => 'testKey'); $this->assertEquals(array(), $this->Form->fields); $options = array('1' => 'one', '2' => 'two'); @@ -1330,7 +1330,7 @@ class FormHelperTest extends CakeTestCase { * * @return void */ - public function testFormSecuredRadio() { + public function testSecuredRadio() { $this->Form->request['_Token'] = array('key' => 'testKey'); $this->assertEquals(array(), $this->Form->fields); $options = array('1' => 'option1', '2' => 'option2'); @@ -1345,7 +1345,7 @@ class FormHelperTest extends CakeTestCase { * * @return void */ - public function testFormSecuredAndDisabledNotAssoc() { + public function testSecuredAndDisabledNotAssoc() { $this->Form->request['_Token'] = array('key' => 'testKey'); $this->Form->select('Model.select', array(1, 2), array('disabled')); @@ -1367,7 +1367,7 @@ class FormHelperTest extends CakeTestCase { * * @return void */ - public function testFormSecuredAndDisabled() { + public function testSecuredAndDisabled() { $this->Form->request['_Token'] = array('key' => 'testKey'); $this->Form->checkbox('Model.checkbox', array('disabled' => true)); @@ -1389,6 +1389,34 @@ class FormHelperTest extends CakeTestCase { $this->assertEquals($expected, $this->Form->fields); } +/** + * Test that only the path + query elements of a form's URL show up in their hash. + * + * @return void + */ + public function testSecuredFormUrlIgnoresHost() { + $this->Form->request['_Token'] = array('key' => 'testKey'); + + $expected = '0ff0c85cd70584d8fd18fa136846d22c66c21e2d%3A'; + $this->Form->create('Address', array( + 'url' => array('controller' => 'articles', 'action' => 'view', 1, '?' => array('page' => 1)) + )); + $result = $this->Form->secure(); + $this->assertContains($expected, $result); + + $this->Form->create('Address', array('url' => 'http://localhost/articles/view/1?page=1')); + $result = $this->Form->secure(); + $this->assertContains($expected, $result, 'Full URL should only use path and query.'); + + $this->Form->create('Address', array('url' => '/articles/view/1?page=1')); + $result = $this->Form->secure(); + $this->assertContains($expected, $result, 'URL path + query should work.'); + + $this->Form->create('Address', array('url' => '/articles/view/1')); + $result = $this->Form->secure(); + $this->assertNotContains($expected, $result, 'URL is different'); + } + /** * testDisableSecurityUsingForm method * diff --git a/lib/Cake/Utility/Debugger.php b/lib/Cake/Utility/Debugger.php index 92e624a7e..902b43310 100644 --- a/lib/Cake/Utility/Debugger.php +++ b/lib/Cake/Utility/Debugger.php @@ -700,7 +700,7 @@ class Debugger { * @deprecated Use Debugger::outputAs() and Debugger::addFormat(). Will be removed * in 3.0 */ - public function output($format = null, $strings = array()) { + public static function output($format = null, $strings = array()) { $self = Debugger::getInstance(); $data = null; diff --git a/lib/Cake/View/Errors/missing_component.ctp b/lib/Cake/View/Errors/missing_component.ctp index ae72b0ea7..2d384b2d7 100644 --- a/lib/Cake/View/Errors/missing_component.ctp +++ b/lib/Cake/View/Errors/missing_component.ctp @@ -25,7 +25,7 @@ $pluginDot = empty($plugin) ? null : $plugin . '.';

: - ' . h($class) . '', (empty($plugin) ? APP_DIR : CakePlugin::path($plugin)) . DS . 'Controller' . DS . 'Component' . DS . h($class) . '.php'); ?> + ' . h($class) . '', (empty($plugin) ? APP_DIR . DS : CakePlugin::path($plugin)) . 'Controller' . DS . 'Component' . DS . h($class) . '.php'); ?>

 <?php
diff --git a/lib/Cake/View/Helper/FormHelper.php b/lib/Cake/View/Helper/FormHelper.php
index 7d20927a4..6026b4bc4 100755
--- a/lib/Cake/View/Helper/FormHelper.php
+++ b/lib/Cake/View/Helper/FormHelper.php
@@ -466,7 +466,14 @@ class FormHelper extends AppHelper {
 			$this->setEntity($model, true);
 			$this->_introspectModel($model, 'fields');
 		}
+
 		$this->_lastAction = $action;
+		if (strpos($action, '://')) {
+			$query = parse_url($action, PHP_URL_QUERY);
+			$query = $query ? '?' . $query : '';
+			$this->_lastAction = parse_url($action, PHP_URL_PATH) . $query;
+		}
+
 		return $this->Html->useTag('form', $action, $htmlAttributes) . $append;
 	}