X-Git-Url: https://git.rapsys.eu/packbundle/blobdiff_plain/b29d46fa4a1cb6b6cae4274f5bd0f6aaafa27f04..2a4829218845b2db4b72835e101d27f067f3c5d8:/Util/SluggerUtil.php?ds=sidebyside diff --git a/Util/SluggerUtil.php b/Util/SluggerUtil.php index 5f7d76d..0ff32c5 100644 --- a/Util/SluggerUtil.php +++ b/Util/SluggerUtil.php @@ -46,7 +46,7 @@ class SluggerUtil { */ public function __construct(protected string $secret) { //Without range - if (empty($range = $_ENV['RAPSYSPACK_RANGE']) || $range === 'Ch4ng3m3!') { + if (!isset($_ENV['RAPSYSPACK_RANGE']) || empty($range = $_ENV['RAPSYSPACK_RANGE']) || $range === 'Ch4ng3m3!') { //Protect member variable setup return; } @@ -116,7 +116,7 @@ class SluggerUtil { //Return hashed data //XXX: we use hash_hmac with md5 hash //XXX: crypt was dropped because it provided identical signature for string starting with same pattern - return str_replace(['+','/'], ['-','_'], base64_encode(hash_hmac('md5', $data, $this->secret, true))); + return str_replace(['+','/','='], ['-','_',''], base64_encode(hash_hmac('md5', $data, $this->secret, true))); } /** @@ -162,7 +162,7 @@ class SluggerUtil { * Convert string to safe slug * * @param string $data The data string - * @param string $separator The separator string + * @param string $separator The separator string * @return ?string The slugged data */ function slug(?string $data, string $separator = '-'): ?string {