Doing a little optimization for php 5.1 <, also fixing tests on Windows. Fixes #155.

This commit is contained in:
renan.saddam 2009-10-15 18:09:58 -03:00
parent 082156f9a1
commit 43dbf71624
2 changed files with 7 additions and 7 deletions

View file

@ -592,15 +592,15 @@ class CakeSession extends Object {
function __regenerateId() {
$oldSessionId = session_id();
if ($oldSessionId) {
$sessionpath = session_save_path();
if (empty($sessionpath)) {
$sessionpath = "/tmp";
}
if (session_id() != "" || isset($_COOKIE[session_name()])) {
if (session_id() != ''|| isset($_COOKIE[session_name()])) {
setcookie(Configure::read('Session.cookie'), '', time() - 42000, $this->path);
}
session_regenerate_id(true);
if (PHP_VERSION < 5.1) {
$sessionPath = session_save_path();
if (empty($sessionPath)) {
$sessionPath = '/tmp';
}
$newSessid = session_id();
if (function_exists('session_write_close')) {
@ -610,7 +610,7 @@ class CakeSession extends Object {
session_id($oldSessionId);
session_start();
session_destroy();
$file = $sessionpath . DS . "sess_$oldSessionId";
$file = $sessionPath . DS . 'sess_' . $oldSessionId;
@unlink($file);
$this->__initSession();
session_id($newSessid);

View file

@ -224,7 +224,7 @@ class SessionHelperTest extends CakeTestCase {
ob_clean();
$this->assertPattern("/Missing Layout/", $result);
$this->assertPattern("/layouts\/does_not_exist.ctp/", $result);
$this->assertPattern("/layouts(\\\|\/)does_not_exist.ctp/", $result);
}
/**
* testID method