Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
Silex
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
Silex
Commits
5dc7c27f
Commit
5dc7c27f
authored
Mar 29, 2013
by
Fabien Potencier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed request dependency on the URL matcher
parent
a5cb55ce
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
6 deletions
+34
-6
src/Silex/Application.php
src/Silex/Application.php
+1
-6
src/Silex/RequestContext.php
src/Silex/RequestContext.php
+33
-0
No files found.
src/Silex/Application.php
View file @
5dc7c27f
...
...
@@ -28,7 +28,7 @@ use Symfony\Component\HttpFoundation\RedirectResponse;
use
Symfony\Component\HttpFoundation\StreamedResponse
;
use
Symfony\Component\HttpFoundation\JsonResponse
;
use
Symfony\Component\Routing\RouteCollection
;
use
S
ymfony\Component\Routing
\RequestContext
;
use
S
ilex
\RequestContext
;
use
Silex\RedirectableUrlMatcher
;
use
Silex\ControllerResolver
;
use
Silex\EventListener\LocaleListener
;
...
...
@@ -125,11 +125,6 @@ class Application extends \Pimple implements HttpKernelInterface, TerminableInte
});
$this
[
'url_matcher'
]
=
$this
->
share
(
function
()
use
(
$app
)
{
// Inject the query string into the RequestContext for Symfony versions <= 2.2
if
(
$app
[
'request'
]
->
server
->
get
(
'QUERY_STRING'
)
!==
''
&&
!
method_exists
(
$app
[
'request_context'
],
'getQueryString'
))
{
$app
[
'request_context'
]
->
setParameter
(
'QUERY_STRING'
,
$app
[
'request'
]
->
server
->
get
(
'QUERY_STRING'
));
}
return
new
RedirectableUrlMatcher
(
$app
[
'routes'
],
$app
[
'request_context'
]);
});
...
...
src/Silex/RequestContext.php
0 → 100644
View file @
5dc7c27f
<?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
);
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment