mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 02:28:44 +02:00
Revert "N°3002 Add trigger_error to catch deprecated notices inside DeprecatedCallsLog"
This reverts commit d247ea915d.
Will solve CI build errors... I will work in my own branch to tweak this !
This commit is contained in:
@@ -837,43 +837,12 @@ class DeprecatedCallsLog extends LogAPI
|
||||
/** @var \FileLog we want our own instance ! */
|
||||
protected static $m_oFileLog = null;
|
||||
|
||||
/**
|
||||
* @param string|null $sTargetFile
|
||||
*
|
||||
* @throws \ConfigException
|
||||
*
|
||||
* @uses \set_error_handler() to catch deprecated notices
|
||||
*
|
||||
* @since 3.0.0-beta4 N°3002 logs deprecated notices in called code
|
||||
*/
|
||||
public static function Enable($sTargetFile = null): void
|
||||
{
|
||||
if (empty($sTargetFile)) {
|
||||
$sTargetFile = APPROOT.'log/deprecated-calls.log';
|
||||
}
|
||||
parent::Enable($sTargetFile);
|
||||
|
||||
if (static::IsLogLevelEnabled(self::LEVEL_WARNING, self::ENUM_CHANNEL_PHP_METHOD)) {
|
||||
set_error_handler([static::class, 'DeprecatedNoticesErrorHandler']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 3.0.0-beta4 N°3002
|
||||
* @noinspection SpellCheckingInspection
|
||||
*/
|
||||
public static function DeprecatedNoticesErrorHandler(int $errno, string $errstr, string $errfile, int $errline): bool
|
||||
{
|
||||
if ((\E_USER_DEPRECATED !== $errno)
|
||||
&& (\E_DEPRECATED !== $errno)
|
||||
&& (\E_WARNING !== $errno || false === strpos($errstr, '" targeting switch is equivalent to "break')) // for @trigger_error() calls !
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static::NotifyDeprecatedPhpMethod('catched by DeprecatedNoticesErrorHandler');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected static function GetLevelDefault(): string
|
||||
|
||||
Reference in New Issue
Block a user