Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change hash_hmac to accept all types for the second argument and automatically cast it to a string before hashing, as Zend does Closes #1822 Reviewed By: @fredemmott Differential Revision: D1178261 Pulled By: @scannell
- Loading branch information
Showing
3 changed files
with
14 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
$key = "c0793dfd477a2ff11b7cd5636594a76b518f3a6df8fb450d90ac52457833604e"; | ||
class Stringy { | ||
public function __toString() { return "hello"; } | ||
} | ||
$hello_hash = hash_hmac("sha256", "hello", $key, false); | ||
$one_hash = hash_hmac("sha256", "1", $key, false); | ||
var_dump( $hello_hash === hash_hmac("sha256", new Stringy(), $key, false) ); | ||
var_dump( $one_hash === hash_hmac("sha256", 1, $key, false) ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
bool(true) | ||
bool(true) |