Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Algorithm passed to Hash is only used if algorithm key is provided before hash key #398

Closed
InvisibleSmiley opened this issue Nov 11, 2024 · 2 comments · Fixed by #399
Closed
Assignees
Labels
Bug Something isn't working
Milestone

Comments

@InvisibleSmiley
Copy link

Bug Report

Q A
Version(s) 2.x

Summary

The order of option keys determines whether the given algorithm is used.

Current behavior

If the algorithm key is passed after the hash key, the algorithm is silently set to crc32 (default).

How to reproduce

// works
new Hash(['algorithm' => 'sha1', 'hash' => 'foo']);
// fails
new Hash(['hash' => 'foo', 'algorithm' => 'sha1']);

Expected behavior

Order of keys in options array is irrelevant.

@gsteel
Copy link
Member

gsteel commented Nov 25, 2024

FWIW, it's gonna be a while before adoption of validator 3.0 gets any traction, so a fix for this in 2.x will get merged and released if you can provide it 👍

@gsteel
Copy link
Member

gsteel commented Nov 26, 2024

Fixed in #399

@gsteel gsteel closed this as completed Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
2 participants