We have a client who recently moved from CF5 to CF7. We did all the normal things you would do during a migration like this.
So I was a little miffed when their automated email script wasn’t working properly. I checked the code and at first thought it was an issue with the SQL query but after about 40 minutes of poking around that turned out not to be the case. So I commented out the cfmail tags, threw in some cflog tags and started to look at the code as it executed (I’ve become a huge fan of the cflog tag).
After the first run through I immediately saw the issue. Because of the large number of subscribers requesting the emails, we write a portion of the email to a text file and store it on the server so we can retrieve it later on in the code. These text files are typically deleted and recreated at the start of the scheduled task. My log messages were telling me that we were skipping the first two files, one of which happened to be the body of the emails I was investigating.
Further digging into the code I found where the CF5 developer had diligently coded his query loop to start at row 3. I had an idea why this was, but it wasn’t till I talked to a developer in my shop with actual experience in CF5 that my suspicion was confirmed. In CF 5 if you looped over a directory list, you had to start at row 3, because row 1 was ‘.’ And row 2 was ‘..’, BUT in CF 6 & 7 this was changed so the ‘.’ and ‘..’ are ignored. This is something I didn’t realize during the migration and it’s not something the code analyzer would not catch since the code is legitimate.
So, a word to the wise, if you’re upgrading from CF5 do a quick search on your code for “ startrow=’3’ ” and see if maybe those attributes need to be removed.
Comments (0)