'PHP throwing E_DEPRECATED even though disabled via error_reporting

I recently upgraded to PHP 8.1 and did my best to fix instances of where NULL was being passed to built-in functions such as trim() or strtolower(). As expected, I missed some. However, it seems that the exceptions thrown by this in PHP are not E_DEPRECATED. I can't find what type of exception is documented to be thrown exactly. The migration guide just says the below and the comment in the code makes me think it would throw E_DEPRECATED.

Scalar types for built-in functions are nullable by default, this behaviour is deprecated to align with the behaviour of user-defined functions, where scalar types need to be marked as nullable explicitly.

I have error_reporting in my php.ini set to E_ALL & ~E_DEPRECATED & ~E_STRICT and yet I am still getting exceptions thrown. I log the text of the exception in our database and it sure looks like a deprecation message. Does anyone know what type of error is thrown exactly?

I have an error handler defined but am not passing anything in the second parameter for the error levels. Maybe I am misunderstanding how set_error_handler works in conjunction with error_reporting?

php


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source