Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114764 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 1887 invoked from network); 7 Jun 2021 10:38:40 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 7 Jun 2021 10:38:40 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 83AB61804C9 for ; Mon, 7 Jun 2021 03:53: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-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) (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 ; Mon, 7 Jun 2021 03:53:06 -0700 (PDT) Received: by mail-lf1-f52.google.com with SMTP id a2so25494606lfc.9 for ; Mon, 07 Jun 2021 03:53:05 -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=UZUkG6MQikYqVYKUeOrp/YbEIytkH39dZxIgJRJgjzc=; b=C2WrhpkJUSiFfsEKA30qujEkvz7RmroDaTq4+iPb6vp7kQzyS9HFIW+fiV+WvC4VzT 3Zi/9yHNvwnF5QpVp3HHtWcS6Mtzl0iHyABoPFaBFGTGFoa3/xB618ul60gsan8UvVmG +jn2mL/22UNGw2AKGXjADls6SKS2MaskqrG4CukpO8ZLlSOEZsJUJmhnbpsE1cGCRgCQ RKB7NwyzAYEC36gbMU/ctZX3d5/yLMDWcPqzFvy9SNRhfSVjmovbCg/ys21rZOiydryR MiRomKGTtVGb+xP0RMJvTxiclWixa6j6mRVBACBGuHhZNBT1utl1jmAP45K48PIq2TjE numQ== 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=UZUkG6MQikYqVYKUeOrp/YbEIytkH39dZxIgJRJgjzc=; b=M90ykYNadd02wNW2fw4uWLyBAo9SuL914IcBlOTiWG4oYZxNLR+dam6ZX11DUI03kf TNhMCMEM9p0KINjC0DkNWfn1YsxMz/onv5+5vb+a2lJO9IkiC7ySsDizWQ0/ATGZoERJ rvZCOJd9qGcUZ19peoTIdMIbRU5jhx9U07QJ8qlmBremaOKeYJgTa+n/6/k9Ogy0NThm FPV9Y+mQj4M5Ke6TigUT66g4zd3R2VWy8madyNYUh5/EZCgb8BEJWsocCH6t8ptRgg87 yhrguhj6Vk5JQuBKbFhOCt2orTkmLDvWU2Br+bX8CNg1ID5yrFTitm/UAC4V3MNJoBCL fIGw== X-Gm-Message-State: AOAM530zSOFRFgtWFwIrBe6+ozqrFUZ25lChelo4r/7myL9n8OKdEOHG o4K13Es7IBeFgVJpX6Zr8vYu/MD8UTF5Hnk7atw= X-Google-Smtp-Source: ABdhPJy1vKGySnkHbovG5+xAl0YWxuTcBgNI/Q2EBVN9IqpfEYCYWKqMLspyd/i3h0e3QjaI4+2G2M+KtLsVjlr5XtY= X-Received: by 2002:a05:6512:acd:: with SMTP id n13mr11603444lfu.485.1623063182703; Mon, 07 Jun 2021 03:53:02 -0700 (PDT) MIME-Version: 1.0 References: <8de4d96a-75d1-d732-020e-30bce0a5e03d@gmail.com> In-Reply-To: <8de4d96a-75d1-d732-020e-30bce0a5e03d@gmail.com> Date: Mon, 7 Jun 2021 12:52:46 +0200 Message-ID: To: Timon de Groot Cc: PHP internals Content-Type: multipart/alternative; boundary="0000000000007400e505c42ad8cf" Subject: Re: [PHP-DEV] [RFC][Draft] Add json_encode indent parameter From: nikita.ppv@gmail.com (Nikita Popov) --0000000000007400e505c42ad8cf Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Jun 3, 2021 at 6:11 PM Timon de Groot wrote: > Hi internals, > > I'd like to present my RFC for adding the indent parameter to the > json_encode function: > https://wiki.php.net/rfc/json_encode_indentation > > The `string|int $indent =3D 4` parameter adds the ability to specify the > indentation for > the JSON encoder. Amount of spaces can be specified by a number and a > string can be > specified to set a custom indentation like `\t` or whatever. > > As this is my first RFC (and contribution) for PHP, I'm all kind of new > to the process, standards, etc. > Please let me know if I could do something better. > > Looking forward to feedback/input on the RFC. > As has been brought up in https://github.com/php/php-src/pull/7093#issuecomment-855170601, the string version of the $indent parameter allows you to create invalid JSON, something that json_encode() does not currently allow. I tend to agree that it would make sense to validate that the indent only contains whitespace characters, and not =F0=9F=9A=80. Regards, Nikita --0000000000007400e505c42ad8cf--