[pmwiki-devel] ResolvePageName() before config.php

Peter Bowers pbowers at pobox.com
Mon Apr 20 01:27:47 CDT 2009

I see that

   $pagename = ResolvePageName($pagename);

is placed at the top of scripts/stdconfig.php which is "called"
immediately *after* config.php.

However, I note that in *many* recipes the installation instructions
refer to $pagename extensively.  This means, for instance, that
$pagename could contain a slash instead of a period.  Thus a
conditional such as

if ($pagename == 'GroupA.PageB')

could end up false simply because the user entered their URL using
?n=GroupA/PageB instead of ?n=GroupA.PageB (or using cleanURLs in
certain circumstances similarly).

Although I haven't verified the other possible problems, it appears
that $pagename could have several other erroneous types of values
(default not yet set, incorrect capitalization, invalid characters,
etc.) that are all carefully checked in ResolvePageName() but not
until after config.php...

As I looked at other recipes I see that some recipe authors have
resolved this by calling ResolvePageName() themselves.  This works and
I can go the same route, but it feels very inelegant (redundant
processing, etc.)

Wouldn't it make better sense to call ResolvePageName() *before*
config.php is included?  Is there a down-side to this?


More information about the pmwiki-devel mailing list