I'm trying to throw an exception inside a try ... catch block but for some reason I get an error Fatal error: Uncaught Exception. A handler is assigned, but why doesn't it fire?
try {
if (!isset($_SESSION["Authorized"])){
throw new Exception();
}
} catch (Exception $e){
die('No access');
}
Clarification, I was surprised to find that the error only occurs when debugging Visual Studio code using Xdebug. If debug mode is off, no error occurs. Why so?
if (!isset($_SESSION[...])) { die('No access'); }.