Home » Networking » Net_URL2 » Bug #7538
URLs without "http" confuse Net_URL
Details
| Request #7538 | URLs without "http" confuse Net_URL |
|---|---|
| Submitted | 2006-05-01 21:06 UTC |
| From | jbutler at ua dot edu |
| Assigned | davidc |
| Status | Wont fix |
| Package | Net_URL2 |
| PHP Version | 4.3.2 |
| OS | Redhat Linux |
| Roadmaps | (Not assigned) |
Comments
[2006-05-01 21:06 UTC] jbutler at ua dot edu
Description:
------------
If a URL does not begin with "http" or similar protocol, then Net_URL gets confused. This makes it tricky to use it when, for example, accepting user-suggested URLs entered into a form. Ideally, Net_URL might check to see if it's a valid URL before parsing it.
Test script below was run on the host, http://www.allthingsacoustic.org, which winds up inserted as the server.
Test script:
---------------
<?php include('Net/URL.php');
$url = &new Net_URL('www.goob.com');
?>
<html>
<body>
Protocol...: <?=$url->protocol?>
Server.....: <?=$url->host?>
Port.......: <?=$url->port?>
File/path..: <?=$url->path?>
Full URL...: <?=$url->getUrl()?>
</body>
</html>
Expected result:
----------------
Protocol...:
Server.....: www.goob.com
Port.......:
File/path..:
Full URL...: http://www.goob.com/
Actual result:
--------------
Protocol...: http
Server.....: www.allthingsacoustic.org
Port.......: 80
File/path..: /tifrl/Net_URL/docs/www.goob.com
Full URL...: http://www.allthingsacoustic.org/tifrl/Net_URL/docs/www.goob.com