php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #20308 parse_url does not understand the Mailto scheme
Submitted: 2002-11-08 03:56 UTC Modified: 2002-11-29 11:59 UTC
From: Otto dot Stolz at uni-konstanz dot de Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.2.2 OS: SunOS
Private report: No CVE-ID: None
 [2002-11-08 03:56 UTC] Otto dot Stolz at uni-konstanz dot de
parse_url('mailto:Otto.Stolz@uni-konstanz.de')
yields:
 array( ['scheme'] => 'mailto'
        ['path'] => 'Otto.Stolz@uni-konstanz.de'
      )

According
to <http://www.zvon.org/tmRFC/RFC2368/Output/chapter2.html>
and <http://www.zvon.org/tmRFC/RFC2822/Output/chapter3.html#sub4>,
it should rather yield:
 array( ['scheme'] => 'mailto'
        ['host'] => 'uni-konstanz.de'
        ['user'] => 'Otto.Stolz'
      )

A test page can be found at
<http://www.rz.uni-konstanz.de/Antivirus/tests/parse_url.php>,
the pertinent PHP source at
<http://www.rz.uni-konstanz.de/Antivirus/tests/parse_url.txt>.

Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-11-08 03:59 UTC] tal@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.
 [2002-11-08 04:45 UTC] wez@php.net
PHP does not parse out those parts of the mailto url;
re-opening as a feature request.
 [2002-11-29 11:59 UTC] pollita@php.net
After much back-and-forth on php-dev it was decided to leave parse_url() as is.

To achieve the functionality you're looking for try something like the following:

$addr = parse_url('mailto:testuser@example.com?Subject=Here+is+an+email');
list($email,$params) = explode("?",$addr,2);
list($user,$host) = explode("@",$email,2);

// $user == "testuser";
// $host == "example.com";
// $params = "Subject=Here+is+an+email";
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Aug 19 18:01:30 2024 UTC