⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.144
Server IP:
157.245.143.252
Server:
Linux www 6.11.0-9-generic #9-Ubuntu SMP PREEMPT_DYNAMIC Mon Oct 14 13:19:59 UTC 2024 x86_64
Server Software:
nginx/1.26.0
PHP Version:
8.3.11
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
php
/
Composer
/
Util
/
View File Name :
ErrorHandler.php
* Jordi Boggiano
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Composer\Util; use Composer\IO\IOInterface; /** * Convert PHP errors into exceptions * * @author Artem Lopata
*/ class ErrorHandler { /** @var ?IOInterface */ private static $io; /** * Error handler * * @param int $level Level of the error raised * @param string $message Error message * @param string $file Filename that the error was raised in * @param int $line Line number the error was raised at * * @static * @throws \ErrorException */ public static function handle(int $level, string $message, string $file, int $line): bool { $isDeprecationNotice = $level === E_DEPRECATED || $level === E_USER_DEPRECATED; // error code is not included in error_reporting if (!$isDeprecationNotice && !(error_reporting() & $level)) { return true; } if (filter_var(ini_get('xdebug.scream'), FILTER_VALIDATE_BOOLEAN)) { $message .= "\n\nWarning: You have xdebug.scream enabled, the warning above may be". "\na legitimately suppressed error that you were not supposed to see."; } if (!$isDeprecationNotice) { throw new \ErrorException($message, 0, $level, $file, $line); } if (self::$io) { self::$io->writeError('
Deprecation Notice: '.$message.' in '.$file.':'.$line.'
'); if (self::$io->isVerbose()) { self::$io->writeError('
Stack trace:
'); self::$io->writeError(array_filter(array_map(static function ($a): ?string { if (isset($a['line'], $a['file'])) { return '
'.$a['file'].':'.$a['line'].'
'; } return null; }, array_slice(debug_backtrace(), 2)), function (?string $line) { return $line !== null; })); } } return true; } /** * Register error handler. */ public static function register(?IOInterface $io = null): void { set_error_handler([__CLASS__, 'handle']); error_reporting(E_ALL | E_STRICT); self::$io = $io; } }