From:             mfsole at hotmail dot com
Operating system: Linux
PHP version:      5.3.13
Package:          URL related
Bug Type:         Feature/Change Request
Bug description:All ports greater than 65535 in parse_url

Description:
------------
Currently the parse_url function only recognizes ports from 0-65535.
Firstly this 
isn't really documented on the site. Secondly, while it is true that valid
port 
numbers for http requests are less than 65535 there are other types of URLs
which 
have port numbers that can exceed that limit. This is very common in the
SMS world 
as the port number is used to indicate short code. Here is an example:

ctpp://ericsson:78325/?carrier=31003&address=2125551212

I don't see any real benefit to limiting the port number, more over the
function 
appears to arbitrarily rewrite the port number. So the above example gets
reported 
as 12789.

Best case scenario would be to just allow numbers of any size. PHP is
understood 
to be loosely type so enforcing type here is inconsistent. At the very
least 
document the behavior on the site (I will add post to the function for
others). 

Test script:
---------------
<?php
$url = 'ctpp://ericsson:78325/?carrier=31003&address=2125551212';
$parsedURL = parse_url($url);
var_dump($parsedURL);



Expected result:
----------------
array (size=5)
  'scheme' => string 'ctpp' (length=4)
  'host' => string 'ericsson' (length=8)
  'port' => int 78325
  'path' => string '/' (length=1)
  'query' => string 'carrier=31003&address=2125551212' (length=32)

Actual result:
--------------
array (size=5)
  'scheme' => string 'ctpp' (length=4)
  'host' => string 'ericsson' (length=8)
  'port' => int 12789
  'path' => string '/' (length=1)
  'query' => string 'carrier=31003&address=2125551212' (length=32)

-- 
Edit bug report at https://bugs.php.net/bug.php?id=62159&edit=1
-- 
Try a snapshot (PHP 5.4):            
https://bugs.php.net/fix.php?id=62159&r=trysnapshot54
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=62159&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=62159&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=62159&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=62159&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=62159&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=62159&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=62159&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=62159&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=62159&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=62159&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=62159&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=62159&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=62159&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=62159&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=62159&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=62159&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=62159&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=62159&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=62159&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=62159&r=mysqlcfg

Reply via email to