Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115635 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 48688 invoked from network); 6 Aug 2021 07:16:38 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 6 Aug 2021 07:16:38 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 365951804CF for ; Fri, 6 Aug 2021 00:45:59 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-qt1-f179.google.com (mail-qt1-f179.google.com [209.85.160.179]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 6 Aug 2021 00:45:58 -0700 (PDT) Received: by mail-qt1-f179.google.com with SMTP id w10so5855716qtj.3 for ; Fri, 06 Aug 2021 00:45:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=newclarity-net.20150623.gappssmtp.com; s=20150623; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=/DfDLwLGTcQveV+aBoFCAVH5Oz+GLPhwwljkenX1z+Y=; b=IK5eBpVIss1B1hn88wG4VVtlzxa7e5/9nnik3t6OE2FcXKh3cLHz3XJj9pza5Kyd2j XkH93/X7gie6ti1GfUsG8dZsegeZf+YG/hJq2FNGThg792Gkal6sLVbqJiWBs5Ce4IAC MxJR20gv8mHq6hZCXAFyzP7VAbNZ7EEgQxwHYbzikTr5hXyJ8/O6fzIt03VYh58kgw6w cPILVNoKxj2OF2vV1UQqPsec8FzZKEUnLYlsYhiuKohPPElwDG8nmzgkyW/0TXo0hWnx Zz7rGp1YajOPgoPtY3s+7FXQ0JODo/ya0Xd2mktycEJd3+yYT7ioeN2rWJVFuYktZ5fs 9OrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=/DfDLwLGTcQveV+aBoFCAVH5Oz+GLPhwwljkenX1z+Y=; b=WNe7MDSU0zZUS8Yycs6vyHD3CvFpiaw8k0+nqLLYZJMz4LTbH9YfUWCS41we6vx+0q 2GRziHr8hl1k1U3560fuOPs4TEYOQUUSOdmj7yuIJN87hVhOVXBVDJEd3zvYhHmogAJ0 5awjFHkD1sU/nilF6N6mncsE5H1F8ZngAvV+9TB/OLfYJsupRPC+j4OlmvkPG4zQbS+H Cs/X2IKjfqrpvD1hbE6t8aixHBc59J5OduR/VKsy3cjMzIrUDHJL94vELiNVyDmLEvlU M+6/AbKtFBoQGbMy36EjjU8j0lFGSUIclhdBEwhulFBwNKPw5a5wz5ofqffasiv2FLtL UxEg== X-Gm-Message-State: AOAM531fgNhLkfCGkEgt6JpF4OYZgvzmBsX/Y6IEDripvitTw0muXjrY QamKIoVYDhnZt6RSc2A0Yo6INA== X-Google-Smtp-Source: ABdhPJxGtFTxKzHWKT4RXmSzjWEDfE2TOW4SI7XX5kNNT7Xiqd1QT/LGMLb/769p1Ngh/kfnnX4qWA== X-Received: by 2002:ac8:5c16:: with SMTP id i22mr7938946qti.62.1628235955871; Fri, 06 Aug 2021 00:45:55 -0700 (PDT) Received: from [192.168.1.10] (c-24-98-254-8.hsd1.ga.comcast.net. [24.98.254.8]) by smtp.gmail.com with ESMTPSA id p19sm3026801qtx.10.2021.08.06.00.45.54 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Aug 2021 00:45:55 -0700 (PDT) Message-ID: Content-Type: multipart/alternative; boundary="Apple-Mail=_855C6250-F649-43B3-A949-7FE8BB02B90D" Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\)) Date: Fri, 6 Aug 2021 03:45:53 -0400 In-Reply-To: Cc: Internals , ignace nyamagana butera To: Kamil Tekiela References: <7DA18959-3463-4AAE-ABE3-B9330FEE83D2@gmail.com> X-Mailer: Apple Mail (2.3608.120.23.2.7) Subject: Re: [PHP-DEV] [RFC] Add parse_query_string as an alternative to parse_str From: mike@newclarity.net (Mike Schinkel) --Apple-Mail=_855C6250-F649-43B3-A949-7FE8BB02B90D Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On Aug 5, 2021, at 6:21 PM, Kamil Tekiela = wrote: >=20 > I have added implementation for > https://wiki.php.net/rfc/parse_str_alternative. If there are no other > comments, I would like to start voting on Saturday. I too would appreciate having a function in the PHP library that returns = an array and that is named more intuitively than parse_str(). However, I would suggest naming it `parse_query()` instead of = `parse_query_string()` as `_string()` is redundant and I see shorter = function names being preferable when the intent of the function is = clear. I searched for prior art and it appears that Guzzle's PSR7 helper = library v1.x had a namespaced parse_query() function: https://github.com/guzzle/psr7/blob/1.x/src/functions.php#L299 = I found Psr7\parse_query() being called on GitHub in 840 places using = SourceGraph code search: = https://sourcegraph.com/search?q=3Dcontext:global+lang:php+Psr7%5Cparse_qu= ery%28+count:all&patternType=3Dliteral = There was only one (1) place with SourceGraph code search where someone = named a function parse_query_string(), and that example did not use = parse_query_string() in the same way as your RFC: = https://sourcegraph.com/github.com/k0a1a/hotglue2/-/blob/controller.inc.ph= p?L344:1 = My takeaway is that PHP developers will easily be able to understand the = intent if named `parse_query()`, especially those who might be familiar = with it from Guzzle, and thus there is no need for the redundant = `_string()`. =20 And, of course, a parse_query() in the global namespace won't conflict = with Guzzle's use because their function is namespaced with Guzzle\Psr7. > On Aug 6, 2021, at 3:17 AM, ignace nyamagana butera = wrote: >=20 > I feel that we are missing a chance to also improve how parse_str > algorithm is currently used, we could or should (?) use this = opportunity > to fix some long shortcomings around parse_str. Also, +1 to this. -Mike P.S. WordPress has a parse_query() *method* on their WP_Query() class, = but as someone who has worked with WordPress for 10+ years even I don't = see these two in conflict. One is a method scoped to the solution domain = of its class and the other would be a function in PHP's global = namespace.= --Apple-Mail=_855C6250-F649-43B3-A949-7FE8BB02B90D--