Undefined Variable since PHP 8.0

yes.

just to be clear, trying to access an undefined variable was also “wrong” in PHP 7, it generated an error message at the “NOTICE” level. In PHP 8 it now generates a “WARNING”; also the default error reporting level in PHP 8 has been set to “E_ALL”, while, before, by default it wouldn’t show "NOTICE"s.

Anyway, I guess you can choose between always setting a variable before using it (The Right Way™), or just provide a fallback value via the null coalescing operator when accessing the variable:

<?php
if($os ?? null) {
  //stuff
}
?>

<?= $os ?? null ?>