mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
merging 1.2
This commit is contained in:
parent
94c01ac7b4
commit
6535e6225c
6 changed files with 39 additions and 9 deletions
|
@ -6,4 +6,4 @@
|
||||||
// +---------------------------------------------------------------------------------------------------+ //
|
// +---------------------------------------------------------------------------------------------------+ //
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
1.2.2.8120
|
1.2.3.8166
|
|
@ -22,5 +22,5 @@
|
||||||
* @lastmodified $Date$
|
* @lastmodified $Date$
|
||||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||||
*/
|
*/
|
||||||
return $config['Cake.version'] = '1.2.2.8120';
|
return $config['Cake.version'] = '1.2.3.8166';
|
||||||
?>
|
?>
|
|
@ -344,7 +344,8 @@ class Dispatcher extends Object {
|
||||||
return $this->base = $base;
|
return $this->base = $base;
|
||||||
}
|
}
|
||||||
if (!$baseUrl) {
|
if (!$baseUrl) {
|
||||||
$base = dirname(env('PHP_SELF'));
|
$replace = array('<', '>', '*', '\'', '"');
|
||||||
|
$base = str_replace($replace, '', dirname(env('PHP_SELF')));
|
||||||
|
|
||||||
if ($webroot === 'webroot' && $webroot === basename($base)) {
|
if ($webroot === 'webroot' && $webroot === basename($base)) {
|
||||||
$base = dirname($base);
|
$base = dirname($base);
|
||||||
|
|
|
@ -1010,7 +1010,10 @@ class Model extends Overloadable {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id !== null && $id !== false) {
|
if ($id !== null && $id !== false) {
|
||||||
$this->data = $this->find(array($this->alias . '.' . $this->primaryKey => $id), $fields);
|
$this->data = $this->find('first', array(
|
||||||
|
'conditions' => array($this->alias . '.' . $this->primaryKey => $id),
|
||||||
|
'fields' => $fields
|
||||||
|
));
|
||||||
return $this->data;
|
return $this->data;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1898,6 +1898,23 @@ class DispatcherTest extends CakeTestCase {
|
||||||
|
|
||||||
unset($_POST['_method']);
|
unset($_POST['_method']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests that invalid characters cannot be injected into the application base path.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function testBasePathInjection() {
|
||||||
|
$self = $_SERVER['PHP_SELF'];
|
||||||
|
$_SERVER['PHP_SELF'] = urldecode(
|
||||||
|
"/index.php/%22%3E%3Ch1%20onclick=%22alert('xss');%22%3Eheya%3C/h1%3E"
|
||||||
|
);
|
||||||
|
|
||||||
|
$dispatcher =& new Dispatcher();
|
||||||
|
$result = $dispatcher->baseUrl();
|
||||||
|
$expected = '/index.php/h1 onclick=alert(xss);heya';
|
||||||
|
$this->assertEqual($result, $expected);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* testEnvironmentDetection method
|
* testEnvironmentDetection method
|
||||||
*
|
*
|
||||||
|
|
|
@ -658,14 +658,23 @@ class RouterTest extends CakeTestCase {
|
||||||
|
|
||||||
Router::reload();
|
Router::reload();
|
||||||
Router::setRequestInfo(array(
|
Router::setRequestInfo(array(
|
||||||
array('plugin' => 'shows', 'controller' => 'show_tickets', 'action' => 'admin_edit', 'pass' =>
|
array(
|
||||||
array(0 => '6'), 'prefix' => 'admin', 'admin' => true, 'form' => array(), 'url' =>
|
'plugin' => 'shows', 'controller' => 'show_tickets', 'action' => 'admin_edit',
|
||||||
array('url' => 'admin/shows/show_tickets/edit/6')),
|
'pass' => array('6'), 'prefix' => 'admin', 'admin' => true, 'form' => array(),
|
||||||
array('plugin' => NULL, 'controller' => NULL, 'action' => NULL, 'base' => '', 'here' => '/admin/shows/show_tickets/edit/6', 'webroot' => '/')));
|
'url' => array('url' => 'admin/shows/show_tickets/edit/6')
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'plugin' => null, 'controller' => null, 'action' => null, 'base' => '',
|
||||||
|
'here' => '/admin/shows/show_tickets/edit/6', 'webroot' => '/'
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
Router::parse('/');
|
Router::parse('/');
|
||||||
|
|
||||||
$result = Router::url(array('plugin' => 'shows', 'controller' => 'show_tickets', 'action' => 'edit', 'id' => '6', 'admin' => true, 'prefix' => 'admin', ));
|
$result = Router::url(array(
|
||||||
|
'plugin' => 'shows', 'controller' => 'show_tickets', 'action' => 'edit', 'id' => '6',
|
||||||
|
'admin' => true, 'prefix' => 'admin'
|
||||||
|
));
|
||||||
$expected = '/admin/shows/show_tickets/edit/6';
|
$expected = '/admin/shows/show_tickets/edit/6';
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue