freebsd-ports/devel/arcanist-lib/files/patch-src_error_PhutilErrorHandler.php
Michael Gmelin be146a923d devel/arcanist-lib: Suppress certain runtime exceptions
Default configured PHP 8.1+ issues deprecation errors when NULL
strings are passed into various library functions.

In the past, we tried to address those one by one, which feels
a bit like playing Whac-A-Mole.

This patch adds custom error handling for this kind of deprecation
error, so that it is ignored. This should fix this entire class of
errors at least until PHP 9.0 is released, at which point a different
workaround (or real solution is needed). Therefore previous patches
were removed.
2023-01-31 19:51:50 +01:00

14 lines
581 B
PHP

--- src/error/PhutilErrorHandler.php.orig 2022-05-17 23:20:14 UTC
+++ src/error/PhutilErrorHandler.php
@@ -181,6 +181,11 @@ final class PhutilErrorHandler extends Phobject {
* @task internal
*/
public static function handleError($num, $str, $file, $line, $ctx = null) {
+ // work around PHP 8.1+ null argument deprecation error
+ if ($num === E_DEPRECATED && preg_match('/Passing null to parameter #.* of type .* is deprecated/', $str)) {
+ return true;
+ }
+
foreach (self::$traps as $trap) {
$trap->addError($num, $str, $file, $line);
}