From 2d0c0dbcb68031a51283aa1e24e8ba06bc360e9a Mon Sep 17 00:00:00 2001 From: "Eloy Lafuente (stronk7)" Date: Mon, 27 Feb 2023 09:33:08 +0100 Subject: [PATCH] MDL-77417 behat: behat_error_handler meets deprecation error types Right now, any E_DEPRECATED, E_USER_DEPRECATED error type leads to exception in behat runs, because the behat error handled is not aware of them. See MDL-38041 for the initial implementation. We don't want that to happen and they must behave like other "low" error types (notices, warnings...), that will be reported in logs or output, but won't trigger any exception, so the test can continue. This commit just adds those 2 "new" error types to the handler, providing the very same behaviour for them than the rest. --- lib/behat/lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/behat/lib.php b/lib/behat/lib.php index 53ea59da0fb..ccf2ebd159f 100644 --- a/lib/behat/lib.php +++ b/lib/behat/lib.php @@ -137,7 +137,7 @@ function behat_error_handler($errno, $errstr, $errfile, $errline) { // set to DEVELOPER and will always include E_NOTICE,E_USER_NOTICE... as part of E_ALL, if the current // error_reporting() value does not include one of those levels is because it has been forced through // the moodle code (see fix_utf8() for example) in that cases we respect the forced error level value. - $respect = array(E_NOTICE, E_USER_NOTICE, E_STRICT, E_WARNING, E_USER_WARNING); + $respect = array(E_NOTICE, E_USER_NOTICE, E_STRICT, E_WARNING, E_USER_WARNING, E_DEPRECATED, E_USER_DEPRECATED); foreach ($respect as $respectable) { // If the current value does not include this kind of errors and the reported error is