struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alan Comeau (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (WW-4848) The if test can accidently incorrectly assign a new value to an object
Date Wed, 13 Sep 2017 21:37:00 GMT

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

Alan Comeau commented on WW-4848:
---------------------------------

I understand the reasoning behind the decision, and to a certain extent I agree.
However I wonder if this type of expression  could at least cause a log message to be generated,
Alternatively have a constant to disallow this type of expression which is defaulted to off
(allow it), but gives the developers to avoid deliberately shoot themselves in the foot.

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

Mime
View raw message