Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115212 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 22436 invoked from network); 29 Jun 2021 14:36:05 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 29 Jun 2021 14:36:05 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B467F1804DB for ; Tue, 29 Jun 2021 07:56:06 -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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) (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 ; Tue, 29 Jun 2021 07:56:06 -0700 (PDT) Received: by mail-lj1-f181.google.com with SMTP id h6so15241497ljl.8 for ; Tue, 29 Jun 2021 07:56:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=U52sUHzSE96E0JCa7w3JiFomMrJ6nRFJj/0DsTRdcdA=; b=u0mJBPY0UsYN/9Sh8WBn9zMIQc5qcENbiOw0CH5nyItseIvDEPFMtxQipy9uvWVB9S Shmk2MI2zX8iJs8tfXmKmgmt2WsqPQ2oCGcdentiBCN9tuRiiN0BV1S9zZHEUSEN/H63 +VGZqsKaa4DTGd7pJ0UuRAQxzicWaN9/mragNRIbfpA/4dZUZQeiKpr2lsYE+UsP3Lku ww3jb8nuqfz8NyzP+RccS1E0idltksN1UyXBjp3+I+x9BaP82SwnEmwPRsGL5qWm+Fax g9E57vyweA0V1399yFQ8kVy5qrHA88YfeIzztRgbMHZS+K35vIfPXNFS0/96GOF/mMmo 04jQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=U52sUHzSE96E0JCa7w3JiFomMrJ6nRFJj/0DsTRdcdA=; b=JtiwPkWQNjzXBdvfOR5kOfF2HBhvjJXP85z02GfE77saqIU4Ya3dKscA2GYC+om6ow V8f2mtQc82fGciR0yWeKVGt+39iPn8A4o2LqJG91unIHkU/M0bV1lHHxjQJc3Dr2bwAb 7CI0TNDKfgKZUyQkq5lOADDqKMW2valEd9UdNXJB5si2nFlTuQ0kCB7F8BIrdQzebwFr mRbZoZyiVaZzk+1KIlMb9+yMEe70Ve06huH3fVJEgUt+TQKDS313HNeHcLEXO61ESYVR nqg+0CegTnCnBfOzZxDFUfl3cDDlQcMIS3sCTzuAkkr38Kw1jDfN2DjW9lvGJHM/oeiG QlEw== X-Gm-Message-State: AOAM532RwiaE2bqzZl/YsP0KaAYc8uNHYes+HvSA3+lFW18vvur1DZzN dNHUyzgnBv3AmlmEVy6sM5jSw94nwzGGfIbKASQ= X-Google-Smtp-Source: ABdhPJzXq5lIyieMm6dSzDSDSVCPtS8fl4ezhczzAjVYKHt/vAs7IGYoByZsjIl/aAn8pwskTSuuKGuCd9yLkWvQT/Y= X-Received: by 2002:a2e:a279:: with SMTP id k25mr1649662ljm.29.1624978562473; Tue, 29 Jun 2021 07:56:02 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 29 Jun 2021 16:55:46 +0200 Message-ID: To: Sara Golemon Cc: Kamil Tekiela , PHP internals Content-Type: multipart/alternative; boundary="000000000000fbe32f05c5e8cde9" Subject: Re: [PHP-DEV] [RFC] Add parse_query_string as an alternative to parse_str From: nikita.ppv@gmail.com (Nikita Popov) --000000000000fbe32f05c5e8cde9 Content-Type: text/plain; charset="UTF-8" On Thu, Jun 24, 2021 at 1:20 AM Sara Golemon wrote: > On Wed, Jun 23, 2021 at 5:02 PM Kamil Tekiela > wrote: > > > I would like to propose a new simple RFC that aims to add a new function > > called parse_query_string as an alternative to parse_str. > > > > https://wiki.php.net/rfc/parse_str_alternative > > > > The functionality stays the same, only the name and the way of returning > > the array changes. While it is a rather insignificant change, I believe > it > > is one step closer to making PHP cleaner. > > > > > There's a potential alternative option that doesn't require adding a new, > parallel function. We can use execute_data->return_value_used to figure > out if parse_str() was called with the result assigned to a local var. > This is overloady and probably a bad idea, but it's an option. > > if (ZEND_NUM_ARGS() == 2) { > // Put result into by-ref second arg > // parse_str($str, $refResult); > } else if (EX(return_value_used)) { > // Put result into return_value > // $result = parse_str($str); > } else { > // Put result into EG(local_symbol_table) > // parse_str($str); > php_error(E_DEPRECATED, ...); > } return_value_used is a hint that cannot always be reliably determined. E.g. if you go through something like call_user_func(), I believe it'll always be set. I think if the observer infrastructure is used, it will also always be set. Using it is okay for optimization, but I don't think we should use this flag to influence behavior. Regards, Nikita --000000000000fbe32f05c5e8cde9--