IsNumeric returns True on strings like "3d" and "6f" (5.3.8 regression!)

Description

The change done for tickets and LDEV-2353, which is already deployed as a RC in 5.3.8.47, introduces a new bug for `isNumeric()`.

When the string to test ends with a ā€œdā€ or an ā€œfā€ (a java type qualifier for Double / Float), `isNumeric()` will now return true.

Before this change, it returned False (tested with trycf.com on 5.3.7 and 4.5, and ACF 2021)

Code to test:

Output on Lucee 5.3.8.139-RC:

Environment

all

Activity

Show:
Pothys - MitrahSoft
March 8, 2021, 9:55 AM

I've checked this ticket with fixed versions and this issue was fixed. So I close this ticket.

Paul Klinkenberg
March 5, 2021, 6:38 PM

Awesome @Michael Offner ! Everything looks good now, as far as I can read the code on my mobile.

And p.s.: Hi buddyšŸ‘‹ Long time no see šŸ˜

Michael Offner
March 5, 2021, 6:15 PM

I extended the existing isNumber function and removed the addional independent check, i also added all test cases.

Paul Klinkenberg
February 16, 2021, 4:25 PM

I was checking this commit, and with that, the actual implementation. I see there are 2 different isNumeric() implementations, which both try to do the same, but in a completely different manner:

  • isNumber(String str):

  • isNumber(Object value):

Worse even, the implementation isNumber(String str) still does not allow for a negative exponent, like 3e-5, if I read the code correctly.

My suggestion would be, to start using just one of the 2 implementations, and remove the other one.

If using the string parser, you could add a few tests for the things tested in this function, eg.

Pothys - MitrahSoft
February 16, 2021, 2:58 PM

I added a fix and testcase for this ticket.

Pull request: https://github.com/lucee/Lucee/pull/1193

Fixed
Your pinned fields
Click on the next to a field label to start pinning.

Assignee

Pothys - MitrahSoft

Reporter

Paul Klinkenberg

Priority

Major

Labels

Fix versions