Forum Discussion

micha80's avatar
micha80
Expert
8 years ago

specific user error on custom component

We created a custom component for the users settings which was working fine for a long time. But for some weeks now some users are complaining about that the widgets aren't loading on this specific page. We had a deeper look into it but we are not able to reproduce this issue either on stage nor on production.

 

So we created a test output for only admin users on production to call the users profile which have these issue. And for some reason we get an FreeMarker template error for these users, if we try a different user id everything is working as expected. We also compared the results from the restapi call but still have no clue what is causing the issue. All we’re trying to do is the following:

 

 

 

<#assign userProfiles=restadmin("/users/id/45993/profiles?restapi.response_style=json") />
<#assign profiles><@xmltohash xml=userProfiles.profiles.profile /></#assign>
<#assign profiles=profiles?eval />

 

 

The issue occurs on the third line:

 

 

FreeMarker template error (HTML_DEBUG mode; use RETHROW in production!)

Failed to "?eval" string with this error:

---begin-message---
Syntax error in ?eval-ed string in line 3, column 54:
Encountered "Kunden", but was expecting one of:
    ".."
    <DOT_DOT_LESS>
    "..*"
    ","
    "}"
    "."
    "["
    "("
    "?"
    "!"
    <TERMINATING_EXCLAM>
    "??"
    "+"
    "-"
    "*"
    "/"
    "%"
    "!="
    "="
    "=="
    ">="
    <ESCAPED_GTE>
    ">"
    <ESCAPED_GT>
    <LESS_THAN_EQUALS>
    <LESS_THAN>
    <AND>
    <OR>
---end-message---

The failing expression:
==> profiles?eval  [in template "custom.cb.settings-page" at line 248, column 21]

----
FTL stack trace ("~" means nesting-related):
    - Failed at: #assign profiles = profiles?eval  [in template "custom.cb.settings-page" at line 248, column 3]
----

 

Anyone an idea whats going on here?

 

Thanks in advance

Christian

 

  • ChiaraS's avatar
    ChiaraS
    Lithium Alumni (Retired)

    Did you check if Toolbox on production gives more details around the error?

    Also, not sure why you're requesting json from the rest api and then calling an "xmltohash" function, but looks like what you're generating is not a valid FreeMarker hash and therefore ?eval fails.

    If you have an admin account, you can perform the rest call and compare the output for an affected user with the one that is working...

    • micha80's avatar
      micha80
      Expert

      Yes, as written above we already compared the rest call with other users but we couldn't see any difference.

       

      I don't know why it has been implemented that way, but it was working as it is for a long time. We just don't understand why we are getting this error for a minor group of users now. 

      • ClaudiusH's avatar
        ClaudiusH
        Khoros Alumni (Retired)
        Could it be that part of profile info of the affected users is interpreted as relevant characters for the conversion to XML? E.g. it could be that their signature contains XML or other code.