Upgrade to 4.3.0

This commit is contained in:
Bastian Allgeier
2024-06-13 12:13:00 +02:00
parent 4b55753c46
commit e50c0341fc
87 changed files with 643 additions and 430 deletions

View File

@@ -76,7 +76,7 @@ class Component
}
$this->attrs = $attrs;
$this->options = $options = $this->setup($type);
$this->options = $options = static::setup($type);
$this->methods = $methods = $options['methods'] ?? [];
foreach ($attrs as $attrName => $attrValue) {

View File

@@ -464,7 +464,7 @@ class Dom
$namespaceUri = null;
$itemLocal = $item;
if (Str::contains($item, ':') === true) {
list($namespaceName, $itemLocal) = explode(':', $item);
[$namespaceName, $itemLocal] = explode(':', $item);
$namespaceUri = $allowedNamespaces[$namespaceName] ?? null;
} else {
// list items without namespace are from the default namespace

View File

@@ -26,7 +26,7 @@ class Escape
/**
* The internal singleton escaper instance
*/
protected static Escaper|null $escaper;
protected static Escaper|null $escaper = null;
/**
* Escape common HTML attributes data

View File

@@ -20,7 +20,7 @@ class Html extends Xml
/**
* An internal store for an HTML entities translation table
*/
public static array|null $entities;
public static array|null $entities = null;
/**
* List of HTML tags that can be used inline

View File

@@ -386,10 +386,13 @@ class Str
$encoded = '';
for ($i = 0; $i < static::length($string); $i++) {
$char = static::substr($string, $i, 1);
$char = mb_convert_encoding($char, 'UCS-4BE', 'UTF-8');
list(, $code) = unpack('N', $char);
$encoded .= rand(1, 2) === 1 ? '&#' . $code . ';' : '&#x' . dechex($code) . ';';
$char = static::substr($string, $i, 1);
$char = mb_convert_encoding($char, 'UCS-4BE', 'UTF-8');
[, $code] = unpack('N', $char);
$encoded .= match (random_int(1, 2)) {
1 => '&#' . $code . ';',
2 => '&#x' . dechex($code) . ';'
};
}
return $encoded;