Skip to content
This repository was archived by the owner on Dec 23, 2021. It is now read-only.

Commit 1608846

Browse files
committed
Fixed HHVM-180: Throw exception if Timestamp arguments are out of range
1 parent 861102a commit 1608846

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

ext_mongodb.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,14 @@ final class Timestamp implements Type, \Serializable
758758

759759
public function __construct(private int $increment, private int $timestamp)
760760
{
761+
if ( $increment < 0 || $increment > 4294967295 )
762+
{
763+
throw new \MongoDB\Driver\Exception\InvalidArgumentException( "Expected increment to be an unsigned 32-bit integer, {$increment} given" );
764+
}
765+
if ( $timestamp < 0 || $timestamp > 4294967295 )
766+
{
767+
throw new \MongoDB\Driver\Exception\InvalidArgumentException( "Expected timestamp to be an unsigned 32-bit integer, {$timestamp} given" );
768+
}
761769
}
762770

763771
public function __toString() : string

0 commit comments

Comments
 (0)