Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.0.15

Bug #3159 Net_URL::setProtocol calls getStandardPort() incorrectly
Submitted: 2005-01-11 04:03 UTC
From: davey Assigned: richard
Status: Closed Package: Net_URL
PHP Version: 5.0.3 OS: WinXP SP2
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 3 + 17 = ?

 
 [2005-01-11 04:03 UTC] davey
Description: ------------ When calling Net_URL::setProtocol() without the second argument, it fails to pass the protocol var to Net_URL::getStandardPort() - resulting in a warning. Reproduce code: --------------- <?php $net_url = new Net_URL('fix.php'); $net_url->setProtocol('http'); var_dump($net_url->getUrl()); ?> To fix, simply change: $this->port = is_null($port) ? $this->getStandardPort() : $port; To this: $this->port = is_null($port) ? $this->getStandardPort($this->protocol) : $port; on line 406 (in CVS revision 1.37, release 1.0.14) or line 287 in revision 1.38 - CVS HEAD) Expected result: ---------------- string(24) "http://localhost/fix.php" Actual result: -------------- Warning: Missing argument 1 for Net_URL::getStandardPort() in c:\pear\pear\Net\URL.php on line 383 string(25) "http://localhost:/fix.php"

Comments

 [2005-03-02 03:05 UTC] richard
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on pear.php.net. In case this was a pear.php.net website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better.