0

Please help, this warning only happened when I use moblie device check my blog website, and PHP version is 8, the warning code is:

function is_webp():bool{
    return (isset($_COOKIE["su_webp"]) || strpos($_SERVER['HTTP_ACCEPT'], 'image/webp'));
}
  • https://www.php.net/manual/en/reserved.variables.server.php shows what can be available in $_SERVER..the one you've used isn't listed. – ADyson Jun 14 '21 at 11:36
  • You should code for something like that not being set. `$_SERVER['HTTP_ACCEPT'] ?? null` – Nigel Ren Jun 14 '21 at 11:39
  • Thanks, I am new in PHP, and I am not sure whether this function necessary – EvaristeXu Jun 14 '21 at 11:40
  • The idea of the function seems to be to check whether the client will accept data in webp format. It's up to you whether you think that's necessary, in the context of your application and the request that this code is trying to process. – ADyson Jun 14 '21 at 12:37

0 Answers0