mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-14 19:08:25 +00:00
Merge branch 'master' into 2.5
This commit is contained in:
commit
89cd114e6f
8 changed files with 46 additions and 10 deletions
|
@ -5,6 +5,7 @@ php:
|
|||
- 5.3
|
||||
- 5.4
|
||||
- 5.5
|
||||
- 5.6
|
||||
|
||||
env:
|
||||
- DB=mysql
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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'];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ $pluginDot = empty($plugin) ? null : $plugin . '.';
|
|||
</p>
|
||||
<p class="error">
|
||||
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
|
||||
<?php echo __d('cake_dev', 'Create the class %s below in file: %s', '<em>' . h($class) . '</em>', (empty($plugin) ? APP_DIR : CakePlugin::path($plugin)) . DS . 'Controller' . DS . 'Component' . DS . h($class) . '.php'); ?>
|
||||
<?php echo __d('cake_dev', 'Create the class %s below in file: %s', '<em>' . h($class) . '</em>', (empty($plugin) ? APP_DIR . DS : CakePlugin::path($plugin)) . 'Controller' . DS . 'Component' . DS . h($class) . '.php'); ?>
|
||||
</p>
|
||||
<pre>
|
||||
<?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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue