Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-10546

[patch included] ezroot() and ezurl() mishandle first parameter, with TemplateCompile enabled

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Medium Medium
    • 3.10.0, 3.8.10, 3.9.4
    • 3.8.6, 3.9.0, 3.9.1
    • None
    • Operating System: FreeBSD; doesn't matter
      PHP Version: (please be specific, like '4.4.3' or '5.1.5') 4.4.4; doesn't matter
      Database and version: MySQL; doesn't matter
      Browser (and version): Konqueror 3.5.6; doesn't matter

    Description

      With ``TemplateCompile'' enabled, ezroot() and ezurl() assumes first parameter is a constant, and passing a variable is ignored. In such case, both operators output the default doublequotes.

      However, with ``TemplateCompile'' disabled – as one may set during site development, both operators behave correctly in regard to first parameter being a variable. This may lead to some links on site getting silently broken, as they're being output with wrong kind of quotes. For exmaple, a link in JavaScript onclick handler, which needs to be enclosed in single quoted.

      The behavior depends on a block of code, shared by both operators, around lines 491-508 in kernel/common/ezurloperator.php ( line numbers for version 3.9.1 ). The block fails to check with eZTemplateNodeTool::isStaticElement() whether the first parameter is static or variable. The block of code is not being used when TemplateCompile is disabled.

      Steps to reproduce
      • enable ``TemplateCompile'' in site.ini
      • create a template which uses ezurl() or ezroot() operator
      • pass first parameter (quote type ) as a variable, like:
        {def $quotingStyle = 'single'}
        SOME_URL|ezurl( $quotingStyle )
        
      • the operator does not respect the parameter.
      • disable the ``TemplateCompile'' in site.ini; the parameter is being respected.

      Attachments

        Activity

          People

            rl rl
            dexen dexen
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: