https://issues.apache.org/bugzilla/show_bug.cgi?id=52666

             Bug #: 52666
           Summary: EL should coerce String to Integer in equals operation
           Product: Tomcat 7
           Version: 7.0.25
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Jasper
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: knst.koli...@gmail.com
    Classification: Unclassified


This issue was reported on the users@ list, thread:
"EL String -> int coercion stopped working after TC 5.5 -> 7.0 upgrade?"

http://tomcat.markmail.org/thread/a7l45meiakblxcvz
http://marc.info/?t=132918931400002&r=1&w=2

Original reporter used <c:out> tag, but it is not necessary to reproduce the
issue.

The issue is reproducible in current 7.0 and 6.0. It works correctly in 5.5.35.

To reproduce,
1. save the following JSP page as ROOT/test.jsp
[[[
${param['foo'] == 1}<br>
${1 == param['foo']}<br>
${1 == (0+param['foo'])}<br>
]]]

2. go to http://localhost:8080/test.jsp?foo=01

Expected result:
true
true
true

Actual result:
false
false
true

This happens for foo=01, 001 etc. The equals result happens only when foo=1


According to EL 2.2 specification chapter 1.8.2 the ==,!= operators have the
following step: "If A or B is Byte, Short, Character, Integer, or Long coerce
both A and B to Long, apply operator". This step should happen earlier than
coercion to String.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to