Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:118168 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 5690 invoked from network); 4 Jul 2022 05:49:07 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 4 Jul 2022 05:49:07 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4810B180089 for ; Mon, 4 Jul 2022 00:41:35 -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.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 4 Jul 2022 00:41:34 -0700 (PDT) Received: by mail-ej1-f47.google.com with SMTP id fi2so15178061ejb.9 for ; Mon, 04 Jul 2022 00:41:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :references:from:in-reply-to:content-transfer-encoding; bh=E6IVM6RvJRGnJ8P0oHCyrUG0KFaozDxcx7OywkFUd1k=; b=mNaaUuYHgqFDc51ykwdubdXNROJVw+fLagoJEwVze7D1BBfHeyfIl9y8s7/m+gsH4N P206kY2Fqs/LAnr6HzWbcWBTMRjY0UABVlvvGBU9tFfzybFM+71wSReAx1K97jXx8HyS dYxfXjr8CcGm6y8NHF2uThPzCmmHM/QKDgZ5DfW2EJoGzaR2zvAmHzhdj8SInTdXBrMU bYyP7BO14qcM5lOYq/Ktr+pIy7o8CK4VJ7yLpLfaTFajA78OQjuHbm+40EIrHkBeQ/T0 9fyYqkxlGf4zSYBoVioDmB5n9/mPTPRUeySRk6tj6mRCR68QA0jYViCpn/JTBlIekCRn /NmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=E6IVM6RvJRGnJ8P0oHCyrUG0KFaozDxcx7OywkFUd1k=; b=1o01t0/oSVkJ8fjfsk5LKCcswQXU10cbixK1Oo64BUlfFULWQvwYcXnaxEJU+Kovcw bz2G+WVdv6vpGtXdcbZq4ioBGQY+U3DyVIlBhOxAzbalFHxxYXQJYEUEuPebXMdi4Jro HvLRaa9AdHcUihGdGX24IJmB2/gxCs7nzXkaOb4FrKKJQg6JrGXlEbCdE/IIPSlLYD84 pMjhZBskApk17Kj5I1Jzo3dUKmbVUK6cOeGmLusZSB9FhQ/s4LHM4unLvJ9j8HokgFaT ZCRD5NnlBcnRVX8xWWvG52KAqnW4Dq6Dw2bQELHxmVVqQ8w/BG2GgCnnyKru22dIm1i/ K1hg== X-Gm-Message-State: AJIora9k8RnP2EBC3l2/NhCJKG/AnTvC4i54KQqs6ELawuUs57M0hZvM NTRiY1w6TWFdECbW0FQXjDHsdjtIS+Y= X-Google-Smtp-Source: AGRyM1vm4Dpl0nTMh/UoU6rTOLH8YX5IS+vcqze5UlY6R8dp60/XpqydKqgfQtklyL99h8BJeOhVNQ== X-Received: by 2002:a17:907:11c2:b0:723:21cb:bd35 with SMTP id va2-20020a17090711c200b0072321cbbd35mr27597228ejb.108.1656920493596; Mon, 04 Jul 2022 00:41:33 -0700 (PDT) Received: from ?IPV6:2a01:7c8:7c8:f866:10::1001? ([2a01:7c8:7c8:f866:10::1001]) by smtp.gmail.com with ESMTPSA id t12-20020a50d70c000000b0043590660f16sm20459158edi.35.2022.07.04.00.41.32 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 04 Jul 2022 00:41:33 -0700 (PDT) Message-ID: Date: Mon, 4 Jul 2022 09:41:32 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Content-Language: en-US To: PHP internals References: <7d72b5c1-d19b-8734-57e0-f02c402b09c2@gmail.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] [RFC] Add json_encode indent parameter From: tdegroot96@gmail.com (Timon de Groot) As a flag can't really hurt, I'm thinking of going with option B before starting the vote. Also agree with ignoring the indent parameter, as a tab character is less dependent on how much it is repeated. Kind regards, Timon On 04-07-2022 03:22, Kevin Israel wrote: > On 7/3/22 18:01, Jakub Zelenka wrote: >>   I think we can put this RFC to the vote. If the author is to busy I >> would >> like to start voting later this week. It would be a pity not to make >> it to >> feature freeze as it is quite straight forward and the implementation >> seems >> good as well so I guess we don't need to wait extra year. :) >> >> Cheers >> >> Jakub >> > This RFC really should have included an option to use tabs instead of > spaces, which is, IMO, even more important than having a parameter for > the number of spaces. This could take the form of either > > (a) a magic indent value such as -1, or > > (b) a new flag (suggested name: JSON_INDENT_USING_TABS). > > There should be no need to support indenting using multiple tabs per > level; for option (b), the value of the indent parameter should be ignored. > > An indent-using-tabs flag would even be useful for generating two-space > indented JSON, should the proposed indent parameter be rejected. The > reason is that tabs cannot occur within JSON string representations, so > any other indent string is a simple str_replace() away. In contrast, > replacing the current four-space indent with anything else is more > complicated to do efficiently[1]. > > [1]: > https://github.com/wikimedia/mediawiki/blob/210a34369ac8f0ba74b497d0b2298ca7e5a0bffb/includes/json/FormatJson.php#L113-L117 > >