Skip to content

Kirby 5.0.4

Helpers::handleErrors()

Performs an action with custom handling for all PHP errors and warnings

Helpers::handleErrors(Closure $action, Closure $condition, mixed $fallback = null): mixed

Parameters

Name Type Default Description
$actionrequired Closure no default value Any action that may cause an error or warning
$conditionrequired Closure no default value Closure that returns bool to determine if to
suppress an error, receives arguments for
set_error_handler()
$fallback mixed null Value to return when error is suppressed

Return type

mixed

Return value of the `$action` closure, possibly overridden by `$fallback`

Parent class

Kirby\Cms\Helpers