Skip to content

Commit da1c1c5

Browse files
committed
minor #12537 [HttpFoundation] Make Request::get() more performant (KorvinSzanto, xabbuh)
This PR was submitted for the 2.7 branch but it was merged into the 2.3 branch instead (closes #12537). Discussion ---------- [HttpFoundation] Make Request::get() more performant | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | This finishes the work started by @KorvinSzanto in #12369. Commits ------- 3039935 reformat code as suggested by @fabpot ad64223 Fix typo 4162713 Make `\Request::get` more performant.
2 parents ce36821 + 3039935 commit da1c1c5

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/Symfony/Component/HttpFoundation/Request.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,19 @@ public static function getHttpMethodParameterOverride()
692692
*/
693693
public function get($key, $default = null, $deep = false)
694694
{
695-
return $this->query->get($key, $this->attributes->get($key, $this->request->get($key, $default, $deep), $deep), $deep);
695+
if ($this !== $result = $this->query->get($key, $this, $deep)) {
696+
return $result;
697+
}
698+
699+
if ($this !== $result = $this->attributes->get($key, $this, $deep)) {
700+
return $result;
701+
}
702+
703+
if ($this !== $result = $this->request->get($key, $this, $deep)) {
704+
return $result;
705+
}
706+
707+
return $default;
696708
}
697709

698710
/**

0 commit comments

Comments
 (0)