Click to See Complete Forum and Search --> : PHP Version Depandancy Checker


Brendan Nolan
01-19-2004, 05:46 AM
I have spent the last few hours looking for a piece of software that might be able to parse a PHP file, following all includes etc and report the versions of PHP and platforms that the script will work on, and any librarys that are requred.

I didn't find one.

Does anybody know of something similar?

If not, maybe we should begin a project that would do this for us.

It would be an incredibly useful tool, although I can see some major hurdles...

jayant
01-19-2004, 01:49 PM
not a difficult one to make.

LordShryku
01-19-2004, 03:38 PM
phpversion is a built in command to tell you the version in use

Moonglobe
01-19-2004, 07:45 PM
he means a version dependancy thing LS

LordShryku
01-19-2004, 07:46 PM
sure, but with one of those, you'll need to know the current version in use. Plus the user comments on that page give some insight into building one.

Brendan Nolan
01-19-2004, 09:15 PM
Originally posted by jayant
not a difficult one to make.

I think that it would be difficult.

It would need to know what releases functions were first released in, it would need to check if the script uses optional paramaters that were added in later versions of the function. It would also need to follow all included files...

It would basically need a database of all version information of all the funtions in PHP...

I have no idea even how to find all of the functions in the scripts being parsed... I am guessing some horribly complicated regular expressions.

There are other things to consider too, such as register_globals, when the superglobals came out.

Really it is huge.

Moonglobe
01-19-2004, 09:19 PM
anyone who's still using PHP < 4.3.0 should be shot. seriously, why. if they are people shouldnt be using them for PHP stuff. currently i just write for PHP5 and dont care about anything else, but then i'm not getting paid am i...

Weedpacket
01-19-2004, 10:23 PM
Originally posted by Brendan Nolan
I think that it would be difficult.

It would need to know what releases functions were first released in, it would need to check if the script uses optional paramaters that were added in later versions of the function. It would also need to follow all included files...

It would basically need a database of all version information of all the funtions in PHP...Neither of those tasks is difficult; the manual says which versions of PHP have which functions/parameters.

I have no idea even how to find all of the functions in the scripts being parsed... I am guessing some horribly complicated regular expressions.It depends on which versions of PHP this dependency checker is supposed to run, but PHP4.3 exposes its tokeniser, so that task is out of the way.

There are other things to consider too, such as register_globals, when the superglobals came out.RTFM, again. One can also read the changelogs for higher resolution.

Weedpacket
01-20-2004, 12:39 AM
What would make the job choke is later-version stuff being used in early-version files. There was nothing to stop you using a function named function_aggregate in v4.1, or an array called $_POST[] in v4.0 - it would have been an ordinary bog-standard array variable.

So just because a program uses $_POST[] doesn't mean it's for version 4.1 or later; it might be a pre-4.1 script that breaks in later versions.

To tell the difference is ultimately (I strongly suspect) uncomputable, and hence not something that an automated tool could be written for.