Skip to content

Commit

Permalink
fix: set the maximum allowable value for URI - 36 characters
Browse files Browse the repository at this point in the history
  • Loading branch information
shpran committed Feb 22, 2024
1 parent 50b0b1b commit 7473e72
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions core/kernel/uri/Bin2HexUriProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ class Bin2HexUriProvider extends ConfigurableService implements UriProvider
*/
public function provide()
{
return $this->getOption(self::OPTION_NAMESPACE) . uniqid('i') . getmypid()
. bin2hex(openssl_random_pseudo_bytes(8));
$uniqIdAndPid = uniqid('i') . getmypid();
$bytesLength = floor((36 - strlen($uniqIdAndPid)) / 2);

return $this->getOption(self::OPTION_NAMESPACE) . $uniqIdAndPid
. bin2hex(openssl_random_pseudo_bytes($bytesLength));
}
}

0 comments on commit 7473e72

Please sign in to comment.