Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0c20a5a

Browse files
committed
[Security] fixed interface implementation (closes #6974)
1 parent 9367a7c commit 0c20a5a

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/Symfony/Component/Security/Core/Encoder/BCryptPasswordEncoder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function __construct(SecureRandomInterface $secureRandom, $cost)
5858
/**
5959
* {@inheritdoc}
6060
*/
61-
public function encodePassword($raw, $salt = null)
61+
public function encodePassword($raw, $salt)
6262
{
6363
if (function_exists('password_hash')) {
6464
return password_hash($raw, PASSWORD_BCRYPT, array('cost' => $this->cost));
@@ -76,7 +76,7 @@ public function encodePassword($raw, $salt = null)
7676
/**
7777
* {@inheritdoc}
7878
*/
79-
public function isPasswordValid($encoded, $raw, $salt = null)
79+
public function isPasswordValid($encoded, $raw, $salt)
8080
{
8181
if (function_exists('password_verify')) {
8282
return password_verify($raw, $encoded);

src/Symfony/Component/Security/Tests/Core/Encoder/BCryptPasswordEncoderTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,16 @@ public function testCostInRange()
6666
public function testResultLength()
6767
{
6868
$encoder = new BCryptPasswordEncoder($this->secureRandom, self::VALID_COST);
69-
$result = $encoder->encodePassword(self::PASSWORD);
69+
$result = $encoder->encodePassword(self::PASSWORD, null);
7070
$this->assertEquals(60, strlen($result));
7171
}
7272

7373
public function testValidation()
7474
{
7575
$encoder = new BCryptPasswordEncoder($this->secureRandom, self::VALID_COST);
76-
$result = $encoder->encodePassword(self::PASSWORD);
77-
$this->assertTrue($encoder->isPasswordValid($result, self::PASSWORD));
78-
$this->assertFalse($encoder->isPasswordValid($result, 'anotherPassword'));
76+
$result = $encoder->encodePassword(self::PASSWORD, null);
77+
$this->assertTrue($encoder->isPasswordValid($result, self::PASSWORD, null));
78+
$this->assertFalse($encoder->isPasswordValid($result, 'anotherPassword', null));
7979
}
8080

8181
public function testValidationKnownPassword()
@@ -85,7 +85,7 @@ public function testValidationKnownPassword()
8585
? '2y' : '2a').'$';
8686

8787
$encrypted = $prefix.'04$ABCDEFGHIJKLMNOPQRSTU.uTmwd4KMSHxbUsG7bng8x7YdA0PM1iq';
88-
$this->assertTrue($encoder->isPasswordValid($encrypted, self::PASSWORD));
88+
$this->assertTrue($encoder->isPasswordValid($encrypted, self::PASSWORD, null));
8989
}
9090

9191
public function testSecureRandomIsUsed()
@@ -100,7 +100,7 @@ public function testSecureRandomIsUsed()
100100
;
101101

102102
$encoder = new BCryptPasswordEncoder($this->secureRandom, self::VALID_COST);
103-
$result = $encoder->encodePassword(self::PASSWORD);
103+
$result = $encoder->encodePassword(self::PASSWORD, null);
104104

105105
$prefix = '$'.(version_compare(phpversion(), '5.3.7', '>=')
106106
? '2y' : '2a').'$';

0 commit comments

Comments
 (0)