[Web] update directorytree/ldaprecord

This commit is contained in:
FreddleSpl0it
2024-02-20 10:30:11 +01:00
parent 40146839ef
commit d479d18507
481 changed files with 13919 additions and 6171 deletions
@@ -28,6 +28,7 @@ abstract class AbstractCloner implements ClonerInterface
'Symfony\Component\VarDumper\Caster\CutArrayStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castCutArray'],
'Symfony\Component\VarDumper\Caster\ConstStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castStub'],
'Symfony\Component\VarDumper\Caster\EnumStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castEnum'],
'Symfony\Component\VarDumper\Caster\ScalarStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castScalar'],
'Fiber' => ['Symfony\Component\VarDumper\Caster\FiberCaster', 'castFiber'],
@@ -66,9 +67,6 @@ abstract class AbstractCloner implements ClonerInterface
'DOMAttr' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castAttr'],
'DOMElement' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castElement'],
'DOMText' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castText'],
'DOMTypeinfo' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castTypeinfo'],
'DOMDomError' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDomError'],
'DOMLocator' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castLocator'],
'DOMDocumentType' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDocumentType'],
'DOMNotation' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castNotation'],
'DOMEntity' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castEntity'],
@@ -92,10 +90,12 @@ abstract class AbstractCloner implements ClonerInterface
'Symfony\Component\HttpFoundation\Request' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castRequest'],
'Symfony\Component\Uid\Ulid' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castUlid'],
'Symfony\Component\Uid\Uuid' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castUuid'],
'Symfony\Component\VarExporter\Internal\LazyObjectState' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castLazyObjectState'],
'Symfony\Component\VarDumper\Exception\ThrowingCasterException' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castThrowingCasterException'],
'Symfony\Component\VarDumper\Caster\TraceStub' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castTraceStub'],
'Symfony\Component\VarDumper\Caster\FrameStub' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castFrameStub'],
'Symfony\Component\VarDumper\Cloner\AbstractCloner' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
'Symfony\Component\ErrorHandler\Exception\FlattenException' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castFlattenException'],
'Symfony\Component\ErrorHandler\Exception\SilencedErrorContext' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castSilencedErrorContext'],
'Imagine\Image\ImageInterface' => ['Symfony\Component\VarDumper\Caster\ImagineCaster', 'castImage'],
@@ -127,9 +127,11 @@ abstract class AbstractCloner implements ClonerInterface
'SplObjectStorage' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castObjectStorage'],
'SplPriorityQueue' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castHeap'],
'OuterIterator' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castOuterIterator'],
'WeakMap' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castWeakMap'],
'WeakReference' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castWeakReference'],
'Redis' => ['Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedis'],
'Relay\Relay' => ['Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedis'],
'RedisArray' => ['Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedisArray'],
'RedisCluster' => ['Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedisCluster'],
@@ -163,7 +165,6 @@ abstract class AbstractCloner implements ClonerInterface
'GdImage' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castGd'],
':gd' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castGd'],
':mysql link' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castMysqlLink'],
':pgsql large object' => ['Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castLargeObject'],
':pgsql link' => ['Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castLink'],
':pgsql link persistent' => ['Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castLink'],
@@ -191,6 +192,9 @@ abstract class AbstractCloner implements ClonerInterface
'RdKafka\Topic' => ['Symfony\Component\VarDumper\Caster\RdKafkaCaster', 'castTopic'],
'RdKafka\TopicPartition' => ['Symfony\Component\VarDumper\Caster\RdKafkaCaster', 'castTopicPartition'],
'RdKafka\TopicConf' => ['Symfony\Component\VarDumper\Caster\RdKafkaCaster', 'castTopicConf'],
'FFI\CData' => ['Symfony\Component\VarDumper\Caster\FFICaster', 'castCTypeOrCData'],
'FFI\CType' => ['Symfony\Component\VarDumper\Caster\FFICaster', 'castCTypeOrCData'],
];
protected $maxItems = 2500;
@@ -215,12 +219,9 @@ abstract class AbstractCloner implements ClonerInterface
*
* @see addCasters
*/
public function __construct(array $casters = null)
public function __construct(?array $casters = null)
{
if (null === $casters) {
$casters = static::$defaultCasters;
}
$this->addCasters($casters);
$this->addCasters($casters ?? static::$defaultCasters);
}
/**
@@ -232,6 +233,8 @@ abstract class AbstractCloner implements ClonerInterface
* see e.g. static::$defaultCasters.
*
* @param callable[] $casters A map of casters
*
* @return void
*/
public function addCasters(array $casters)
{
@@ -242,6 +245,8 @@ abstract class AbstractCloner implements ClonerInterface
/**
* Sets the maximum number of items to clone past the minimum depth in nested structures.
*
* @return void
*/
public function setMaxItems(int $maxItems)
{
@@ -250,6 +255,8 @@ abstract class AbstractCloner implements ClonerInterface
/**
* Sets the maximum cloned length for strings.
*
* @return void
*/
public function setMaxString(int $maxString)
{
@@ -259,6 +266,8 @@ abstract class AbstractCloner implements ClonerInterface
/**
* Sets the minimum tree depth where we are guaranteed to clone all the items. After this
* depth is reached, only setMaxItems items will be cloned.
*
* @return void
*/
public function setMinDepth(int $minDepth)
{
+23 -11
View File
@@ -17,7 +17,7 @@ use Symfony\Component\VarDumper\Dumper\ContextProvider\SourceContextProvider;
/**
* @author Nicolas Grekas <p@tchwork.com>
*/
class Data implements \ArrayAccess, \Countable, \IteratorAggregate
class Data implements \ArrayAccess, \Countable, \IteratorAggregate, \Stringable
{
private array $data;
private int $position = 0;
@@ -121,6 +121,9 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
yield from $value;
}
/**
* @return mixed
*/
public function __get(string $key)
{
if (null !== $data = $this->seek($key)) {
@@ -211,6 +214,11 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
return $data;
}
public function getContext(): array
{
return $this->context;
}
/**
* Seeks to a specific key in nested data structures.
*/
@@ -257,21 +265,21 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
/**
* Dumps data with a DumperInterface dumper.
*
* @return void
*/
public function dump(DumperInterface $dumper)
{
$refs = [0];
$cursor = new Cursor();
$cursor->hashType = -1;
$cursor->attr = $this->context[SourceContextProvider::class] ?? [];
$label = $this->context['label'] ?? '';
if ($cursor->attr = $this->context[SourceContextProvider::class] ?? []) {
$cursor->attr['if_links'] = true;
$cursor->hashType = -1;
$dumper->dumpScalar($cursor, 'default', '^');
$cursor->attr = ['if_links' => true];
$dumper->dumpScalar($cursor, 'default', ' ');
$cursor->hashType = 0;
if ($cursor->attr || '' !== $label) {
$dumper->dumpScalar($cursor, 'label', $label);
}
$cursor->hashType = 0;
$this->dumpItem($dumper, $cursor, $refs, $this->data[$this->position][$this->key]);
}
@@ -280,7 +288,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
*
* @param mixed $item A Stub object or the original value being dumped
*/
private function dumpItem(DumperInterface $dumper, Cursor $cursor, array &$refs, mixed $item)
private function dumpItem(DumperInterface $dumper, Cursor $cursor, array &$refs, mixed $item): void
{
$cursor->refIndex = 0;
$cursor->softRefTo = $cursor->softRefHandle = $cursor->softRefCount = 0;
@@ -362,6 +370,10 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
$dumper->leaveHash($cursor, $item->type, $item->class, $withChildren, $cut);
break;
case Stub::TYPE_SCALAR:
$dumper->dumpScalar($cursor, 'default', $item->attr['value']);
break;
default:
throw new \RuntimeException(sprintf('Unexpected Stub type: "%s".', $item->type));
}
@@ -402,7 +414,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
return $hashCut;
}
private function getStub(mixed $item)
private function getStub(mixed $item): mixed
{
if (!$item || !\is_array($item)) {
return $item;
@@ -20,6 +20,8 @@ interface DumperInterface
{
/**
* Dumps a scalar value.
*
* @return void
*/
public function dumpScalar(Cursor $cursor, string $type, string|int|float|bool|null $value);
@@ -29,6 +31,8 @@ interface DumperInterface
* @param string $str The string being dumped
* @param bool $bin Whether $str is UTF-8 or binary encoded
* @param int $cut The number of characters $str has been cut by
*
* @return void
*/
public function dumpString(Cursor $cursor, string $str, bool $bin, int $cut);
@@ -38,6 +42,8 @@ interface DumperInterface
* @param int $type A Cursor::HASH_* const for the type of hash
* @param string|int|null $class The object class, resource type or array count
* @param bool $hasChild When the dump of the hash has child item
*
* @return void
*/
public function enterHash(Cursor $cursor, int $type, string|int|null $class, bool $hasChild);
@@ -48,6 +54,8 @@ interface DumperInterface
* @param string|int|null $class The object class, resource type or array count
* @param bool $hasChild When the dump of the hash has child item
* @param int $cut The number of items the hash has been cut by
*
* @return void
*/
public function leaveHash(Cursor $cursor, int $type, string|int|null $class, bool $hasChild, int $cut);
}
@@ -23,6 +23,7 @@ class Stub
public const TYPE_ARRAY = 3;
public const TYPE_OBJECT = 4;
public const TYPE_RESOURCE = 5;
public const TYPE_SCALAR = 6;
public const STRING_BINARY = 1;
public const STRING_UTF8 = 2;
@@ -16,12 +16,8 @@ namespace Symfony\Component\VarDumper\Cloner;
*/
class VarCloner extends AbstractCloner
{
private static string $gid;
private static array $arrayCache = [];
/**
* {@inheritdoc}
*/
protected function doClone(mixed $var): array
{
$len = 1; // Length of $queue
@@ -44,7 +40,6 @@ class VarCloner extends AbstractCloner
$stub = null; // Stub capturing the main properties of an original item value
// or null if the original value is used directly
$gid = self::$gid ??= md5(random_bytes(6)); // Unique string used to detect the special $GLOBALS variable
$arrayStub = new Stub();
$arrayStub->type = Stub::TYPE_ARRAY;
$fromObjCast = false;
@@ -121,53 +116,15 @@ class VarCloner extends AbstractCloner
}
$stub = $arrayStub;
if (\PHP_VERSION_ID >= 80100) {
$stub->class = array_is_list($v) ? Stub::ARRAY_INDEXED : Stub::ARRAY_ASSOC;
$a = $v;
break;
}
$stub->class = Stub::ARRAY_INDEXED;
$j = -1;
foreach ($v as $gk => $gv) {
if ($gk !== ++$j) {
$stub->class = Stub::ARRAY_ASSOC;
$a = $v;
$a[$gid] = true;
break;
}
}
// Copies of $GLOBALS have very strange behavior,
// let's detect them with some black magic
if (isset($v[$gid])) {
unset($v[$gid]);
$a = [];
foreach ($v as $gk => &$gv) {
if ($v === $gv && !isset($hardRefs[\ReflectionReference::fromArrayElement($v, $gk)->getId()])) {
unset($v);
$v = new Stub();
$v->value = [$v->cut = \count($gv), Stub::TYPE_ARRAY => 0];
$v->handle = -1;
$gv = &$a[$gk];
$hardRefs[\ReflectionReference::fromArrayElement($a, $gk)->getId()] = &$gv;
$gv = $v;
}
$a[$gk] = &$gv;
}
unset($gv);
} else {
$a = $v;
}
$stub->class = array_is_list($v) ? Stub::ARRAY_INDEXED : Stub::ARRAY_ASSOC;
$a = $v;
break;
case \is_object($v):
if (empty($objRefs[$h = spl_object_id($v)])) {
$stub = new Stub();
$stub->type = Stub::TYPE_OBJECT;
$stub->class = \get_class($v);
$stub->class = $v::class;
$stub->value = $v;
$stub->handle = $h;
$a = $this->castObject($stub, 0 < $i);