Forbid users to select dates after 2038 on 32-bit systems to prevent errors caused by Year2038 bug

See discussion #548 and #549
This commit is contained in:
Jan Böhmer 2024-03-09 00:11:00 +01:00
parent 18c697f472
commit 206bcebdb7
8 changed files with 167 additions and 36 deletions

View file

@ -37,6 +37,7 @@ use ApiPlatform\Metadata\Patch;
use ApiPlatform\Metadata\Post;
use ApiPlatform\Serializer\Filter\PropertyFilter;
use App\ApiPlatform\Filter\LikeFilter;
use App\Validator\Constraints\Year2038BugWorkaround;
use Doctrine\DBAL\Types\Types;
use App\Entity\Base\AbstractDBElement;
use App\Entity\Base\TimestampTrait;
@ -109,6 +110,7 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
*/
#[Groups(['extended', 'full', 'import', 'part_lot:read', 'part_lot:write'])]
#[ORM\Column(name: 'expiration_date', type: Types::DATETIME_MUTABLE, nullable: true)]
#[Year2038BugWorkaround]
protected ?\DateTimeInterface $expiration_date = null;
/**

View file

@ -32,6 +32,7 @@ use App\Entity\Base\TimestampTrait;
use App\Entity\Contracts\TimeStampableInterface;
use App\Repository\UserSystem\ApiTokenRepository;
use App\State\CurrentApiTokenProvider;
use App\Validator\Constraints\Year2038BugWorkaround;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
@ -76,6 +77,7 @@ class ApiToken implements TimeStampableInterface
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
#[Groups('token:read')]
#[Year2038BugWorkaround]
private ?\DateTimeInterface $valid_until;
#[ORM\Column(length: 68, unique: true)]