[Pmwiki-users] Code Cleanup
Patrick R. Michaud
Tue Jun 8 19:47:49 CDT 2004
On Tue, Jun 08, 2004 at 04:12:28PM +0200, Ben Hochstrasser wrote:
> I noticed that there are a number of references to deprecated php variables
> (such as HTTP_SERVER_VARS) or implementation-specifics (PATH_INFO sometimes
> shows up as ORIG_PATH_INFO) etc.
The deprecated variables don't occur at all in the new version of the code,
and 0.6 phases a lot of them out.
> IMHO it would be a good idea to move these functions into a module of its own
> where it can be user-overridden (to easily adapt to the web server or the php
> version) and won't be overwritten in the next version.
> What do you think?
Too much overhead and indirection, I think. Most of these things can
already be fixed by local customizations--I can't think of any realistic
examples that aren't fixable in this way. For example, if someone
gets a version of PHP that no longer supports $HTTP_SERVER_VARS, it's a
simple local customization to do
$HTTP_SERVER_VARS = &$_SERVER;
and everything's okay again.
In general I tend to make sure that each release of PmWiki is
compatibile with the latest version of PHP, so as deprecated functions
are removed from new releases of PHP, I update the pmwiki.php code
to account for this. At the same time, I want to maintain compatibility
with older versions of PHP back to 4.1.0, so I try not to use any
features of PHP that weren't available in 4.1.0.
However, I think it may be a very good optimization to have PmWiki use
functions that occur in later releases and provide "replacement"
versions of those functions for the earlier releases that do not have
them. For example, file_get_contents() was introduced in 4.3.0, so
it'd be simple to have PmWiki have a "compatibility module" that
is called as needed to define file_get_contents() and other functions
for versions of PHP that don't have it.
More information about the pmwiki-users