I figured out the problem. The code has data after the actual upgrade section (first 600ish lines). At then end of the upgrade part there is a call to exit() which pre php 5 would have stopped it from looking at the declarations below. But now it does so it was seeing the same functions declared below. This is easily fixed by cutting out that bottom part, putting it in a separate file and changing one line of the code to read in that new file for the data instead of the same file as the upgrade code.