Merge branch 'master' into 1.3

This commit is contained in:
gwoo 2009-06-03 10:00:56 -07:00
commit 0ea02c5a94
3 changed files with 25 additions and 6 deletions

View file

@ -145,15 +145,23 @@ class CakeSession extends Object {
}
}
if ($start === true) {
$this->host = env('HTTP_HOST');
$this->path = '/';
if (strpos($base, '?') === false && strpos($base, 'index.php') === false) {
if (!empty($base)) {
$this->path = $base;
if (strpos($base, 'index.php') !== false) {
$this->path = str_replace('index.php', '', $base);
}
if (strpos($base, '?') !== false) {
$this->path = str_replace('?', '', $base);
}
}
$this->host = env('HTTP_HOST');
if (strpos($this->host, ':') !== false) {
$this->host = substr($this->host, 0, strpos($this->host, ':'));
}
if (!class_exists('Security')) {
App::import('Core', 'Security');
}
$this->sessionTime = $this->time + (Security::inactiveMins() * Configure::read('Session.timeout'));
$this->security = Configure::read('Security.level');
}

View file

@ -493,7 +493,7 @@ class DispatcherTest extends CakeTestCase {
* @access public
* @return void
*/
function setUp() {
function startTest() {
$this->_get = $_GET;
$_GET = array();
$this->_post = $_POST;
@ -512,7 +512,11 @@ class DispatcherTest extends CakeTestCase {
$this->_vendorPaths = Configure::read('vendorPaths');
$this->_pluginPaths = Configure::read('pluginPaths');
$this->_viewPaths = Configure::read('viewPaths');
$this->_controllerPaths = Configure::read('controllerPaths');
$this->_debug = Configure::read('debug');
Configure::write('controllerPaths', Configure::corePaths('controller'));
Configure::write('viewPaths', Configure::corePaths('view'));
}
/**
* tearDown method
@ -520,7 +524,7 @@ class DispatcherTest extends CakeTestCase {
* @access public
* @return void
*/
function tearDown() {
function endTest() {
$_GET = $this->_get;
$_POST = $this->_post;
$_FILES = $this->_files;
@ -530,6 +534,7 @@ class DispatcherTest extends CakeTestCase {
Configure::write('vendorPaths', $this->_vendorPaths);
Configure::write('pluginPaths', $this->_pluginPaths);
Configure::write('viewPaths', $this->_viewPaths);
Configure::write('controllerPaths', $this->_controllerPaths);
Configure::write('debug', $this->_debug);
}
/**

View file

@ -92,6 +92,12 @@ class SessionTest extends CakeTestCase {
function testSessionPath() {
$Session = new CakeSession('/index.php');
$this->assertEqual('/', $Session->path);
$Session = new CakeSession('/sub_dir/index.php');
$this->assertEqual('/sub_dir/', $Session->path);
$Session = new CakeSession('');
$this->assertEqual('/', $Session->path, 'Session path is empty, with "" as $base needs to be / %s');
}
/**
* testCheck method