Skip to content

Commit 92fd7cf

Browse files
author
gwoo
committed
Merge branch 'local/svn/1.2.x.x' into 1.2
2 parents 40ff837 + d41a28c commit 92fd7cf

File tree

5 files changed

+43
-5
lines changed

5 files changed

+43
-5
lines changed

cake/basics.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,7 @@ function array_diff_key() {
810810

811811
foreach ($args[0] as $valueKey => $valueData) {
812812
for ($i = 1; $i < $argc; $i++) {
813-
if (isset($args[$i][$valueKey])) {
813+
if (array_key_exists($valueKey, $args[$i])) {
814814
continue 2;
815815
}
816816
}

cake/libs/controller/components/security.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ function loginRequest($options = array()) {
323323

324324
if (strtolower($options['type']) == 'digest') {
325325
$out[] = 'qop="auth"';
326-
$out[] = 'nonce="' . uniqid() . '"';
326+
$out[] = 'nonce="' . uniqid("") . '"';
327327
$out[] = 'opaque="' . md5($options['realm']).'"';
328328
}
329329

cake/tests/cases/basics.test.php

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,36 @@ function tearDown() {
5454
Configure::write('localePaths', $this->_localePaths);
5555
Configure::write('Config.language', $this->_language);
5656
}
57+
/**
58+
* test the array_diff_key compatibility function.
59+
*
60+
* @return void
61+
**/
62+
function testArrayDiffKey() {
63+
$one = array('one' => 1, 'two' => 2, 'three' => 3);
64+
$two = array('one' => 'one', 'two' => 'two');
65+
$result = array_diff_key($one, $two);
66+
$expected = array('three' => 3);
67+
$this->assertEqual($result, $expected);
68+
69+
$one = array('one' => array('value', 'value-two'), 'two' => 2, 'three' => 3);
70+
$two = array('two' => 'two');
71+
$result = array_diff_key($one, $two);
72+
$expected = array('one' => array('value', 'value-two'), 'three' => 3);
73+
$this->assertEqual($result, $expected);
74+
75+
$one = array('one' => null, 'two' => 2, 'three' => '', 'four' => 0);
76+
$two = array('two' => 'two');
77+
$result = array_diff_key($one, $two);
78+
$expected = array('one' => null, 'three' => '', 'four' => 0);
79+
$this->assertEqual($result, $expected);
80+
81+
$one = array('minYear' => null, 'maxYear' => null, 'separator' => '-', 'interval' => 1, 'monthNames' => true);
82+
$two = array('minYear' => null, 'maxYear' => null, 'separator' => '-', 'interval' => 1, 'monthNames' => true);
83+
$result = array_diff_key($one, $two);
84+
$this->assertEqual($result, array());
85+
86+
}
5787
/**
5888
* testHttpBase method
5989
*
@@ -110,10 +140,10 @@ function testEnv() {
110140

111141
$_SERVER['HTTPS'] = 'off';
112142
$this->assertFalse(env('HTTPS'));
113-
143+
114144
$_SERVER['HTTPS'] = false;
115145
$this->assertFalse(env('HTTPS'));
116-
146+
117147
$_SERVER['HTTPS'] = '';
118148
$this->assertFalse(env('HTTPS'));
119149

cake/tests/cases/libs/controller/components/security.test.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,14 @@ function testRequireLogin() {
363363
* @return void
364364
*/
365365
function testDigestAuth() {
366+
$skip = $this->skipIf((version_compare(PHP_VERSION, '5.1') == -1) XOR (!function_exists('apache_request_headers')),
367+
"%s Cannot run Digest Auth test for PHP versions < 5.1"
368+
);
369+
370+
if ($skip) {
371+
return;
372+
}
373+
366374
$this->Controller->action = 'posted';
367375
$_SERVER['PHP_AUTH_DIGEST'] = $digest = <<<DIGEST
368376
Digest username="Mufasa",

cake/tests/cases/libs/view/helpers/paginator.test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ function testSortDir() {
291291

292292
$this->assertEqual($result, $expected);
293293

294-
unset($this->paginator->params['paging']['article']['options']);
294+
unset($this->Paginator->params['paging']['Article']['options']);
295295
$this->Paginator->params['paging']['Article']['options']['direction'] = 'desc';
296296
$result = $this->Paginator->sortDir();
297297
$expected = 'desc';

0 commit comments

Comments
 (0)