Closed adamoki closed 4 years ago
We definitely need a unit test for this before we can merge. The unit test should fail under current master, and pass after the patch is applied.
I tend to agree with @webimpress - we should be casting hashes to strings when calling setHash()
and/or in the constructor.
@weierophinney I've pushed changes to this branch. I am checking now if input hash is string, and if not I am throwing an exception. We do have that check when we provide just a hash, without algorithm, but with algorithm we haven't had this check. Please see test I've added.
@adamoki Are you satisfied with the solution I've provided?
Thanks, @adamoki!
Sometimes there is a problem with validation - when generated hash is valid integer (includes only digits - it rarely happens) - php converts that string to integer - then you get integer in array of hashes ($hashes). Comparing that integer to returned string from hash_file function results in false value while hash is the same but differs in variable type.