Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:96288 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 27693 invoked from network); 7 Oct 2016 14:46:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Oct 2016 14:46:14 -0000 Authentication-Results: pb1.pair.com header.from=dave@mudsite.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=dave@mudsite.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain mudsite.com designates 209.85.215.48 as permitted sender) X-PHP-List-Original-Sender: dave@mudsite.com X-Host-Fingerprint: 209.85.215.48 mail-lf0-f48.google.com Received: from [209.85.215.48] ([209.85.215.48:36690] helo=mail-lf0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 33/F0-20821-335B7F75 for ; Fri, 07 Oct 2016 10:46:13 -0400 Received: by mail-lf0-f48.google.com with SMTP id b75so42928160lfg.3 for ; Fri, 07 Oct 2016 07:46:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mudsite-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=MX6Syt7HBHeBU+vaqp8ZETJ/lApd+v0iPyOlCJCgM5w=; b=Kes9G7YuP5AgxOopyKl9ONTCSGkiLeopMB3hj8paU0fUKTwHdKTZ9lLJ9WzlesuqEY lF2W4C4m7FjTQ0muWG0hK6rNemCZpqoxcZUxuXdLOAwkp+ui5OaVgJKCWbQNycjKWbTs ieEqZWkZkaqnR2Jd+3BRq+D4dv6wrqq3JyuVeqWOoJGVggVFLYddot3WP3FTkr+tG1Bc ECn69+FnOVOM0VOP/GPJD+XnOkl1zEMzIJdgoRT/NRR0UAt+ODQCQubqDkwvPM+5Occv II8YOY89M2Po9aFXg9xusBTZRIfI4bHz5Tlft9TAfvgYPiE8NGs5/zzhcEe2bXCCYD3S fU4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=MX6Syt7HBHeBU+vaqp8ZETJ/lApd+v0iPyOlCJCgM5w=; b=P/5m1y/w+3T+/wWMX8IpfvG57EFuyOerHXtD4WEdjpxH8JH7Hab8dZ8d/TvR778OwM 7IsmaIANhDszvnL4svPSEymrcCStycwZ0Ogr7/id+/O7DM61B55692S5BDQ/WIkjhbzV oPbwUJ0IXl/MQz8tqwEZDk+39gC8gBNg2whK9Nu0ibaks8iu7HayOHcEkiVDTxY7jCEM w0nEZsYGzxh6ZPl1uQ3Il2fkmEPyymUHm2z4kBab9EBq6YY1eUfQLDvSFcwTM+QCL4E7 L4B9M3MGB38zwWvqzwuzMoMrnRCUDSgfJtvFo4z0OYthFpqrJjygthQlWeLBgdmivo3R 13fA== X-Gm-Message-State: AA6/9RnS/FzGQO/eLZwUMcBmGsjplMWAWMbVekFLMiyVH/D766Wn2xkDEc3iOaQM6Zb5O515DvYRBFASeNALAg== X-Received: by 10.25.228.90 with SMTP id b87mr3621145lfh.61.1475851568329; Fri, 07 Oct 2016 07:46:08 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Fri, 07 Oct 2016 14:45:57 +0000 Message-ID: To: Nikita Popov Cc: PHP internals Content-Type: multipart/alternative; boundary=94eb2c0db56478cd67053e477896 Subject: Re: [PHP-DEV] [RFC] Bug #72811 - Replacing parse_url() From: dave@mudsite.com (David Walker) --94eb2c0db56478cd67053e477896 Content-Type: text/plain; charset=UTF-8 Hi Nikita, On Fri, Oct 7, 2016 at 4:37 AM Nikita Popov wrote: > Are you aware of the WHATWG URL standard [1]? Quoting the first goal > statement: > > > Align RFC 3986 and RFC 3987 with contemporary implementations and > obsolete them in the process. (E.g., spaces, other "illegal" code points, > query encoding, equality, canonicalization, are all concepts not entirely > shared, or defined.) URL parsing needs to become as solid as HTML parsing. > I was not. I assume that WHATWG ought to supersede the IETF standards on the subject. I can obviously make an implementation follow the standards and algorithms set out in this doc. Also quoting from the goals: > > > Standardize on the term URL. URI and IRI are just confusing. In practice > a single algorithm is used for both so keeping them distinct is not helping > anyone. URL also easily wins the search result popularity contest. > > For this reason, I would recommend against introducing the term "URI" > anywhere. In particular the suggestion from this thread to use parse_uri() > for this functionality seems like it will cause a lot of confusion. > Duly noted. > The URL standard also specifies the interface of the URL object used by > JavaScript and I think we should consider whether we may want to simply > adopt this (object-oriented) interface (potentially with adjustments for > PHP specifics). > > I think an important part of this interface is that the URL is constructed > using URL(url [, base]), where "base" is the base URL against which > relative URLs are resolved. This base URL is required for parsing > non-absolute URLs. To me this makes a lot of sense and I think it makes it > much clearer how "incomplete" URLs are being treated. > If we go the route of making URL it's own object, and expose an object-oriented interface, are we leading it to be more of a total URL builder, of sorts? Like: $url = new URL(); $url->setScheme('http'); $url->setHost('example.org'); $url->setPath('/test.php'); var_dump($url->build()); // outputs: http://example.org/test.php OR, would it, at the end of the day be an object that takes a string, and you just call getter's on it that would be akin to the current flags you pass into parse_url()? On both accounts, if we're to go forward with the Object model of URL, would this want to be broken into it's own ext/url module, like how date exists? Or retain it in ext/standard? Cheers -- Dave --94eb2c0db56478cd67053e477896--