Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-11435

Extension template files curly braces bug



    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 3.1.0-dev
    • Fix Version/s: 3.1.0-a1
    • Component/s: Extensions
    • Labels:
    • Environment:
      PHP 5.3.6, phpBB 3.1-dev, Safari 6.0.2


      In an extension with template event files that use language vars, the language vars are injected with a newline immediately after each lang var.

      This breaks javascript when js code uses language vars in it's code, such as in strings. It can also potentially break html.

      Example: an extension template file (i.e.: overall_footer_after.html) contains:

      <script type="text/javascript">
      var text = "{LA_FORUM_INDEX}";

      This is rendered by phpBB in HTML as:

      <script type="text/javascript">
      var text = "Board index
      <div>Board index

      Note the new line added after the language var! This happens for both LA_ and L_ language vars anywhere they may be used in extension template files. It also does not matter if the extension's template is using core phpBB lang vars, and/or its own. It happens in all cases with extension templates.

      Update: This isn't limited to language vars. It's any where a curly brace variable is used in an event template file, i.e.:

      <a href="{U_VIEW_TOPIC}" class="topictitle">{TOPIC_TITLE}</a> 


      <a href="./viewtopic.php?f=2&amp;t=7
      " class="topictitle">My Great Topic


      <dl class="icon {TOPIC_IMG_STYLE}">


      <dl class="icon topic_read

      Notice that every } closing curly brace creates a newline in the html output

      I also examined a cached file, to see how the php is being rendered by the template engine, and found the previous example to look something like this:

      <dl class="icon <?php echo (isset($_row_val['TOPIC_IMG_STYLE'])) ? $_row_val['TOPIC_IMG_STYLE'] : ''; ?>

      As you can see, actually two newlines are added between the closing php tag and the double quote from the template!

      So it is like the template engine is adding ?>\n\n for every closing curly brace.


          Issue Links



              • Assignee:
                EXreaction EXreaction [X] (Inactive)
                VSE Matt Friedman
              • Votes:
                0 Vote for this issue
                4 Start watching this issue


                • Created: