Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:96289 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 29409 invoked from network); 7 Oct 2016 14:57:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Oct 2016 14:57:31 -0000 Authentication-Results: pb1.pair.com smtp.mail=guilhermeblanco@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=guilhermeblanco@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.161.181 as permitted sender) X-PHP-List-Original-Sender: guilhermeblanco@gmail.com X-Host-Fingerprint: 209.85.161.181 mail-yw0-f181.google.com Received: from [209.85.161.181] ([209.85.161.181:33080] helo=mail-yw0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E9/41-20821-AD7B7F75 for ; Fri, 07 Oct 2016 10:57:31 -0400 Received: by mail-yw0-f181.google.com with SMTP id t192so13815190ywf.0 for ; Fri, 07 Oct 2016 07:57:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=FHs4ogvfBe6B1ud4nDT6eYduHu+HCVPOfSBgIvWjCNA=; b=SBLVEhLzuQNYdAvjFGIGAVetGPktQbNvxwQ7w7AehscOA64h06IZrwkheGSPfyYguk QVC7yhJ/dDTmjsIeCR6FG85hTCig1lPboOvRZOtSXD10asZBvUK0tAPIrw4ccWlHI02f z/SzdspeLoJhZaUWblGnnx40FBaZkq19EcHgZZyS01agFwF73rnLD6Su+5KkqXtVTwZK 0L/Blcn+ToZTFJQc9CDtBFW7wMAq1bgjNGeQGO1IttYs9MD9NAj4FDHjb2YaHyxsbVjj K3vYpHRtBtFfF9wP2kCSwbX2pT1862wALmN/ffvHuQoffo9VvX/ON7y4Vt+fmjrdpVXo yc7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=FHs4ogvfBe6B1ud4nDT6eYduHu+HCVPOfSBgIvWjCNA=; b=MUbxMzvygeXf+rbTB+3yU35dXJsUg4vftKLohy6LHC2uNEaafzW4xJHKobLO+sbouQ 8SSNAC8TSiS6rjuK5l/5rXHWL8s75GyOXeiVN12iT+g6CwmhGJEkq64xnIyZuF+jt/e5 WUNAxNLJ7+8WzoxI67xKAG22xzCCi7BZe6Clw/oToUAvdY2uURz++RTOmJubVcnzge08 kq591flApEDaFs8NLHISjgPfWGru6HBlN2QbG7imAkmXLv6tmcV5CDKrDm79PisfLib0 cWEJvEJV0BFQMnYpDfTlL79mMeLueC7pVPmo0MjJF41y8bvkE2ira4HXCeDM1wqVgScd VDvw== X-Gm-Message-State: AA6/9RnI+CNe4x7X7l1OVTb/a3bhldYruqzNlg0QROMEb9Gq0Jz2JfiH+1IuR1pU9CTQ2j+UpZg4xWzk3RawIg== X-Received: by 10.129.32.212 with SMTP id g203mr15525002ywg.277.1475852248365; Fri, 07 Oct 2016 07:57:28 -0700 (PDT) MIME-Version: 1.0 Received: by 10.37.77.69 with HTTP; Fri, 7 Oct 2016 07:57:07 -0700 (PDT) In-Reply-To: References: Date: Fri, 7 Oct 2016 10:57:07 -0400 Message-ID: To: David Walker Cc: Nikita Popov , PHP internals Content-Type: multipart/alternative; boundary=001a1141cb24016377053e47a100 Subject: Re: [PHP-DEV] [RFC] Bug #72811 - Replacing parse_url() From: guilhermeblanco@gmail.com ("guilhermeblanco@gmail.com") --001a1141cb24016377053e47a100 Content-Type: text/plain; charset=UTF-8 I'd suggest URL to be immutable and have a URLBuilder (obtainable through URL::createBuilder()) for that... On Fri, Oct 7, 2016 at 10:45 AM, David Walker wrote: > 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 > -- Guilherme Blanco Lead Architect at E-Block --001a1141cb24016377053e47a100--