Skip to content

Commit

Permalink
Doing a little optimization for php 5.1 <, also fixing tests on Windo…
Browse files Browse the repository at this point in the history
…ws. Fixes #155.
  • Loading branch information
renan committed Oct 15, 2009
1 parent 082156f commit 43dbf71
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions cake/libs/session.php
Expand Up @@ -592,15 +592,15 @@ function _checkValid() {
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')) {
Expand All @@ -610,7 +610,7 @@ function __regenerateId() {
session_id($oldSessionId);
session_start();
session_destroy();
$file = $sessionpath . DS . "sess_$oldSessionId";
$file = $sessionPath . DS . 'sess_' . $oldSessionId;
@unlink($file);
$this->__initSession();
session_id($newSessid);
Expand Down
2 changes: 1 addition & 1 deletion cake/tests/cases/libs/view/helpers/session.test.php
Expand Up @@ -224,7 +224,7 @@ function testFlashMissingLayout() {
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
Expand Down

0 comments on commit 43dbf71

Please sign in to comment.