Skip to content

Commit 3a6b01a

Browse files
author
Aaron Hedges
committed
fix unexpectedvalueexceptions and add unit tests
1 parent d4fa25d commit 3a6b01a

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/JWT.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Firebase\JWT;
44
use \DomainException;
5+
use \UnexpectedValueException;
56
use \DateTime;
67

78
/**

tests/JWTTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,4 +235,10 @@ public function testAdditionalHeaders()
235235
$msg = JWT::encode('abc', 'my_key', 'HS256', null, array('cty' => 'test-eit;v=1'));
236236
$this->assertEquals(JWT::decode($msg, 'my_key', array('HS256')), 'abc');
237237
}
238+
239+
public function testInvalidSegmentCount()
240+
{
241+
$this->setExpectedException('UnexpectedValueException');
242+
JWT::decode('brokenheader.brokenbody', 'my_key', array('HS256'));
243+
}
238244
}

0 commit comments

Comments
 (0)