http://kthx.net/ftb

Read the guide and find out how to narrow down your script and find the exact line that is failing or behaving differently in 7.x. Then you can ask why that line is behaving differently (if you still don't know)