fix: compatibilidad PHP 7.4 — str_starts_with, str_contains, match, never, mixed

This commit is contained in:
Lizandro Guarnizo
2026-06-04 20:04:37 -05:00
parent 943e629120
commit 43f337ee34
5 changed files with 54 additions and 50 deletions
+2 -2
View File
@@ -19,7 +19,7 @@ class Auth
?? $_SERVER['REDIRECT_HTTP_AUTHORIZATION']
?? '';
if (!str_starts_with($header, 'Bearer ')) {
if (strpos($header, 'Bearer ') !== 0) {
self::abort(401, 'Token de autorización requerido.');
}
@@ -78,7 +78,7 @@ class Auth
return base64_decode(strtr($data, '-_', '+/'));
}
private static function abort(int $code, string $message): never
private static function abort(int $code, string $message): void
{
http_response_code($code);
header('Content-Type: application/json; charset=utf-8');