int() silently truncates large numbers in Lucee 7

We hit a silent data corruption issue upgrading from Lucee 5 to Lucee 7 involving the int() function.

Reproduction
writeDump(int(1771804800000));

  • Lucee 5: returns 1771804800000 (correct)
  • Lucee 7: returns 2147483647 (silently clamped to Integer.MAX_VALUE)

Root cause
In Lucee 5, int() used Math.floor() which returns a Java double (capable of representing integers up to 2^53 without loss).
In Lucee 7, int() now routes through Caster.toIntValue() which calls n.intValue(), a narrowing cast to a 32-bit Java int. Any value above Integer.MAX_VALUE (2,147,483,647) is silently corrupted.

Impact
In our case, we were parsing epoch millisecond timestamps from an external API. The corrupted value was then written to a database as a date in the year ~563,432 with no error raised anywhere in the chain.

thanks, bug filed

https://luceeserver.atlassian.net/browse/LDEV-6123