[
https://issues.apache.org/jira/browse/WW-4848?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16165862#comment-16165862
]
Yasser Zamani commented on WW-4848:
-----------------------------------
At first I thought too but then I saw it doesn't work in some more complex
right expressions like {{(user.age = newAgeFromStack) < 18}} :) Then I saw that
fortunately OGNL has a static public method {{parse}} and according to my
defined above {{isBooleanExpression}} method, I'm going to
{{if(!isBooleanExpression(ognl.parse(testExpression)) warn}}.
> The if test can accidently incorrectly assign a new value to an object
> ----------------------------------------------------------------------
>
> Key: WW-4848
> URL: https://issues.apache.org/jira/browse/WW-4848
> Project: Struts 2
> Issue Type: Bug
> Affects Versions: 2.5.13
> Reporter: Alan Comeau
> Priority: Minor
> Fix For: 2.5.14
>
>
> The {{s:if}} tag has the side effect of assigning to an existing object
> if the comparison is badly formed using {{=}} instead of {{==}}
> {code:html}
> <s:if test="user.id = 0">
> //at this point the user.id is now 0 not its original value
> </s:if>
> {code}
> even though this is clearly badly formed, the test should not assign anything
> to the object
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)