diff --git a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php index 030333933..81dda0ea3 100644 --- a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php @@ -10648,4 +10648,36 @@ class FormHelperTest extends CakeTestCase { $this->assertEquals($expected, $result); } +/** + * Tests `_lastAction`. + * + * With named, numeric value + * + * @return void + */ + public function testLastActionWithNamedNumeric() { + $here = '/users/index/page:1'; + + $this->Form->request->here = $here; + $this->Form->create('User'); + + $this->assertAttributeEquals($here, '_lastAction', $this->Form, "_lastAction shouldn't be empty."); + } + +/** + * Tests `_lastAction`. + * + * With named, string value + * + * @return void + */ + public function testLastActionWithNamedString() { + $here = '/users/index/foo:bar'; + + $this->Form->request->here = $here; + $this->Form->create('User'); + + $this->assertAttributeEquals($here, '_lastAction', $this->Form, "_lastAction shouldn't be empty."); + } + } diff --git a/lib/Cake/View/Helper/FormHelper.php b/lib/Cake/View/Helper/FormHelper.php index 68d6c9347..9133a4c3f 100644 --- a/lib/Cake/View/Helper/FormHelper.php +++ b/lib/Cake/View/Helper/FormHelper.php @@ -3107,7 +3107,7 @@ class FormHelper extends AppHelper { * @return void */ protected function _lastAction($url) { - $action = html_entity_decode($this->url($url), ENT_QUOTES); + $action = html_entity_decode($this->url($url, true), ENT_QUOTES); $query = parse_url($action, PHP_URL_QUERY); $query = $query ? '?' . $query : ''; $this->_lastAction = parse_url($action, PHP_URL_PATH) . $query;