Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:96286 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 18756 invoked from network); 7 Oct 2016 13:05:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Oct 2016 13:05:27 -0000 Authentication-Results: pb1.pair.com header.from=michal@brzuchalski.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=michal@brzuchalski.com; spf=pass; 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:52087] helo=poczta.brzuchalski.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 52/D7-23443-59D97F75 for ; Fri, 07 Oct 2016 09:05:27 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by poczta.brzuchalski.com (Postfix) with ESMTP id 5956A298423A for ; Fri, 7 Oct 2016 15:05:23 +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 aEbwOoAYJedq for ; Fri, 7 Oct 2016 15:05:19 +0200 (CEST) Received: from mail-qt0-f182.google.com (unknown [209.85.216.182]) by poczta.brzuchalski.com (Postfix) with ESMTPSA id 1ED262984235 for ; Fri, 7 Oct 2016 15:05:19 +0200 (CEST) Received: by mail-qt0-f182.google.com with SMTP id s49so20946747qta.0 for ; Fri, 07 Oct 2016 06:05:19 -0700 (PDT) X-Gm-Message-State: AA6/9RmpJBzwLFI7r5LjlgkQdddySZ9IGQLhBByb15UIxYbfS+uDFyZ3uuEN8fnprDR8rEpkQBCdQxT7zxJ0sg== X-Received: by 10.237.44.193 with SMTP id g59mr3073139qtd.144.1475845518250; Fri, 07 Oct 2016 06:05:18 -0700 (PDT) MIME-Version: 1.0 Received: by 10.200.45.238 with HTTP; Fri, 7 Oct 2016 06:05:17 -0700 (PDT) In-Reply-To: References: Date: Fri, 7 Oct 2016 15:05:17 +0200 X-Gmail-Original-Message-ID: Message-ID: To: Yasuo Ohgaki Cc: Marco Pivetta , David Walker , Stephen Reay , PHP internals Content-Type: multipart/alternative; boundary=94eb2c125692dc1e42053e460fb0 Subject: Re: [PHP-DEV] [RFC] Bug #72811 - Replacing parse_url() From: michal@brzuchalski.com (=?UTF-8?Q?Micha=C5=82_Brzuchalski?=) --94eb2c125692dc1e42053e460fb0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 2016-10-07 12:55 GMT+02:00 Yasuo Ohgaki : > Hi Michal, > > On Fri, Oct 7, 2016 at 6:47 PM, Micha=C5=82 Brzuchalski > wrote: > > 2016-10-07 11:21 GMT+02:00 Micha=C5=82 Brzuchalski : > > > >> 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 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 t= o > >> parse multiple arguments: > >> * some languages parses `?arg1=3D1&arg1=3D2` as an array, PHP parses o= nly > last, > >> * `?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"). > >> > > > > 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. > > This is about internal C module implementation. re2c is one of the > best way to write manageable BNF definition implementation. We use > re2c many places already. Therefore, re2c implementation is the way to > go. IMHO. > > Yes I understand that implementation in C would be different, all I wanted to point is nice OO implementation with type hints and return types so there is no `mixed` return type value used like in parse_url() and there are always classes for each component of URL not only string and you don't know what to do with it Also avoiding mixed return type allows static code analyzers to detect errors in code and all those OO benefits. > Regards, > > -- > Yasuo Ohgaki > yohgaki@ohgaki.net > --=20 regards / pozdrawiam, -- Micha=C5=82 Brzuchalski brzuchalski.com --94eb2c125692dc1e42053e460fb0--