1.2.78. Avoid set_error_handler $context Argument

Avoid configuring set_error_handler() with a method that accepts 5 arguments. The last argument, $errcontext, is deprecated since PHP 7.2, and will be removed later.

<?php

// setting error_handler with an incorrect closure
set_error_handler(function($errno, $errstr, $errfile, $errline) {});

// setting error_handler with an incorrect closure
set_error_handler(function($errno, $errstr, $errfile, $errline, $errcontext) {});

?>

See also set_error_handler().

1.2.78.1. Connex PHP features

1.2.78.1.1. Suggestions

  • Remove the 6th argument of registered handlers.

1.2.78.1.2. Specs

Short name

Php/AvoidSetErrorHandlerContextArg

Rulesets

All, Changed Behavior, CompatibilityPHP72

Exakat since

1.0.4

PHP Version

All

Severity

Major

Time To Fix

Slow (1 hour)

Precision

High

Examples

shopware, Vanilla

Available in

Entreprise Edition, Exakat Cloud