---
title: "ramsey/uuid: UUIDs just before the Unix epoch in PHP"
description: "A fix in ramsey/uuid, in PHP: reading the date of a version 1 or 6 UUID just before 1970 no longer throws because of a float in scientific notation."
url: "https://vulcode.com/en/opensource/contributions/ramsey-uuid"
lang: "en"
---

[All contributions](https://vulcode.com/en/opensource/contributions)

ramsey/uuid

# ramsey/uuid

A PHP library for generating universally unique identifiers (UUIDs).

[See the repository](https://github.com/ramsey/uuid) [All contributions](https://vulcode.com/en/opensource/contributions)

- **Language**: PHP
- **GitHub stars**: 12,642
- **Merged changes**: 1

## What we changed

getDateTime() on a version 1 or 6 UUID with a timestamp just before the Unix epoch, such as 1969-12-31 23:59:59.999999, no longer throws an uncaught InvalidArgumentException. The conversion falls back to the backup converter instead.

### What this work shows

- Version 1 and 6 UUIDs

- Floats and their string form in PHP

- PHPUnit tests with data providers

- PHPStan static analysis

What was broken

### A time just before 1970 broke the conversion

PhpTimeConverter divided the count of 100-nanosecond intervals by the intervals per second and split the string form of the result on the decimal point. Near zero PHP renders such a number in scientific notation, such as -1.0E-6, so the fractional part became "0E-600" and Type\Integer threw. That is how getDateTime() ended for a UUID at 1969-12-31 23:59:59.999999.

How we fixed it

### Scientific notation goes to the fallback converter

splitTime() now spots the E in the fractional part and returns an empty array, as the existing precision-loss guard does. convertTime() then falls back to GenericTimeConverter, which works on brick/math decimals.

[#645](https://github.com/ramsey/uuid/pull/645)

## Merged change 1

- [#645 Fix uncaught InvalidArgumentException in PhpTimeConverter for timestamps just before the Unix epoch Merged 13 November 2026](https://github.com/ramsey/uuid/pull/645)

## What it taught us

From an unclear exception we traced the cause to how numbers are written: PHP renders very small floats in scientific notation, and the code split that string on the decimal point. The fix is narrow on purpose and reuses the fallback path the method already had.

[More about this technology: PHP](https://vulcode.com/en/technologies/php)

## Other projects we write code for

- [**Composer** PHP · 29,590 stars The dependency manager for PHP: it installs and updates a project's libraries from its composer.json.](https://vulcode.com/en/opensource/contributions/composer)

- [**PHPMailer** PHP · 22,347 stars The classic PHP library for sending email, used by WordPress and many other systems.](https://vulcode.com/en/opensource/contributions/phpmailer)

- [**Monolog** PHP · 21,407 stars A PHP logging library that sends records to files, sockets, inboxes, databases and web services. Symfony and Laravel use it, among others.](https://vulcode.com/en/opensource/contributions/monolog)

- [**Carbon** PHP · 16,583 stars A PHP DateTime extension for working with dates, standard in the Laravel ecosystem.](https://vulcode.com/en/opensource/contributions/carbon)

- [**Whoops** PHP · 13,231 stars A PHP library that turns uncaught exceptions into a readable error page with the stack trace, known from Laravel.](https://vulcode.com/en/opensource/contributions/whoops)

- [**Doctrine Lexer** PHP · 11,141 stars A base for lexers used by recursive descent parsers in PHP, used by Doctrine ORM among others.](https://vulcode.com/en/opensource/contributions/doctrine-lexer)

## Describe your project.

A free quote comes back within an hour during working hours.

### Rather skip the form?

Ask in the chat or write to us directly.

Open the chat

- **Email**: [hello@vulcode.com](mailto:hello@vulcode.com)
- **Phone**: [+48 576 043 920](tel:+48576043920)
- **Discord**: [discord.gg/vulcode](https://discord.gg/vulcode)
