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

Drop or upgrade Laminas\Math #132

Closed
gsteel opened this issue Jun 14, 2022 · 1 comment · Fixed by #133
Closed

Drop or upgrade Laminas\Math #132

gsteel opened this issue Jun 14, 2022 · 1 comment · Fixed by #133

Comments

@gsteel
Copy link
Member

gsteel commented Jun 14, 2022

Feature Request

Q A
New Feature yes

Summary

Validator is stuck on Laminas\Math 2.x. It only uses it for random bytes in the CSRF validator and using v2 drags in laminas/laminas-zendframework-bridge.

Since PHP ^7 comes with random_bytes, it should be possible to drop math altogether, or alternatively upgrade to 3.x

protected function generateHash()
{
$token = md5($this->getSalt() . Rand::getBytes(32) . $this->getName());
$this->hash = $this->formatHash($token, $this->generateTokenId());
$this->setValue($this->hash);
$this->initCsrfToken();
}
/**
* @return string
*/
protected function generateTokenId()
{
return md5(Rand::getBytes(32));
}

@Ocramius
Copy link
Member

We can use random_bytes() indeed 👍

Rand::getBytes() was only relevant in a pre-php7 era. /cc @ezimuel if you want to confirm that :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants