Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Sets which PHP errors are reported
<?php error_reporting(?int $error_level = null): int
<?php static::$app = $app;
error_reporting(-1);
set_error_handler($this->forwardsTo('handleError'));
<?php {
if ($this->isDeprecation($level)) {
$this->handleDeprecationError($message, $file, $line, $level);
} elseif (error_reporting() & $level) {
throw new ErrorException($message, 0, $level, $file, $line);
}
}
<?php {
if ($this->originalDeprecationHandler == null) {
$this->originalDeprecationHandler = set_error_handler(function ($level, $message, $file = '', $line = 0) {
if (in_array($level, [E_DEPRECATED, E_USER_DEPRECATED]) || (error_reporting() & $level)) {
throw new ErrorException($message, 0, $level, $file, $line);
}
});
<?php <?php
error_reporting(E_ALL);
test('deprecated', function () {
str_contains(null, null);
<?php public static function handle($level, $message, $file, $line)
{
if (!(error_reporting() & $level)) {
return true;
}
<?php public static function register(IOInterface $io = null)
{
set_error_handler(array(__CLASS__, 'handle'));
error_reporting(E_ALL | E_STRICT);
self::$io = $io;
}
}
<?php if (!isset($mask)) {
$mask = E_WARNING | E_NOTICE | E_USER_WARNING | E_USER_NOTICE | E_DEPRECATED | E_USER_DEPRECATED | E_STRICT;
}
$old = error_reporting();
self::$stack[] = $old;
error_reporting($old & ~$mask);
<?php }
$old = error_reporting();
self::$stack[] = $old;
error_reporting($old & ~$mask);
return $old;
}
<?php public static function restore()
{
if (!empty(self::$stack)) {
error_reporting(array_pop(self::$stack));
}
}
<?php use Composer\Util\Platform;
error_reporting(E_ALL);
if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) {
date_default_timezone_set(@date_default_timezone_get());
<?php public function testSilencer()
{
$before = error_reporting();
Silencer::suppress();
<?php $this->assertEquals(24, $result);
$this->assertEquals($before, error_reporting());
}
<?php public function register(): self
{
error_reporting(-1);
set_error_handler([$this, 'renderError']);
<?php use Bref\Runtime\LambdaRuntime;
ini_set('display_errors', '1');
error_reporting(E_ALL);
$appRoot = getenv('LAMBDA_TASK_ROOT');
<?php ini_set('display_errors', '1');
error_reporting(E_ALL);
$requestId = '8f507cfc-example-4697-b07a-ac58fc914c95';
$startTime = $this->logStart($io, $requestId);