Skip to content

[Serializer][Uid][Validator] Mention RFC 9562 #58238

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class UidNormalizer implements NormalizerInterface, DenormalizerInterface,
public const NORMALIZATION_FORMAT_CANONICAL = 'canonical';
public const NORMALIZATION_FORMAT_BASE58 = 'base58';
public const NORMALIZATION_FORMAT_BASE32 = 'base32';
public const NORMALIZATION_FORMAT_RFC4122 = 'rfc4122';
public const NORMALIZATION_FORMAT_RFC4122 = 'rfc4122'; // RFC 9562 obsoleted RFC 4122 but the format is the same
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might add public const NORMALIZATION_FORMAT_RFC9562 = self::NORMALIZATION_FORMAT_RFC4122; in Symfony 7.2 in case some people look for the format for RFC 9562.


private $defaultContext = [
self::NORMALIZATION_FORMAT_KEY => self::NORMALIZATION_FORMAT_CANONICAL,
Expand Down
4 changes: 3 additions & 1 deletion src/Symfony/Component/Uid/AbstractUid.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ public static function fromBase32(string $uid): self
}

/**
* @param string $uid A valid RFC 9562/4122 uid
*
* @return static
*
* @throws \InvalidArgumentException When the passed value is not valid
Expand Down Expand Up @@ -124,7 +126,7 @@ public function toBase32(): string
}

/**
* Returns the identifier as a RFC4122 case insensitive string.
* Returns the identifier as a RFC 9562/4122 case insensitive string.
*/
public function toRfc4122(): string
{
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Uid/BinaryUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class BinaryUtil
'u' => 52, 'v' => 53, 'w' => 54, 'x' => 55, 'y' => 56, 'z' => 57,
];

// https://tools.ietf.org/html/rfc4122#section-4.1.4
// https://datatracker.ietf.org/doc/html/rfc9562#section-5.1
// 0x01b21dd213814000 is the number of 100-ns intervals between the
// UUID epoch 1582-10-15 00:00:00 and the Unix epoch 1970-01-01 00:00:00.
private const TIME_OFFSET_INT = 0x01B21DD213814000;
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Uid/Uuid.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/**
* @author Grégoire Pineau <lyrixx@lyrixx.info>
*
* @see https://tools.ietf.org/html/rfc4122#appendix-C for details about namespaces
* @see https://datatracker.ietf.org/doc/html/rfc9562/#section-6.6 for details about namespaces
*/
class Uuid extends AbstractUid
{
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Validator/Constraints/Uuid.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Uuid extends Constraint
self::INVALID_VARIANT_ERROR => 'INVALID_VARIANT_ERROR',
];

// Possible versions defined by RFC 4122
// Possible versions defined by RFC 9562/4122
public const V1_MAC = 1;
public const V2_DCE = 2;
public const V3_MD5 = 3;
Expand All @@ -64,7 +64,7 @@ class Uuid extends Constraint
public $message = 'This is not a valid UUID.';

/**
* Strict mode only allows UUIDs that meet the formal definition and formatting per RFC 4122.
* Strict mode only allows UUIDs that meet the formal definition and formatting per RFC 9562/4122.
*
* Set this to `false` to allow legacy formats with different dash positioning or wrapping characters
*
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Validator/Constraints/UuidValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
/**
* Validates whether the value is a valid UUID (also known as GUID).
*
* Strict validation will allow a UUID as specified per RFC 4122.
* Strict validation will allow a UUID as specified per RFC 9562/4122.
* Loose validation will allow any type of UUID.
*
* @author Colin O'Dell <colinodell@gmail.com>
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @see http://tools.ietf.org/html/rfc4122
* @see https://datatracker.ietf.org/doc/html/rfc9562
* @see https://en.wikipedia.org/wiki/Universally_unique_identifier
*/
class UuidValidator extends ConstraintValidator
Expand Down
Loading