mirror of
https://github.com/ramsey/uuid.git
synced 2026-06-14 15:56:48 +03:00
Don't allow UUIDs to have trailing newline
This commit is contained in:
+1
-1
@@ -654,7 +654,7 @@ class Uuid implements UuidInterface
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!preg_match('/' . self::VALID_PATTERN . '/', $uuid)) {
|
||||
if (!preg_match('/' . self::VALID_PATTERN . '/D', $uuid)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -88,6 +88,15 @@ class UuidTest extends TestCase
|
||||
$uuid = Uuid::fromString('ff6f8cb0-c57d-11e1-9b21');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Ramsey\Uuid\Exception\InvalidUuidStringException
|
||||
* @expectedExceptionMessage Invalid UUID string:
|
||||
*/
|
||||
public function testFromStringWithTrailingNewLine()
|
||||
{
|
||||
Uuid::fromString("d0d5f586-21d1-470c-8088-55c8857728dc\n");
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public function testFromStringWithUrn()
|
||||
|
||||
Reference in New Issue
Block a user