Strategies for removing register_globals from a file

Posted by Jonathan Rich on Programmers See other posts from Programmers or by Jonathan Rich
Published on 2013-06-21T20:59:04Z Indexed on 2013/06/26 10:28 UTC
Read the original article Hit count: 238

Filed under:
|
|
|

I have a file (or rather, a list of about 100 files) in my website's repository that is still requiring the use of register_globals and other nastiness (like custom error reporting, etc) because the code is so bad, throws notices, and is 100% procedural with few subroutines.

We want to move to PHP 5.4 (and eventually 5.5) this year, but can't until we can port these files over, clean them up, etc. The average file length is about 1000 lines.

I've already cleaned up a few of the low-hanging fruit, however the job took almost an entire day for 2 300-500 line files. I am in a quagmire here (giggity).

Anyway, has anyone else dealt with this in the past? Are there any strategies besides tracing backwards through the code? Most static analysis tools don't look at code outside of functions - are there any that will look at the procedural code and help find at least some of the problems?

© Programmers or respective owner

Related posts about php

Related posts about Maintenance