mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-30 22:18:46 +02:00
N°6934 - Symfony 6.4 - upgrade Symfony bundles to 6.4 (#580)
* Update Symfony lib to version ~6.4.0 * Update code missing return type * Add an iTop general configuration entry to store application secret (Symfony mandatory parameter) * Use dependency injection in ExceptionListener & UserProvider classes
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
|
||||
namespace Symfony\Component\VarDumper\Caster;
|
||||
|
||||
use Symfony\Component\ErrorHandler\Exception\FlattenException;
|
||||
use Symfony\Component\ErrorHandler\Exception\SilencedErrorContext;
|
||||
use Symfony\Component\VarDumper\Cloner\Stub;
|
||||
use Symfony\Component\VarDumper\Exception\ThrowingCasterException;
|
||||
@@ -24,9 +25,9 @@ use Symfony\Component\VarDumper\Exception\ThrowingCasterException;
|
||||
*/
|
||||
class ExceptionCaster
|
||||
{
|
||||
public static $srcContext = 1;
|
||||
public static $traceArgs = true;
|
||||
public static $errorTypes = [
|
||||
public static int $srcContext = 1;
|
||||
public static bool $traceArgs = true;
|
||||
public static array $errorTypes = [
|
||||
\E_DEPRECATED => 'E_DEPRECATED',
|
||||
\E_USER_DEPRECATED => 'E_USER_DEPRECATED',
|
||||
\E_RECOVERABLE_ERROR => 'E_RECOVERABLE_ERROR',
|
||||
@@ -44,18 +45,27 @@ class ExceptionCaster
|
||||
\E_STRICT => 'E_STRICT',
|
||||
];
|
||||
|
||||
private static $framesCache = [];
|
||||
private static array $framesCache = [];
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public static function castError(\Error $e, array $a, Stub $stub, bool $isNested, int $filter = 0)
|
||||
{
|
||||
return self::filterExceptionArray($stub->class, $a, "\0Error\0", $filter);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public static function castException(\Exception $e, array $a, Stub $stub, bool $isNested, int $filter = 0)
|
||||
{
|
||||
return self::filterExceptionArray($stub->class, $a, "\0Exception\0", $filter);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public static function castErrorException(\ErrorException $e, array $a, Stub $stub, bool $isNested)
|
||||
{
|
||||
if (isset($a[$s = Caster::PREFIX_PROTECTED.'severity'], self::$errorTypes[$a[$s]])) {
|
||||
@@ -65,6 +75,9 @@ class ExceptionCaster
|
||||
return $a;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public static function castThrowingCasterException(ThrowingCasterException $e, array $a, Stub $stub, bool $isNested)
|
||||
{
|
||||
$trace = Caster::PREFIX_VIRTUAL.'trace';
|
||||
@@ -83,6 +96,9 @@ class ExceptionCaster
|
||||
return $a;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public static function castSilencedErrorContext(SilencedErrorContext $e, array $a, Stub $stub, bool $isNested)
|
||||
{
|
||||
$sPrefix = "\0".SilencedErrorContext::class."\0";
|
||||
@@ -110,6 +126,9 @@ class ExceptionCaster
|
||||
return $a;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public static function castTraceStub(TraceStub $trace, array $a, Stub $stub, bool $isNested)
|
||||
{
|
||||
if (!$isNested) {
|
||||
@@ -184,6 +203,9 @@ class ExceptionCaster
|
||||
return $a;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public static function castFrameStub(FrameStub $frame, array $a, Stub $stub, bool $isNested)
|
||||
{
|
||||
if (!$isNested) {
|
||||
@@ -267,6 +289,19 @@ class ExceptionCaster
|
||||
return $a;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public static function castFlattenException(FlattenException $e, array $a, Stub $stub, bool $isNested)
|
||||
{
|
||||
if ($isNested) {
|
||||
$k = sprintf(Caster::PATTERN_PRIVATE, FlattenException::class, 'traceAsString');
|
||||
$a[$k] = new CutStub($a[$k]);
|
||||
}
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
private static function filterExceptionArray(string $xClass, array $a, string $xPrefix, int $filter): array
|
||||
{
|
||||
if (isset($a[$xPrefix.'trace'])) {
|
||||
@@ -285,12 +320,10 @@ class ExceptionCaster
|
||||
if (empty($a[$xPrefix.'previous'])) {
|
||||
unset($a[$xPrefix.'previous']);
|
||||
}
|
||||
unset($a[$xPrefix.'string'], $a[Caster::PREFIX_DYNAMIC.'xdebug_message'], $a[Caster::PREFIX_DYNAMIC.'__destructorException']);
|
||||
unset($a[$xPrefix.'string'], $a[Caster::PREFIX_DYNAMIC.'xdebug_message']);
|
||||
|
||||
if (isset($a[Caster::PREFIX_PROTECTED.'message']) && str_contains($a[Caster::PREFIX_PROTECTED.'message'], "@anonymous\0")) {
|
||||
$a[Caster::PREFIX_PROTECTED.'message'] = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)[0-9a-fA-F]++/', function ($m) {
|
||||
return class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class').'@anonymous' : $m[0];
|
||||
}, $a[Caster::PREFIX_PROTECTED.'message']);
|
||||
$a[Caster::PREFIX_PROTECTED.'message'] = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)[0-9a-fA-F]++/', fn ($m) => class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class').'@anonymous' : $m[0], $a[Caster::PREFIX_PROTECTED.'message']);
|
||||
}
|
||||
|
||||
if (isset($a[Caster::PREFIX_PROTECTED.'file'], $a[Caster::PREFIX_PROTECTED.'line'])) {
|
||||
@@ -337,7 +370,7 @@ class ExceptionCaster
|
||||
$stub->attr['file'] = $f;
|
||||
$stub->attr['line'] = $caller->getStartLine();
|
||||
}
|
||||
} catch (\ReflectionException $e) {
|
||||
} catch (\ReflectionException) {
|
||||
// ignore fake class/function
|
||||
}
|
||||
|
||||
@@ -352,9 +385,7 @@ class ExceptionCaster
|
||||
$pad = null;
|
||||
for ($i = $srcContext << 1; $i >= 0; --$i) {
|
||||
if (isset($src[$i][$ltrim]) && "\r" !== ($c = $src[$i][$ltrim]) && "\n" !== $c) {
|
||||
if (null === $pad) {
|
||||
$pad = $c;
|
||||
}
|
||||
$pad ??= $c;
|
||||
if ((' ' !== $c && "\t" !== $c) || $pad !== $c) {
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user