Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-14958

Twig extension function lang() performs redundant template data copying

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.1.11-RC1, 3.2.0
    • 3.1.10, 3.2.0-RC2
    • Template Engine
    • None

      In \phpbb\template\twig\extension.php, function lang() performs full template data and then a part ofit ('rootref') copying in https://github.com/phpbb/phpbb/blob/3.1.x/phpBB/phpbb/template/twig/extension.php#L172-L173

      		$context = $this->context->get_data_ref();
      		$context_vars = $context['.'][0];
      

      In respect of optimization, this can be shortened to

      $context_vars = $this->context->get_root_ref();
      

      (the latter also returns a referense).

            Marc Marc
            rxu rxu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: