dot characters, extensions and PHP

Keith Grennan keith at sxip.com
Tue Aug 1 07:19:53 UTC 2006


Hello all,

Working with OpenID in PHP, I noticed that PHP replaces any dots
in incoming variable names to underscores.

http://ca.php.net/manual/en/language.variables.external.php#language.variables.external.dot-in-names

I see that the JanRain code works around the problem by mapping the
underscores back to dots, however I could see this being a nuisance for
extensions.  E.g.:

openid.ns.x=http://example.com/ext/1.0 
openid.x.foo=1

would appear to a PHP app as:

openid_ns_x=http://example.com/ext/1.0 
openid_x_foo=1

So the mapping function will have to be more sophisticated - first
replacing all /^openid_/ with 'openid.' (the library does this
currently), then parsing out all the namespace aliases and replacing all
/^openid\.$ns_/ with 'openid.$ns.'.

But it's still possible to construct two legal namespace aliases that
collide for PHP apps.  E.g.:

openid.ns.x=http://example.com/ext/1.0 
openid.ns.x_foo=http://example.com/foo/1.0

Also you might have collisions with other OpenID protocol keys that
contain underscores (E.g. namespace aliases like 'user', or 'trust'
could collide with 'openid.trust_root' and 'openid.user_setup_url').

For these reasons it might make sense to say that namespace aliases MUST
NOT contain an underscore, although I know it sucks to make comprimises
for the sake of a particular language's limitations.

In any case this is something to watch out for if you are using OpenID
and PHP.

Cheers,
Keith


More information about the yadis mailing list