A very weird problem, but in a specific channel that has many custom fields I get a very peculiar problem with just one entry (as far as I can tell) where a particular custom field is failing only inside an if statement. Example:

{if my_custom_field}

This causes the entire template to fail, resulting in a white screen. I've switched on every form of debugging (index file and admin area). There are no errors.

If I remove the if statement and simply output the field, it works fine. If I empty the field it works fine. If the field has only up to ~67 characters in it, it works fine.

Please bear in mind, this is only a problem with this entry; other entries don't experience this issue.

Things I've tried:

  • Creating a new entry with the same data
  • Rewriting the content of this field by hand (not copy-pasting in case of a malformed character)
  • Renaming the custom field
  • Adding the same content to a different field
  • Reducing the number of if statements in the template
  • Increasing the memory available to PHP

So my question really is: has anyone ever come across this before? Where can I look to solve it?

1 Answer 1


It could just be a quote or other glyph in the field which terminates the conditional early.

I wrote a little add on which might help you here. It will return the length of a given field so you can run your conditional check on that number rather than using the entire field contents.

  • Thanks @foamcow. I've rewritten the entire copy from scratch on a new entry and it still occurs, so can't see how it would be an odd glyph. There are no quotes or other characters that I'd imagine could hinder the execution of the {if} Will check out your add-on at some point. Thanks for that!
    – simonhamp
    Commented Nov 10, 2014 at 17:15

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.