[Web] Update composer libraries

This commit is contained in:
FreddleSpl0it committed 2026-10-28 11:56:29 +01:00
1 parent 9cc8ac2908
commit bd8c784118
1297 files changed
+71585 -24460

No files matched your search

@@ -27,7 +27,7 @@ class ArrayConverter
{
/**
* Converts linear messages array to tree-like array.
* For example this array('foo.bar' => 'value') will be converted to ['foo' => ['bar' => 'value']].
* For example: ['foo.bar' => 'value'] will be converted to ['foo' => ['bar' => 'value']].
*
* @param array $messages Linear messages array
*/
@@ -31,7 +31,6 @@ class XliffUtils
*/
public static function getVersionNumber(\DOMDocument $dom): string
{
/** @var \DOMNode $xliff */
foreach ($dom->getElementsByTagName('xliff') as $xliff) {
$version = $xliff->attributes->getNamedItem('version');
if ($version) {
@@ -41,7 +40,7 @@ class XliffUtils
$namespace = $xliff->attributes->getNamedItem('xmlns');
if ($namespace) {
if (0 !== substr_compare('urn:oasis:names:tc:xliff:document:', $namespace->nodeValue, 0, 34)) {
throw new InvalidArgumentException(sprintf('Not a valid XLIFF namespace "%s".', $namespace));
throw new InvalidArgumentException(\sprintf('Not a valid XLIFF namespace "%s".', $namespace));
}
return substr($namespace, 34);
@@ -83,6 +82,24 @@ class XliffUtils
return [];
}
public static function getErrorsAsString(array $xmlErrors): string
{
$errorsAsString = '';
foreach ($xmlErrors as $error) {
$errorsAsString .= \sprintf("[%s %s] %s (in %s - line %d, column %d)\n",
\LIBXML_ERR_WARNING === $error['level'] ? 'WARNING' : 'ERROR',
$error['code'],
$error['message'],
$error['file'],
$error['line'],
$error['column']
);
}
return $errorsAsString;
}
private static function shouldEnableEntityLoader(): bool
{
static $dom, $schema;
@@ -96,7 +113,7 @@ class XliffUtils
});
$schema = '<?xml version="1.0" encoding="utf-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:include schemaLocation="file:///'.str_replace('\\', '/', $tmpfile).'" />
<xsd:include schemaLocation="'.self::getFileUrl($tmpfile).'" />
</xsd:schema>';
file_put_contents($tmpfile, '<?xml version="1.0" encoding="utf-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
@@ -108,22 +125,17 @@ class XliffUtils
return !@$dom->schemaValidateSource($schema);
}
public static function getErrorsAsString(array $xmlErrors): string
private static function getFileUrl(string $path): string
{
$errorsAsString = '';
foreach ($xmlErrors as $error) {
$errorsAsString .= sprintf("[%s %s] %s (in %s - line %d, column %d)\n",
\LIBXML_ERR_WARNING === $error['level'] ? 'WARNING' : 'ERROR',
$error['code'],
$error['message'],
$error['file'],
$error['line'],
$error['column']
);
if ('\\' === \DIRECTORY_SEPARATOR) {
$parts = explode('/', str_replace('\\', '/', $path));
$drive = array_shift($parts).'/';
} else {
$parts = explode('/', $path);
$drive = '';
}
return $errorsAsString;
return 'file:///'.$drive.implode('/', array_map('rawurlencode', $parts));
}
private static function getSchema(string $xliffVersion): string
@@ -135,7 +147,7 @@ class XliffUtils
$schemaSource = file_get_contents(__DIR__.'/../Resources/schemas/xliff-core-2.0.xsd');
$xmlUri = 'informativeCopiesOf3rdPartySchemas/w3c/xml.xsd';
} else {
throw new InvalidArgumentException(sprintf('No support implemented for loading XLIFF version "%s".', $xliffVersion));
throw new InvalidArgumentException(\sprintf('No support implemented for loading XLIFF version "%s".', $xliffVersion));
}
return self::fixXmlLocation($schemaSource, $xmlUri);
@@ -146,23 +158,27 @@ class XliffUtils
*/
private static function fixXmlLocation(string $schemaSource, string $xmlUri): string
{
$newPath = str_replace('\\', '/', __DIR__).'/../Resources/schemas/xml.xsd';
$parts = explode('/', $newPath);
$locationstart = 'file:///';
if (0 === stripos($newPath, 'phar://')) {
$tmpfile = tempnam(sys_get_temp_dir(), 'symfony');
if ($tmpfile) {
copy($newPath, $tmpfile);
$parts = explode('/', str_replace('\\', '/', $tmpfile));
static $newPath;
if (null === $newPath) {
$path = __DIR__.'/../Resources/schemas/xml.xsd';
if (0 !== stripos($path, 'phar://')) {
$newPath = self::getFileUrl($path);
} elseif ($tmpfile = tempnam(sys_get_temp_dir(), 'symfony')) {
copy($path, $tmpfile);
register_shutdown_function(static function () use ($tmpfile) {
@unlink($tmpfile);
});
$newPath = self::getFileUrl($tmpfile);
} else {
$parts = explode('/', '\\' === \DIRECTORY_SEPARATOR ? str_replace('\\', '/', $path) : $path);
array_shift($parts);
$locationstart = 'phar:///';
$drive = '\\' === \DIRECTORY_SEPARATOR ? array_shift($parts).'/' : '';
$newPath = 'phar:///'.$drive.implode('/', array_map('rawurlencode', $parts));
}
}
$drive = '\\' === \DIRECTORY_SEPARATOR ? array_shift($parts).'/' : '';
$newPath = $locationstart.$drive.implode('/', array_map('rawurlencode', $parts));
return str_replace($xmlUri, $newPath, $schemaSource);
}