Skip to content

Commit

Permalink
⬆️ upgraded dependencieså
Browse files Browse the repository at this point in the history
  • Loading branch information
bnomei committed Feb 2, 2025
1 parent d0158d2 commit 82616f8
Show file tree
Hide file tree
Showing 17 changed files with 201 additions and 68 deletions.
11 changes: 7 additions & 4 deletions vendor/composer/InstalledVersions.php
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ private static function getInstalled()
}

$installed = array();
$copiedLocalDir = false;

if (self::$canGetVendors) {
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
Expand All @@ -330,9 +331,11 @@ private static function getInstalled()
} elseif (is_file($vendorDir.'/composer/installed.php')) {
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = require $vendorDir.'/composer/installed.php';
$installed[] = self::$installedByVendor[$vendorDir] = $required;
if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
self::$installed = $installed[count($installed) - 1];
self::$installedByVendor[$vendorDir] = $required;
$installed[] = $required;
if (strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
self::$installed = $required;
$copiedLocalDir = true;
}
}
}
Expand All @@ -350,7 +353,7 @@ private static function getInstalled()
}
}

if (self::$installed !== array()) {
if (self::$installed !== array() && !$copiedLocalDir) {
$installed[] = self::$installed;
}

Expand Down
32 changes: 16 additions & 16 deletions vendor/composer/installed.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php return array(
'root' => array(
'name' => 'bnomei/kirby3-security-headers',
'pretty_version' => '5.0.1',
'version' => '5.0.1.0',
'pretty_version' => '5.0.2',
'version' => '5.0.2.0',
'reference' => null,
'type' => 'kirby-plugin',
'install_path' => __DIR__ . '/../../',
Expand All @@ -11,8 +11,8 @@
),
'versions' => array(
'bnomei/kirby3-security-headers' => array(
'pretty_version' => '5.0.1',
'version' => '5.0.1.0',
'pretty_version' => '5.0.2',
'version' => '5.0.2.0',
'reference' => null,
'type' => 'kirby-plugin',
'install_path' => __DIR__ . '/../../',
Expand All @@ -29,18 +29,18 @@
'dev_requirement' => false,
),
'opis/json-schema' => array(
'pretty_version' => '2.3.0',
'version' => '2.3.0.0',
'reference' => 'c48df6d7089a45f01e1c82432348f2d5976f9bfb',
'pretty_version' => '2.4.1',
'version' => '2.4.1.0',
'reference' => '712827751c62b465daae6e725bf0cf5ffbf965e1',
'type' => 'library',
'install_path' => __DIR__ . '/../opis/json-schema',
'aliases' => array(),
'dev_requirement' => false,
),
'opis/string' => array(
'pretty_version' => '2.0.1',
'version' => '2.0.1.0',
'reference' => '9ebf1a1f873f502f6859d11210b25a4bf5d141e7',
'pretty_version' => '2.0.2',
'version' => '2.0.2.0',
'reference' => 'ba0b9607b9809462b0e28a11e4881a8d77431feb',
'type' => 'library',
'install_path' => __DIR__ . '/../opis/string',
'aliases' => array(),
Expand All @@ -56,18 +56,18 @@
'dev_requirement' => false,
),
'paragonie/constant_time_encoding' => array(
'pretty_version' => 'v2.7.0',
'version' => '2.7.0.0',
'reference' => '52a0d99e69f56b9ec27ace92ba56897fe6993105',
'pretty_version' => 'v3.0.0',
'version' => '3.0.0.0',
'reference' => 'df1e7fde177501eee2037dd159cf04f5f301a512',
'type' => 'library',
'install_path' => __DIR__ . '/../paragonie/constant_time_encoding',
'aliases' => array(),
'dev_requirement' => false,
),
'paragonie/csp-builder' => array(
'pretty_version' => 'v3.0.1',
'version' => '3.0.1.0',
'reference' => 'e2f9f177dd33311b7c16ea206488e0b10d1ea4d3',
'pretty_version' => 'v3.0.2',
'version' => '3.0.2.0',
'reference' => '54318fc99e13540f2c0375f746b3789f3d7f3221',
'type' => 'library',
'install_path' => __DIR__ . '/../paragonie/csp-builder',
'aliases' => array(),
Expand Down
8 changes: 6 additions & 2 deletions vendor/opis/json-schema/src/CompliantValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,13 @@ class CompliantValidator extends Validator
'keepAdditionalItemsKeyword' => false,
];

public function __construct(?SchemaLoader $loader = null, int $max_errors = 1)
public function __construct(
?SchemaLoader $loader = null,
int $max_errors = 1,
bool $stop_at_first_error = true
)
{
parent::__construct($loader, $max_errors);
parent::__construct($loader, $max_errors, $stop_at_first_error);

// Set parser options
$parser = $this->parser();
Expand Down
2 changes: 1 addition & 1 deletion vendor/opis/json-schema/src/Errors/ErrorFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public function formatErrorMessage(ValidationError $error, ?string $message = nu
return preg_replace_callback(
'~{([^}]+)}~imu',
static function (array $m) use ($args) {
if (!isset($args[$m[1]])) {
if (!array_key_exists($m[1], $args)) {
return $m[0];
}

Expand Down
4 changes: 2 additions & 2 deletions vendor/opis/json-schema/src/Filters/DateTimeFilters.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

namespace Opis\JsonSchema\Filters;

use DateTime;
use DateTime, DateTimeZone;

final class DateTimeFilters
{
Expand Down Expand Up @@ -91,7 +91,7 @@ public static function MaxTime(string $time, array $args): bool

private static function CreateDate(string $value, ?string $timezone = null, bool $time = true): DateTime
{
$date = new DateTime($value, $timezone);
$date = new DateTime($value, $timezone ? new DateTimeZone($timezone) : null);
if (!$time) {
return $date->setTime(0, 0, 0, 0);
}
Expand Down
77 changes: 59 additions & 18 deletions vendor/opis/json-schema/src/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,40 +235,81 @@ public static function equals($a, $b): bool
return false;
}


/**
* @var bool|null True if bcmath extension is available
*/
private static ?bool $hasBCMath = null;

/**
* @var bool True to use bcmath
*/
public static bool $useBCMath = true;

/**
* @var int Number scale to used when using comparisons
*/
public static int $numberScale = 14;

/**
* @param $number
* @param $divisor
* @param int $scale
* @param int|null $scale
* @return bool
*/
public static function isMultipleOf($number, $divisor, int $scale = 14): bool
public static function isMultipleOf($number, $divisor, ?int $scale = null): bool
{
static $bcMath = null;
if ($bcMath === null) {
$bcMath = extension_loaded('bcmath');
if (!$number || $number == $divisor) {
return true;
}

if ($divisor == 0) {
return $number == 0;
}

if ($bcMath) {
$number = number_format($number, $scale, '.', '');
$divisor = number_format($divisor, $scale, '.', '');
// maybe we get lucky
if (!fmod($number, $divisor)) {
return true;
}

$divisor = abs($divisor);
if ($divisor == 1) {
// should have been caught by the above fmod()
return false;
}

$number = abs($number);
if ($divisor > $number) {
// number / divisor < 1
return false;
}

// Use global scale if null
$scale ??= self::$numberScale;

if (
!self::$useBCMath ||
!(self::$hasBCMath ??= extension_loaded('bcmath'))
) {
// use an approximation
return abs($number - round($number / $divisor) * $divisor) < (10 ** -$scale);
}

// use bcmath

/** @noinspection PhpComposerExtensionStubsInspection */
$x = bcdiv($number, $divisor, 0);
/** @noinspection PhpComposerExtensionStubsInspection */
$x = bcmul($divisor, $x, $scale);
/** @noinspection PhpComposerExtensionStubsInspection */
$x = bcsub($number, $x, $scale);
$number = number_format($number, $scale, '.', '');
$divisor = number_format($divisor, $scale, '.', '');

/** @noinspection PhpComposerExtensionStubsInspection */
return 0 === bccomp($x, 0, $scale);
// number can be zero after formatting
if (!(float)$divisor) {
return $number === $divisor;
}

$div = $number / $divisor;
$x = bcdiv($number, $divisor, 0);
$x = bcmul($divisor, $x, $scale);
$x = bcsub($number, $x, $scale);

return $div == (int)$div;
return 0 === bccomp($x, 0, $scale);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions vendor/opis/json-schema/src/JsonPointer.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public function __toString(): string
/**
* @param $data
* @param array|null $path
* @param null $default
* @param mixed $default
* @return mixed
*/
public function data($data, ?array $path = null, $default = null)
Expand Down Expand Up @@ -252,7 +252,7 @@ public static function parse(string $pointer, bool $decode = true): ?self
* @param $data
* @param array|null $path
* @param bool $fragment
* @param null $default
* @param mixed $default
* @return mixed
*/
public static function getData($data, ?array $path = null, bool $fragment = false, $default = null)
Expand Down Expand Up @@ -407,4 +407,4 @@ public static function createRelative(int $level, array $path = [], int $shift =
{
return new self($path, $level, $shift, $fragment);
}
}
}
4 changes: 2 additions & 2 deletions vendor/opis/json-schema/src/Keywords/ConstKeyword.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ public function validate(ValidationContext $context, Schema $schema): ?Validatio
return null;
}

return $this->error($schema, $context, 'const', 'The data must must match the const value', [
return $this->error($schema, $context, 'const', 'The data must match the const value', [
'const' => $this->const
]);
}
}
}
4 changes: 0 additions & 4 deletions vendor/opis/json-schema/src/Keywords/MaxLengthKeyword.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ public function __construct(int $length)
*/
public function validate(ValidationContext $context, Schema $schema): ?ValidationError
{
if ($this->length === 0) {
return null;
}

$length = $context->getStringLength();

if ($length <= $this->length) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ protected function parseFilter(

if (property_exists($filter, '$vars')) {
if (!is_object($filter->{'$vars'})) {
throw $this->keywordException('$vars (for {keyword}) must be a string', $info);
throw $this->keywordException('$vars (for {keyword}) must be an object', $info);
}
unset($vars['$vars']);
$vars = get_object_vars($filter->{'$vars'}) + $vars;
Expand Down
34 changes: 31 additions & 3 deletions vendor/opis/json-schema/src/Schemas/ObjectSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
namespace Opis\JsonSchema\Schemas;

use Opis\JsonSchema\{Helper, Keyword, ValidationContext, KeywordValidator};
use Opis\JsonSchema\Info\SchemaInfo;
use Opis\JsonSchema\Info\{DataInfo, SchemaInfo};
use Opis\JsonSchema\Errors\ValidationError;
use Opis\JsonSchema\KeywordValidators\CallbackKeywordValidator;

Expand Down Expand Up @@ -109,12 +109,40 @@ public function doValidate(ValidationContext $context): ?ValidationError
*/
protected function applyKeywords(array $keywords, ValidationContext $context): ?ValidationError
{
if ($context->stopAtFirstError()) {
foreach ($keywords as $keyword) {
if ($error = $keyword->validate($context, $this)) {
return $error;
}
}
return null;
}

/** @var null|ValidationError[] $error_list */
$error_list = null;

foreach ($keywords as $keyword) {
if ($error = $keyword->validate($context, $this)) {
return $error;
$error_list ??= [];
$error_list[] = $error;
}
}

return null;
if (!$error_list) {
return null;
}

if (count($error_list) === 1) {
return $error_list[0];
}

return new ValidationError(
'',
$this,
DataInfo::fromContext($context),
'Data must match schema',
[],
$error_list
);
}
}
Loading

0 comments on commit 82616f8

Please sign in to comment.