PHP-OpenID-0.0.8.1 released

ctd1500 ctd1500 at gmail.com
Thu Sep 8 09:02:30 PDT 2005


On 9/8/05, Dan Libby <dan at osc.co.cr> wrote:
> ctd1500 wrote:
> 
> >You seem to have used non-working code, in place of the patch I sent
> >in yesterday.
> >
> >
> This is true.  My bad.  I was literally running out the door to catch a
> plane, so I did not have time to test my fix.  I'll try not to release
> any more untested patches.
> 
> I appreciate your patch, but I chose to provide an alternative ( and
> unfortunately faulty ) implementation because:
> 
> a) PCRE extension ( preg_* ) is not available on all PHP installations.
> So for maximum compatibility, I would need to provide an alternative
> implementation anyway.  From PHP manual:   "Beginning with PHP 4.2.0
> these functions are enabled by default. You can disable the pcre
> functions with --without-pcre-regex."  I am targetting PHP >= 4.1.0.
> ( I realize that PCRE is used in a couple other places in the code, but
> I'm trying to minimize / workaround that. )
> 
> b) I did not understand exactly what your regex does, and what failure
> cases might exist.  An explanatory comment would help.
> 

        if (!preg_match("#(http(s)?)://.+/#is", $url)) {
            $url .= "/";
        }

It checks for "http://www.url.com/", or "https://www.url.com/", if it
can't find a "/" anywhere behind the url, then it adds one to the end.

It could also be done like this:

        if (!preg_match("#(http(s)?|ftp)://.+/#is", $url)) {
            $url .= "/";
        }

That will parse the url for "http://", "https://", or "ftp://" and
looks for a "/" after the url, if none exists, then it adds one.


More information about the yadis mailing list