Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:96282 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6227 invoked from network); 7 Oct 2016 09:47:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Oct 2016 09:47:32 -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:37023] helo=poczta.brzuchalski.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 91/F5-23443-23F67F75 for ; Fri, 07 Oct 2016 05:47:31 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by poczta.brzuchalski.com (Postfix) with ESMTP id 244C2298423A for ; Fri, 7 Oct 2016 11:47:28 +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 R9eCg2l8ek6o for ; Fri, 7 Oct 2016 11:47:26 +0200 (CEST) Received: from mail-qk0-f172.google.com (unknown [209.85.220.172]) by poczta.brzuchalski.com (Postfix) with ESMTPSA id C37972984238 for ; Fri, 7 Oct 2016 11:47:20 +0200 (CEST) Received: by mail-qk0-f172.google.com with SMTP id o68so38346129qkf.3 for ; Fri, 07 Oct 2016 02:47:20 -0700 (PDT) X-Gm-Message-State: AA6/9Rnrd3E3+Xl/og89yqT/W5oblIQY3I3pe1ZnKuGR8h9DnJUmYD8FvwzL5Fo5aFHjJeFrIWcUP/60eZ/RWg== X-Received: by 10.55.70.65 with SMTP id t62mr18456578qka.31.1475833639715; Fri, 07 Oct 2016 02:47:19 -0700 (PDT) MIME-Version: 1.0 Received: by 10.200.45.238 with HTTP; Fri, 7 Oct 2016 02:47:19 -0700 (PDT) In-Reply-To: References: Date: Fri, 7 Oct 2016 11:47:19 +0200 X-Gmail-Original-Message-ID: Message-ID: To: Marco Pivetta Cc: David Walker , Stephen Reay , PHP internals Content-Type: multipart/alternative; boundary=001a11488730d80e7f053e434b30 Subject: Re: [PHP-DEV] [RFC] Bug #72811 - Replacing parse_url() From: michal@brzuchalski.com (=?UTF-8?Q?Micha=C5=82_Brzuchalski?=) --001a11488730d80e7f053e434b30 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 2016-10-07 11:21 GMT+02:00 Micha=C5=82 Brzuchalski = : > How about complete rewrite with OOP? It could be implemented using Object= s > like DateTime does. > I've got working implementation in userland https://github.com/madkom/uri= it > 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= last, > * `?arg1[]=3D1&arg1=3D3` some parses adding element 3 to "arg1" array som= e > replaces) > > This implementation also supports UriTemplates (" > http://localhost/{module}/action") and UriReferences > ("/some/reference?arg1=3D2#fragment"). > My proposed impl supports parsing and building, I can see there is possible to move functionalities from few global functions into one OO written package. > > 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_url, >> > > 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 >> users >> > 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 futur= e >> > scope could be to look at filter_var() and how it uses that filter typ= e. >> > 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 cod= e >> 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/ >> > > > > -- > regards / pozdrawiam, > -- > Micha=C5=82 Brzuchalski > brzuchalski.com > --=20 regards / pozdrawiam, -- Micha=C5=82 Brzuchalski brzuchalski.com --001a11488730d80e7f053e434b30--