Skip to content

Commit

Permalink
Fixing PHP4 compatibility issues for SecurityComponent.
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@8282 3807eeeb-6ff5-0310-8944-8be069107fe0
  • Loading branch information
jperras committed Aug 3, 2009
1 parent 72d90f2 commit d41a28c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cake/libs/controller/components/security.php
Expand Up @@ -323,7 +323,7 @@ function loginRequest($options = array()) {


if (strtolower($options['type']) == 'digest') { if (strtolower($options['type']) == 'digest') {
$out[] = 'qop="auth"'; $out[] = 'qop="auth"';
$out[] = 'nonce="' . uniqid() . '"'; $out[] = 'nonce="' . uniqid("") . '"';
$out[] = 'opaque="' . md5($options['realm']).'"'; $out[] = 'opaque="' . md5($options['realm']).'"';
} }


Expand Down
8 changes: 8 additions & 0 deletions cake/tests/cases/libs/controller/components/security.test.php
Expand Up @@ -363,6 +363,14 @@ function testRequireLogin() {
* @return void * @return void
*/ */
function testDigestAuth() { function testDigestAuth() {
$skip = $this->skipIf((version_compare(PHP_VERSION, '5.1') == -1) XOR (!function_exists('apache_request_headers')),
"%s Cannot run Digest Auth test for PHP versions < 5.1"
);

if ($skip) {
return;
}

$this->Controller->action = 'posted'; $this->Controller->action = 'posted';
$_SERVER['PHP_AUTH_DIGEST'] = $digest = <<<DIGEST $_SERVER['PHP_AUTH_DIGEST'] = $digest = <<<DIGEST
Digest username="Mufasa", Digest username="Mufasa",
Expand Down

0 comments on commit d41a28c

Please sign in to comment.