struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yasser Zamani (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (WW-4848) The if test can accidently incorrectly assign a new value to an object
Date Wed, 06 Sep 2017 17:27:00 GMT

    [ https://issues.apache.org/jira/browse/WW-4848?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16155617#comment-16155617
] 

Yasser Zamani edited comment on WW-4848 at 9/6/17 5:26 PM:
-----------------------------------------------------------

[~lukaszlenart], five days ago I researched what we can do with this then I saw and studied
your mentioned above link. That link does not confirm that {{if (a = 0)}} is correct in java
but say only {{if (a = true)}} is ok because it's condition could be evaluated to a boolean.
{{if (a = 0)}} could not be compiled by java (but C++ can).

I think [~alancomeau] is right. It may is more nice to keep java specs in {{if}} tag too.
I think I can resolve this but I just was worry about backward compatibility and what spec
we want to keep with {{if}} tag, C++ or java. So I decided to wait for your comment on this
issue.


was (Author: yasser.zamani):
[~lukaszlenart], five days ago I researched what we can do with this then I saw and studied
your mentioned above link. That link does not confirm that {{if (a = 0)}} is correct in java
but say only {{if (a = true)}} is ok because it's condition could be evaluated to a boolean.
{{if (a = 0)}} could not be compiled by java (but C++ can).

I think [~alancomeau] is right. It may is more nice to keep java specs in OGNL too. I think
I can resolve this but I just was worry about backward compatibility and what spec we want
to keep with OGNL, C++ or java. So I decided to wait for your comment on this issue.

> 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
>            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)

Mime
View raw message