php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49055 parse_url() converts \r\n to _ _
Submitted: 2009-07-25 09:58 UTC Modified: 2009-07-25 10:54 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: me at anton dot in dot ua Assigned:
Status: Not a bug Package: URL related
PHP Version: 5.2.10 OS: *
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: me at anton dot in dot ua
New email:
PHP Version: OS:

 

 [2009-07-25 09:58 UTC] me at anton dot in dot ua
Description:
------------
parse_url convert \r\n symbols to _ _.

More:

OK: 
$string = "ftp://login:pass@domain";
array
  'scheme' => string 'ftp' (length=3)
  'host' => string 'domain' (length=6)
  'user' => string 'login' (length=5)
  'pass' => string 'pass' (length=4)

BUG:
$string ="ftp://login:pass@domain\r\n";
array
  'scheme' => string 'ftp' (length=3)
  'host' => string 'domain__' (length=8) /* wtf? */
  'user' => string 'login' (length=5)
  'pass' => string 'pass' (length=4)

------------
if i get strings from file i should use trim before use parse_url.
i think it is bug and parse_url should use trim

 - OR - 

ignore \r\n at the end of line.

Reproduce code:
---------------
$string = "ftp://login:pass@domain";
var_dump(parse_url($string));

$string = "ftp://login:pass@domain\r\n";
var_dump(parse_url($string));

Expected result:
----------------
array
  'scheme' => string 'ftp' (length=3)
  'host' => string 'domain' (length=6)
  'user' => string 'login' (length=5)
  'pass' => string 'pass' (length=4)

Actual result:
--------------
array
  'scheme' => string 'ftp' (length=3)
  'host' => string 'domain__' (length=8) /* wtf? */
  'user' => string 'login' (length=5)
  'pass' => string 'pass' (length=4)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-07-25 10:54 UTC] jani@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Someone might expect them to be there. Doing trim() is quite easy if you 
don't want them to be replaced.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 05:01:27 2024 UTC