Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' into 1.3

  • Loading branch information...
commit 0ea02c5a94f7cc1e4fb1b7c5a8e1e29f22027f67 2 parents 303bc0f + bbb5642
gwoo authored
View
16 cake/libs/cake_session.php
@@ -145,15 +145,23 @@ function __construct($base = null, $start = true) {
}
}
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
9 cake/tests/cases/dispatcher.test.php
@@ -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 @@ function setUp() {
$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 @@ function setUp() {
* @access public
* @return void
*/
- function tearDown() {
+ function endTest() {
$_GET = $this->_get;
$_POST = $this->_post;
$_FILES = $this->_files;
@@ -530,6 +534,7 @@ function tearDown() {
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
6 cake/tests/cases/libs/cake_session.test.php
@@ -92,6 +92,12 @@ function tearDown() {
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
Please sign in to comment.
Something went wrong with that request. Please try again.