mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
optimization refs #3415
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6970 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
a625537c4e
commit
45bccc5215
8 changed files with 43 additions and 7 deletions
|
@ -202,7 +202,7 @@ class ApiShell extends Shell {
|
|||
foreach($result[2] as $key => $method) {
|
||||
$method = str_replace('function ', '', trim($method));
|
||||
|
||||
if (strpos($method, '__') === false && strpos($method, '_') !== 0) {
|
||||
if (strpos($method, '__') === false && $method[0] != '_') {
|
||||
$parsed[$method] = array(
|
||||
'comment' => r(array('/*', '*/', '*'), '', trim($result[1][$key])),
|
||||
'method' => $method,
|
||||
|
|
|
@ -653,7 +653,7 @@ class SecurityComponent extends Object {
|
|||
}
|
||||
|
||||
foreach ($field as $key => $value) {
|
||||
if(strpos($key, '_') !== 0 && is_array($field[$key])) {
|
||||
if ($key[0] != '_' && is_array($field[$key])) {
|
||||
sort($field[$key]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -744,7 +744,7 @@ class Controller extends Object {
|
|||
$base = FULL_BASE_URL . $this->webroot;
|
||||
if (strpos($ref, $base) === 0) {
|
||||
$return = substr($ref, strlen($base));
|
||||
if (strpos($return, '/') !== 0) {
|
||||
if ($return[0] != '/') {
|
||||
$return = '/'.$return;
|
||||
}
|
||||
return $return;
|
||||
|
|
|
@ -293,7 +293,7 @@ class BehaviorCollection extends Object {
|
|||
|
||||
foreach ($methods as $m) {
|
||||
if (!in_array($m, $parentMethods)) {
|
||||
if (strpos($m, '_') !== 0 && !array_key_exists($m, $this->__methods) && !in_array($m, $callbacks)) {
|
||||
if ($m[0] != '_' && !array_key_exists($m, $this->__methods) && !in_array($m, $callbacks)) {
|
||||
$this->__methods[$m] = array($m, $name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1127,7 +1127,7 @@ class Router extends Object {
|
|||
$q = $extra;
|
||||
}
|
||||
$out .= http_build_query($q, null, '&');
|
||||
if (strpos($out, '?') !== 0) {
|
||||
if ($out[0] != '?') {
|
||||
$out = '?' . $out;
|
||||
}
|
||||
return $out;
|
||||
|
|
|
@ -278,7 +278,7 @@ class FormHelper extends AppHelper {
|
|||
$append = '<fieldset style="display:none;">';
|
||||
|
||||
foreach ($fields as $key => $value) {
|
||||
if (strpos($key, '_') !== 0 && is_array($fields[$key])) {
|
||||
if ($key[0] != '_' && is_array($fields[$key])) {
|
||||
sort($fields[$key]);
|
||||
} else {
|
||||
$model = substr($key, 1);
|
||||
|
|
|
@ -602,7 +602,7 @@ DIGEST;
|
|||
}
|
||||
function __sortFields($fields) {
|
||||
foreach ($fields as $key => $value) {
|
||||
if(strpos($key, '_') !== 0 && is_array($fields[$key])) {
|
||||
if ($key[0] != '_' && is_array($fields[$key])) {
|
||||
sort($fields[$key]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,6 +102,42 @@ class SessionTest extends UnitTestCase {
|
|||
$this->assertFalse($this->Session->valid());
|
||||
}
|
||||
|
||||
function testReadAndWriteWithDatabaseStorage() {
|
||||
$this->tearDown();
|
||||
unset($_SESSION);
|
||||
Configure::write('Session.table', 'cake_sessions');
|
||||
Configure::write('Session.database', 'default');
|
||||
Configure::write('Session.save', 'database');
|
||||
|
||||
$db =& ConnectionManager::getDataSource(Configure::read('Session.database'));
|
||||
$table = $db->fullTableName(Configure::read('Session.table'), false);
|
||||
$sql = <<<SQL
|
||||
CREATE TABLE cake_sessions (
|
||||
id varchar(255) NOT NULL default '',
|
||||
data text,
|
||||
expires int(11) default NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
SQL;
|
||||
$row = $db->query($sql);
|
||||
$this->setUp();
|
||||
|
||||
$this->Session->write('SessionTestCase', 0);
|
||||
$this->assertEqual($this->Session->read('SessionTestCase'), 0);
|
||||
|
||||
$this->Session->write('SessionTestCase', '0');
|
||||
$this->assertEqual($this->Session->read('SessionTestCase'), '0');
|
||||
$this->assertFalse($this->Session->read('SessionTestCase') === 0);
|
||||
|
||||
$this->Session->write('SessionTestCase', false);
|
||||
$this->assertFalse($this->Session->read('SessionTestCase'));
|
||||
|
||||
$this->Session->write('SessionTestCase', null);
|
||||
$this->assertEqual($this->Session->read('SessionTestCase'), null);
|
||||
|
||||
$row = $db->query('DROP TABLE cake_session');
|
||||
}
|
||||
|
||||
function tearDown() {
|
||||
$this->Session->del('SessionTestCase');
|
||||
unset($this->Session);
|
||||
|
|
Loading…
Reference in a new issue