Details
-
Bug
-
Resolution: Fixed
-
Medium
-
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.