Edit report at https://bugs.php.net/bug.php?id=64754&edit=1

 ID:                 64754
 Comment by:         mail+php at requinix dot net
 Reported by:        jia dot cheng dot wu at gmail dot com
 Summary:            pathinfo bug handling extra "."
 Status:             Open
 Type:               Bug
 Package:            Filesystem function related
 Operating System:   WINDOWS 7
 PHP Version:        5.3.24
 Block user comment: N
 Private report:     N

 New Comment:

pathinfo() is for filenames. Use parse_url() for URLs.


Previous Comments:
------------------------------------------------------------------------
[2013-05-02 05:45:38] jia dot cheng dot wu at gmail dot com

Description:
------------
Array returned by function pathinfo() contains wrong values when extra "." is 
introduced in the parameter, even though "." is a valid character of a query 
string.

Test script:
---------------
<php?
$test_url = "/test.php?q=".urlencode("hello this is a test 1.0");
echo "test_url:".$test_url.PHP_EOL;
var_dump(pathinfo($test_url));
?>

Expected result:
----------------
test_url:/test.php?q=hello+this+is+a+test+1.0
array(4) {
  ["dirname"]=>
  string(1) "\"
  ["basename"]=>
  string(35) "test.php?q=hello+this+is+a+test+1.0"
  ["extension"]=>
  string(26) "q=hello+this+is+a+test+1.0"
  ["filename"]=>
  string(4) "test"
}


Actual result:
--------------
test_url:/test.php?q=hello+this+is+a+test+1.0
array(4) {
  ["dirname"]=>
  string(1) "\"
  ["basename"]=>
  string(35) "test.php?q=hello+this+is+a+test+1.0"
  ["extension"]=>
  string(1) "0"
  ["filename"]=>
  string(33) "test.php?q=hello+this+is+a+test+1"
}



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=64754&edit=1

Reply via email to