We have a Matrix that has a simple text input in the first column, and another text input in the second column. First column is for a link title, second column is for a URL. This is the stripped down code we're using to display this information on the template, showing the title if there is one:

{if "{link_field:total_rows}" >= 1}
  <h4>{title} Links</h4>

      <a href="{link_url}">{if link_title}{link_title}{if:else}{link_url}{/if}</a>

Very simple: if there are any rows, output the h4, open a UL, loop through the rows (outputting a title if there is one, otherwise outputting the URL), close the UL, done.

The issue is that the simple "if" conditional is breaking things, especially if there is any text in the first column that resembles user-related global variables (email, screen_name, username). Those are actually getting parsed - even though there are no braces.

For example, a link title might read "Send email to user-selected recipient". The 'email' there is getting parsed (and getting double quotes added) so the field reads (using my email address): "Send "[email protected]" to user-selected recipient". That being the case, it's going into the {if link_title} conditional statement and breaking, so that the template returns a parse error:

Parse error: syntax error, unexpected T_STRING in /.../system/expressionengine/libraries/Functions.php(680) : eval()'d code on line 649

If we just output {link_title} outside of a conditional, it outputs the text in the field as I'd expect. Another odd thing we notice is that if we put a plus sign "+" in the first column, the template breaks as well.

Doesn't seem to make a difference how we do that conditional:

{if link_title}
{if link_title != ''}
{if "{link_title}"}
{if "{link_title}" != ''}

Has anyone run into this? This site is on EE 2.5.2. We just updated and tested with latest version of Matrix (2.5.3), so the add-on version doesn't seem to matter.

  • {if '{link_title}'} works, but then breaks on any single quotes inside of {link_title}. Commented Mar 12, 2013 at 17:10
  • Ryan, have you checked if those variables are getting parsed in a normal textarea? There are some standard global variables that can be used in those entries, and you may be running into them...
    – Lisa
    Commented Mar 12, 2013 at 17:38
  • it looks like it's intended behavior by EE -- the matrix field outputs the string "Developer email address" (as an example), then we did a conditional of {if "developer email address"} -- since global variables are just about the last thing parsed, it parsed email to be the addon developer's email, resulting in a conditional of {if "developer "[email protected]" address"}, causing a php error. Commented Mar 12, 2013 at 17:52
  • That's sort of lousy news. All anyone has to do is enter any of a handful of "reserved" variable names (and such a common word like "email" - it's unfortunate that isn't prefixed with anything like exp_email, for example) and we output that variable in a conditional and boom, broken template(s). We'll have to police every entry. Commented Mar 12, 2013 at 20:13
  • In this case, the word "email" doesn't even have braces on it - perhaps because it is showing up inside the "if" statement, EE sees it as having braces and tries to parse it? Commented Mar 12, 2013 at 20:21

1 Answer 1


There were some weird conditional bugs in 2.5.2 that got fixed - may be worth upgrading:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.