Skip to content

Commit

Permalink
Make mbstring ext is optional and replace with symfony polyfill
Browse files Browse the repository at this point in the history
  • Loading branch information
vtsykun committed Dec 2, 2023
1 parent 6b99e1a commit 96e6321
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Mirror/Model/GZipTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ protected function decode(string $gzip): string
*/
protected function isGzip(string $gzip): bool
{
if (\mb_strpos($gzip, "\x1f"."\x8b"."\x08") === 0) {
if (str_starts_with($gzip, "\x1f" . "\x8b" . "\x08")) {
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Twig/PackagistExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public function truncate($string, $length)
return "";
}

return mb_strlen($string) > $length ? mb_substr($string, 0, $length) . '...' : $string;
return strlen($string) > $length ? substr($string, 0, $length) . '...' : $string;
}

public function numericTest($val)
Expand Down
2 changes: 1 addition & 1 deletion src/Webhook/HmacOpensslCrypter.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function encryptData(string $data): ?string
private function removeHmac(string $data): array
{
$data = base64_decode($data);
$hashLength = mb_strlen(hash($this->hmacAlgo, $data, true), '8bit');
$hashLength = strlen(hash($this->hmacAlgo, $data, true));

$hmac = substr($data, 0, $hashLength);
$data = substr($data, $hashLength);
Expand Down
2 changes: 1 addition & 1 deletion src/Webhook/HookRequestExecutor.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ private function hideSensitiveRequest(HookRequest $request, mixed $secrets = nul
$opts = $this->hideSensitiveParameters(null, $request->jsonSerialize(), $secrets)[1];
if (is_array($headers = $opts['options']['headers'] ?? null)) {
foreach ($headers as $name => $value) {
if (str_contains(mb_strtolower($name), 'authorization')) {
if (str_contains(strtolower($name), 'authorization')) {
$headers[$name] = '***';
}
}
Expand Down

0 comments on commit 96e6321

Please sign in to comment.