diff --git a/cake/libs/controller/components/security.php b/cake/libs/controller/components/security.php index 077883c3b..96d140256 100644 --- a/cake/libs/controller/components/security.php +++ b/cake/libs/controller/components/security.php @@ -323,7 +323,7 @@ class SecurityComponent extends Object { if (strtolower($options['type']) == 'digest') { $out[] = 'qop="auth"'; - $out[] = 'nonce="' . uniqid() . '"'; + $out[] = 'nonce="' . uniqid("") . '"'; $out[] = 'opaque="' . md5($options['realm']).'"'; } diff --git a/cake/tests/cases/libs/controller/components/security.test.php b/cake/tests/cases/libs/controller/components/security.test.php index 0ef3dc24c..f744f2dce 100644 --- a/cake/tests/cases/libs/controller/components/security.test.php +++ b/cake/tests/cases/libs/controller/components/security.test.php @@ -363,6 +363,14 @@ class SecurityComponentTest extends CakeTestCase { * @return void */ 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'; $_SERVER['PHP_AUTH_DIGEST'] = $digest = <<