Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yeray Santana Hualde
syncEnrollments
Commits
a2aebdb0
Commit
a2aebdb0
authored
Oct 27, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix routing provides bug.
parent
e44eec10
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
8 deletions
+22
-8
router.php
laravel/routing/router.php
+22
-8
No files found.
laravel/routing/router.php
View file @
a2aebdb0
...
...
@@ -123,14 +123,13 @@ class Router {
foreach
(
$routes
as
$keys
=>
$callback
)
{
// We need to make sure that the requested format is provided by the
// route. If it isn't, there is no need to continue evaluating it.
if
(
!
in_array
(
$format
,
$this
->
provides
(
$callback
)))
continue
;
$formats
=
$this
->
formats
(
$callback
);
// Only check routes having multiple URIs or wildcards since other
// routes would have been caught by the check for literal matches.
if
(
strpos
(
$keys
,
'('
)
!==
false
or
strpos
(
$keys
,
','
)
!==
false
)
// Only check the routes that couldn't be matched literally...
if
((
$format_count
=
count
(
$formats
))
>
0
or
$this
->
fuzzy
(
$keys
))
{
if
(
$format_count
>
0
and
!
in_array
(
$format
,
$formats
))
continue
;
if
(
!
is_null
(
$route
=
$this
->
match
(
$destination
,
$keys
,
$callback
,
$format
)))
{
return
Request
::
$route
=
$route
;
...
...
@@ -147,14 +146,29 @@ class Router {
* @param mixed $callback
* @return array
*/
protected
function
provide
s
(
$callback
)
protected
function
format
s
(
$callback
)
{
if
(
is_array
(
$callback
)
and
isset
(
$callback
[
'provides'
]))
{
return
(
is_string
(
$provides
=
$callback
[
'provides'
]))
?
explode
(
'|'
,
$provides
)
:
$provides
;
}
return
array
(
'html'
);
return
array
();
}
/**
* Determine if a route needs to be examined using a regular expression.
*
* Routes that contain wildcards or multiple URIs cannot be matched using
* a literal key check on the array. The wildcards will have to be turned
* into real regular expressions and the multiple URIs have to be split.
*
* @param string $keys
* @return bool
*/
protected
function
fuzzy
(
$keys
)
{
return
strpos
(
$keys
,
'('
)
!==
false
or
strpos
(
$keys
,
','
)
!==
false
;
}
/**
...
...
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