Note that there are some explanatory texts on larger screens.

plurals
  1. POFreemarker ".vars" names can't contain dashes?
    primarykey
    data
    text
    <p>We're using Freemarker version 2.3.16, and I've just tracked down a weird bug in one of our apps. It came down to there now being hyphens in some of our product code strings. The codes are used to pull hashes of localized text from the global scope using <code>.vars</code>. </p> <p>Reducing the issue brought me to an example that anyone can try: </p> <ul> <li><p><code>${.vars["foo-bar"]}</code> in a template outputs <code>0</code></p></li> <li><p><code>${.vars["foo+bar"]}</code> outputs <code>nullnull</code> </p></li> <li><p><code>${.vars["foobar"]}</code> correctly triggers an InvalidReferenceException</p></li> </ul> <p>All three should trigger exceptions. Instead, it appears the <code>.vars</code> parameter string is being evaluated! :-(</p> <p><a href="http://freemarker.sourceforge.net/docs/app_faq.html#faq_strange_variable_name" rel="nofollow">http://freemarker.sourceforge.net/docs/app_faq.html#faq_strange_variable_name</a> implies this should work. </p> <p>I saw mention of a similar issue a few weeks ago on the Freemarker mailing list, and it was suggested to prefix the parameter string with "@". That might work with other hashes, but it does NOT work with <code>.vars</code>. I just took a working example (<code>.vars["resources_title"]</code>) and changing it made it throw an InvalidReferenceException (<code>.vars["@resources_title"]</code>). I also tried it on the hyphenated reference, and it also threw the exception.</p> <p>Upgrading to 2.3.18 did not seem to make a difference.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload