Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 300130

Remove code that tries to use _raw_variables for route argument resolution as it does not work

$
0
0

Problem/Motivation

We are supposed to be able to use _raw_variables for argument resolution but this has never worked because the code is treating a ParameterBag like an array (which it is not).

\Drupal\Core\Routing\Enhancer\ParamConversionEnhancer::copyRawVariables() has always returned a ParameterBag object and that object has never had array access so all of this looks like an oversight.

Proposed resolution

Remove pretence of been able to use _raw_variables for argument resolution rather than fixing something we can not possibly be using.

Remaining tasks

User interface changes

None

API changes

None

Data model changes

None

Release notes snippet

Private service argument_resolver.raw_parameter has been removed. It didn't actually work.

Original report

in Drupal\Core\Controller\ControllerResolver::doGetArguments (file: \core\lib\Drupal\Core\Controller\ControllerResolver.php) the bug code:

  protected function doGetArguments(Request $request, $controller, array $parameters) {
    $attributes = $request->attributes->all();
    $raw_parameters = $request->attributes->has('_raw_variables') ? $request->attributes->get('_raw_variables') : [];
    $arguments = array();
    foreach ($parameters as $param) {
      if (array_key_exists($param->name, $attributes)) {
        $arguments[] = $attributes[$param->name];
      }
      elseif (array_key_exists($param->name, $raw_parameters)) {
        $arguments[] = $attributes[$param->name]; // here!
      }

"$attributes" here should be "$raw_parameters"
sorry, I'm not good at English , The following is a Chinese description:

在Drupal\Core\Controller\ControllerResolver::doGetArguments中
此处的变量误写成了“$attributes”,它应该是“$raw_parameters” 这会导致控制器获取不到原始变量中的值


Viewing all articles
Browse latest Browse all 300130

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>