Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:96281 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3654 invoked from network); 7 Oct 2016 09:21:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Oct 2016 09:21:28 -0000 Authentication-Results: pb1.pair.com smtp.mail=michal@brzuchalski.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=michal@brzuchalski.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain brzuchalski.com designates 188.165.245.118 as permitted sender) X-PHP-List-Original-Sender: michal@brzuchalski.com X-Host-Fingerprint: 188.165.245.118 ns220893.ip-188-165-245.eu Received: from [188.165.245.118] ([188.165.245.118:59453] helo=poczta.brzuchalski.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5E/75-23443-61967F75 for ; Fri, 07 Oct 2016 05:21:27 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by poczta.brzuchalski.com (Postfix) with ESMTP id 7F8112984233 for ; Fri, 7 Oct 2016 11:21:22 +0200 (CEST) Received: from poczta.brzuchalski.com ([127.0.0.1]) by localhost (poczta.brzuchalski.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UdPcykBLyJcF for ; Fri, 7 Oct 2016 11:21:20 +0200 (CEST) Received: from mail-qk0-f169.google.com (unknown [209.85.220.169]) by poczta.brzuchalski.com (Postfix) with ESMTPSA id 0167D2984237 for ; Fri, 7 Oct 2016 11:21:14 +0200 (CEST) Received: by mail-qk0-f169.google.com with SMTP id o68so37917924qkf.3 for ; Fri, 07 Oct 2016 02:21:14 -0700 (PDT) X-Gm-Message-State: AA6/9Rk0vCsPnFj77h8h+fEih85e+qDyY1cwyPrGPp9MqheD5YeXG4pr8Y/izM/GbXAc+T7crq4D1WDUxpasEw== X-Received: by 10.55.198.129 with SMTP id s1mr19550526qkl.280.1475832074124; Fri, 07 Oct 2016 02:21:14 -0700 (PDT) MIME-Version: 1.0 Received: by 10.200.45.238 with HTTP; Fri, 7 Oct 2016 02:21:13 -0700 (PDT) In-Reply-To: References: Date: Fri, 7 Oct 2016 11:21:13 +0200 X-Gmail-Original-Message-ID: Message-ID: To: Marco Pivetta Cc: David Walker , Stephen Reay , PHP internals Content-Type: multipart/alternative; boundary=001a1143f70486e21e053e42eefb Subject: Re: [PHP-DEV] [RFC] Bug #72811 - Replacing parse_url() From: michal@brzuchalski.com (=?UTF-8?Q?Micha=C5=82_Brzuchalski?=) --001a1143f70486e21e053e42eefb Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable How about complete rewrite with OOP? It could be implemented using Objects like DateTime does. I've got working implementation in userland https://github.com/madkom/uri i= t maybe not be finished yet but supports parsing URI with IPv4, IPv6 and Hostnames. It was also going to parse query arguments from URI depending on how to parse multiple arguments: * some languages parses `?arg1=3D1&arg1=3D2` as an array, PHP parses only l= ast, * `?arg1[]=3D1&arg1=3D3` some parses adding element 3 to "arg1" array some replaces) This implementation also supports UriTemplates (" http://localhost/{module}/action") and UriReferences ("/some/reference?arg1=3D2#fragment"). 2016-10-07 8:38 GMT+02:00 Marco Pivetta : > On Fri, Oct 7, 2016 at 8:32 AM, David Walker wrote: > > > On Thu, Oct 6, 2016 at 10:13 PM Stephen Reay > > wrote: > > > > > Could the new URL parser be exposed via a third parameter to parse_ur= l, > > > which defaults to false/off in 7.2 (or whenever its added) but then > > > defaults to true in 8.0? > > > > > > I, personally, would be opposed to this. Firstly, it doesn't alert use= rs > > to the previous functionality being non-standards compliant. Secondly = it > > allows the previous parser to exist in it's current state for a longer > > period of time, then in 8.0 exist as a function parameter. The goal > should > > be to drop the standards-uncompliant version at some point. > > > > > > > Additionally, would(could) this same url parser be used for > > > FILTER_VALIDATE_URL, which currently states (in the docs) that it > matches > > > RFC2396, and indeed it appears not to accept an IPv6 host segment. > > > > > > > I haven't yet looked at to how filter validation exists in conjunction > with > > parse_url(), however as noted ( > > http://php.net/manual/en/filter.filters.validate.php#110411) the > > FILTER_VALIDATE_URL, may be strict to URL's not URN's. Maybe, a future > > scope could be to look at filter_var() and how it uses that filter type= . > > Maybe could add a proper FILTER_VALIDATE_URI, or something. > > > > However that would be outside the scope of this RFC for right now, I > > believe. > > > > -- > > Dave > > > > Like with any software rewrite project, remember that software rewrites > usually fail. > > It's probably better to deprecate the function, make a new one, then code > the newer implementation there, and let users migrate. > > This is necessary to mitigate the risk of BC breaks. > > Marco Pivetta > > http://twitter.com/Ocramius > > http://ocramius.github.com/ > --=20 regards / pozdrawiam, -- Micha=C5=82 Brzuchalski brzuchalski.com --001a1143f70486e21e053e42eefb--