Passing E_USER_ERROR to trigger_error() is deprecated since 8.4, throw an exception or call exit with a string message instead

Description

The error level E_USER_ERROR is deprecated since PHP 8.4. It should be replaced with a thrown exceptions. The other levels, E_USER_NOTICE and E_USER_WARNING are still available.

Example

<?php

trigger_error('message', E_USER_ERROR);

?>

Solutions

  • Throw an execption.