mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +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.3
|
||||||
- 5.4
|
- 5.4
|
||||||
- 5.5
|
- 5.5
|
||||||
|
- 5.6
|
||||||
|
|
||||||
env:
|
env:
|
||||||
- DB=mysql
|
- DB=mysql
|
||||||
|
|
|
@ -970,7 +970,7 @@ class Controller extends Object implements CakeEventListener {
|
||||||
|
|
||||||
$referer = $this->request->referer($local);
|
$referer = $this->request->referer($local);
|
||||||
if ($referer === '/' && $default) {
|
if ($referer === '/' && $default) {
|
||||||
return Router::url($default, true);
|
return Router::url($default, !$local);
|
||||||
}
|
}
|
||||||
return $referer;
|
return $referer;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2108,7 +2108,7 @@ class Model extends Object implements CakeEventListener {
|
||||||
protected function _prepareUpdateFields($data) {
|
protected function _prepareUpdateFields($data) {
|
||||||
$foreignKeys = array();
|
$foreignKeys = array();
|
||||||
foreach ($this->belongsTo as $assoc => $info) {
|
foreach ($this->belongsTo as $assoc => $info) {
|
||||||
if ($info['counterCache']) {
|
if (isset($info['counterCache']) && $info['counterCache']) {
|
||||||
$foreignKeys[$assoc] = $info['foreignKey'];
|
$foreignKeys[$assoc] = $info['foreignKey'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -959,7 +959,7 @@ class AuthComponentTest extends CakeTestCase {
|
||||||
array($CakeRequest, $CakeResponse)
|
array($CakeRequest, $CakeResponse)
|
||||||
);
|
);
|
||||||
|
|
||||||
$expected = Router::url($this->Auth->loginRedirect, true);
|
$expected = Router::url($this->Auth->loginRedirect);
|
||||||
$Controller->expects($this->once())
|
$Controller->expects($this->once())
|
||||||
->method('redirect')
|
->method('redirect')
|
||||||
->with($this->equalTo($expected));
|
->with($this->equalTo($expected));
|
||||||
|
|
|
@ -1294,7 +1294,7 @@ class FormHelperTest extends CakeTestCase {
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testFormSecuredFileInput() {
|
public function testSecuredFileInput() {
|
||||||
$this->Form->request['_Token'] = array('key' => 'testKey');
|
$this->Form->request['_Token'] = array('key' => 'testKey');
|
||||||
$this->assertEquals(array(), $this->Form->fields);
|
$this->assertEquals(array(), $this->Form->fields);
|
||||||
|
|
||||||
|
@ -1311,7 +1311,7 @@ class FormHelperTest extends CakeTestCase {
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testFormSecuredMultipleSelect() {
|
public function testSecuredMultipleSelect() {
|
||||||
$this->Form->request['_Token'] = array('key' => 'testKey');
|
$this->Form->request['_Token'] = array('key' => 'testKey');
|
||||||
$this->assertEquals(array(), $this->Form->fields);
|
$this->assertEquals(array(), $this->Form->fields);
|
||||||
$options = array('1' => 'one', '2' => 'two');
|
$options = array('1' => 'one', '2' => 'two');
|
||||||
|
@ -1330,7 +1330,7 @@ class FormHelperTest extends CakeTestCase {
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testFormSecuredRadio() {
|
public function testSecuredRadio() {
|
||||||
$this->Form->request['_Token'] = array('key' => 'testKey');
|
$this->Form->request['_Token'] = array('key' => 'testKey');
|
||||||
$this->assertEquals(array(), $this->Form->fields);
|
$this->assertEquals(array(), $this->Form->fields);
|
||||||
$options = array('1' => 'option1', '2' => 'option2');
|
$options = array('1' => 'option1', '2' => 'option2');
|
||||||
|
@ -1345,7 +1345,7 @@ class FormHelperTest extends CakeTestCase {
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testFormSecuredAndDisabledNotAssoc() {
|
public function testSecuredAndDisabledNotAssoc() {
|
||||||
$this->Form->request['_Token'] = array('key' => 'testKey');
|
$this->Form->request['_Token'] = array('key' => 'testKey');
|
||||||
|
|
||||||
$this->Form->select('Model.select', array(1, 2), array('disabled'));
|
$this->Form->select('Model.select', array(1, 2), array('disabled'));
|
||||||
|
@ -1367,7 +1367,7 @@ class FormHelperTest extends CakeTestCase {
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testFormSecuredAndDisabled() {
|
public function testSecuredAndDisabled() {
|
||||||
$this->Form->request['_Token'] = array('key' => 'testKey');
|
$this->Form->request['_Token'] = array('key' => 'testKey');
|
||||||
|
|
||||||
$this->Form->checkbox('Model.checkbox', array('disabled' => true));
|
$this->Form->checkbox('Model.checkbox', array('disabled' => true));
|
||||||
|
@ -1389,6 +1389,34 @@ class FormHelperTest extends CakeTestCase {
|
||||||
$this->assertEquals($expected, $this->Form->fields);
|
$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
|
* testDisableSecurityUsingForm method
|
||||||
*
|
*
|
||||||
|
|
|
@ -700,7 +700,7 @@ class Debugger {
|
||||||
* @deprecated Use Debugger::outputAs() and Debugger::addFormat(). Will be removed
|
* @deprecated Use Debugger::outputAs() and Debugger::addFormat(). Will be removed
|
||||||
* in 3.0
|
* in 3.0
|
||||||
*/
|
*/
|
||||||
public function output($format = null, $strings = array()) {
|
public static function output($format = null, $strings = array()) {
|
||||||
$self = Debugger::getInstance();
|
$self = Debugger::getInstance();
|
||||||
$data = null;
|
$data = null;
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ $pluginDot = empty($plugin) ? null : $plugin . '.';
|
||||||
</p>
|
</p>
|
||||||
<p class="error">
|
<p class="error">
|
||||||
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
|
<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>
|
</p>
|
||||||
<pre>
|
<pre>
|
||||||
<?php
|
<?php
|
||||||
|
|
|
@ -466,7 +466,14 @@ class FormHelper extends AppHelper {
|
||||||
$this->setEntity($model, true);
|
$this->setEntity($model, true);
|
||||||
$this->_introspectModel($model, 'fields');
|
$this->_introspectModel($model, 'fields');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_lastAction = $action;
|
$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;
|
return $this->Html->useTag('form', $action, $htmlAttributes) . $append;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue