Re: Net_URL -- Re: [PEAR-DEV] Some bugs in SOAP and Archive::TAR

From: Date: Fri, 04 Apr 2003 20:22:37 +0000
Subject: Re: Net_URL -- Re: [PEAR-DEV] Some bugs in SOAP and Archive::TAR
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-14899@lists.php.net to get a copy of this message
On Fri, 4 Apr 2003, Shane Caraveo wrote: > So why do you think it's absolutely right the way it is? > > A simple reproduction of this problem is: > > $HTTP_SERVER_VARS['HTTP_HOST']='localhost:8080'; > $url = &new Net_URL('š'¦EÊ` > 0&}˜Þ™ï˲http://www.example.com/foo/bar/index.php?foo=bar'); > print $url->getUrl(); > > So my argument comes down to, any use of $HTTP_SERVER_VARS in the > constructor is incorrect and should be removed. A subclass of Net_URL > can provide the local url if that functionality is needed by people. > But Net_URL needs to be generic. It effects any class that uses it, > such as HTTP_Request. Must say I agree on this one. Here is another example: <?php require_once('Net/URL.php'); $HTTP_SERVER_VARS['PHP_SELF'] = '/foo/bar/index.php?foo=bar'; $url = &new Net_URL('http://www.example.com'); print $url->getUrl(); ?> the output is http://www.example.com/foo/bar/index.php?foo=bar When you would excpect http://www.example.com or http://www.example.com/ To put it another way. If you give an url without a trailings slash the $PHP_SELF of current page will be added to the url. -- Mika Tuupola http://www.appelsiini.net/~tuupola/

« previous php.pear.dev (#14899) next »