Code that worked for years suddenly glitches - CF2021 > CF2023
Hello, everyone.
About a week ago, our SA and DBA started a migration from CF2021 to CF2023, we are experiencing a couple of odd issues, and the weird thing is - it's limited to just one project. No other projects are experiencing these issues. The issue is in our custom built Workflow application.
One issue is with setting an identifier for a user using data pulled from the user's Common Access Card (CAC). We are pulling the DoDID (lastName.firstName.middleName[.cadenceName].EPIDnumber) and I'm getting the 10 digit EPID from this string that is in the CGI scope.
<cfset session.userepid = REMATCH("\d{10}",cgi.SSL_CLIENT_S_DN_CN)[1] />The number that is in the DoDID can be either a 10 digit number, or a 16 digit number. So I'm looking for all 10 digit numbers and taking the first position in the array as the desired number. This is the actual EPID. But I'm getting an error that position 1 of the array doesn't exist. I can output the whole DoDID before that point, do the rematch and get an array length of 1 from my CAC, and abort the page - it works. But as soon as I comment out that added code and abort, it gets to the above line in the code section and throws an error saying that it can't find anything in the array. Stops processing.
Another issue we are having has to do with DateDiff. For years, we've been converting the dates pulled from the database using to_char(dateObject, 'YYYY-MM-DD'). But we are getting an error stating that the value supplied to the cfoutput is "unspecified or invalid". Dumping the data shows all dates in the query are proper dates. Only thing I can think of is maybe CF2023 handles empty dates differently than CF2021 does??
Any thoughts appreciated.
V/r,
WolfShade
UPDATE: My DBA suggested I use ParseDateTime() around the values. I did, and the first date wasn't an issue - it worked - but the second date threw an error for ParseDateTime() (no end date had been entered, and CF didn't like '' as a value.) I placed a cfif around it so it would process the second date ONLY if there was a value other than '', and that worked.
But when it got to DateDiff, that error happened. Apparently it doesn't like that second date being a blank/null. This has been working with no problem for years. Why it suddenly flips out over a blank date ...
