Skip to content

Commit

Permalink
Merge branch '5.6' of github.com:laravel/framework into 5.6
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Mar 28, 2018
2 parents 200fdc6 + 30d2f7f commit 0d3cb33
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Illuminate/Routing/UrlGenerator.php
Expand Up @@ -347,7 +347,7 @@ public function hasValidSignature(Request $request)

$signature = hash_hmac('sha256', $original, call_user_func($this->keyResolver));

return hash_equals($signature, $request->query('signature')) &&
return hash_equals($signature, $request->query('signature', '')) &&
! ($expires && Carbon::now()->getTimestamp() > $expires);
}

Expand Down
9 changes: 9 additions & 0 deletions tests/Integration/Routing/UrlSigningTest.php
Expand Up @@ -39,6 +39,15 @@ public function test_temporary_signed_urls()
$this->assertEquals('invalid', $this->get($url)->original);
}

public function test_signed_url_with_url_without_signature_parameter()
{
Route::get('/foo/{id}', function (Request $request, $id) {
return $request->hasValidSignature() ? 'valid' : 'invalid';
})->name('foo');

$this->assertEquals('invalid', $this->get('/foo/1')->original);
}

public function test_signed_middleware()
{
Route::get('/foo/{id}', function (Request $request, $id) {
Expand Down

0 comments on commit 0d3cb33

Please sign in to comment.