This repository has been archived by the owner on Jul 4, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merged branch fabpot/request-context-fix (PR #663)
This PR was merged into the master branch. Discussion ---------- fixed request dependency on the URL matcher Alternative fix for #662 Commits ------- 5dc7c27 fixed request dependency on the URL matcher
- Loading branch information
Showing
2 changed files
with
34 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Silex framework. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Silex; | ||
|
||
use Symfony\Component\Routing\RequestContext as BaseRequestContext; | ||
use Symfony\Component\HttpFoundation\Request; | ||
|
||
/** | ||
* Request Context for Symfony <= 2.2 | ||
* | ||
* @author Fabien Potencier <fabien@symfony.com> | ||
*/ | ||
class RequestContext extends BaseRequestContext | ||
{ | ||
public function fromRequest(Request $request) | ||
{ | ||
parent::fromRequest($request); | ||
|
||
// Inject the query string as a parameter for Symfony versions <= 2.2 | ||
if (!method_exists($this, 'getQueryString') && '' !== $qs = $request->server->get('QUERY_STRING')) { | ||
$this->setParameter('QUERY_STRING', $qs); | ||
} | ||
} | ||
} |