Arbit - project tracking

Dwoo

#46: Incorrect substitution of 'not'

Issue revisions

  • new by Alex Butter at 2009-O-21 12:01
  • assigned by Jordi Boggiano at 2010-J-21 0:29
  • closed by Jordi Boggiano at 2010-J-21 0:31
Type bug bug
State closed closed
Priority normal normal
Resolution fixed fixed
Assigned to Jordi Boggiano
Scheduled for 1.2.0
Affected versions
Affected components Core
Last change Thursday 21 January 2010 00:31:02 UTC by Jordi Boggiano

The following shows an interesting and incorrect substitution of the word not when used as a string.

<pre> <option value="3 month"{if $post.travelling_when=='3 month'} selected="selected"{/if}>{trans "Within three months"}</option> <option value="not"{if $post.travelling_when=='not'} selected="selected"{/if}>{trans "Not in the near future"}</option> </pre>

The section @{if $post.travelling_when=='not'}@ is compiled to @<?php if ((isset($this->scope["post"]["travelling_when"]) ? $this->scope["post"]["travelling_when"]:null) == !) { ?>@

The string 'not' should be compiled as 'not' and not ! (erm...)

  • Jordi Boggiano at Thursday 21 January 2010 00:31:02 UTC

    That was a pretty nasty one to fix, but it's done, fixed in revision #329 of trunk. It will be released in 1.2.0 but feel free to use svn trunk until then.

    And btw, the behavior was sort of normal, it's smarty compatibility crap so that you can write {if not $foo} for example, but since unquoted strings are matched as valid strings it was replacing both.