Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114716 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 84910 invoked from network); 3 Jun 2021 15:50:18 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 3 Jun 2021 15:50:18 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id ACBF01804AE for ; Thu, 3 Jun 2021 09:03:46 -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 autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (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 ; Thu, 3 Jun 2021 09:03:46 -0700 (PDT) Received: by mail-wr1-f53.google.com with SMTP id l2so6406541wrw.6 for ; Thu, 03 Jun 2021 09:03:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=W3rf2s7v0xocLzc05V5mXyWRj/1yjUo8Trk/U0mKDjM=; b=T3xGCs7gzG3xGgbVyQaqHsUYSgpVPuW/eknEoOa+Cnz1p/mbqdmgKtQHf6ykZn6h36 MBrmJ40nz6WWbnKKs6JUjPfItl73NVTmDCwWm0YxSA+3QHEQOiv/+7SIMG8fXLUHAlXN lqjagHvQsv0wTg6LS+sp9Ofsj4dc0G30lfc+pU/Yk6rYEL3I0GeJHbKiCYt5J1rLUvql 7BEpmdspXJvYRmXtSuw7HmkT3G/Bhrml8lBp1aOpo8KJkzxDYpJMyZKHUM0lexbRAGq/ NXTZTK2LWI5XLOE+OP4HzImUfVwaV5G3yYJ9HTUcVO4zCRua5zjkEPVGdhFxQB6ToPFM yuUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=W3rf2s7v0xocLzc05V5mXyWRj/1yjUo8Trk/U0mKDjM=; b=RS4KIDAuO5SlRZmn6PvIfRRwWYjlNqw75gYpoxfyrKuXzajQcmTwUkxCxYt5StN8bc YY18ZVzWxQ6nRrFO9oasmhxiIcDaHeY9EudU5LKomEovsQKWdgC8Nkh6Xp0Va7LvnvP+ pwR8NuEUU/V07jm6zCBtSoE26cVNwmLDirLNkmKcD/lnqxxVDhabB+vfULMsiAzkvh5D PyhVVD36hxEONd9Dgb/GYX4z+uYwwu+jE+cocwCZzKJgSsXrOERzKtx4UpzS+XailWv3 6L82h4AQ/QCTfPRqMDBeaIb33x12XGEBd2wkamskQDHUCN5tIcZO2ycuDilnzQ3QXlhb tpSg== X-Gm-Message-State: AOAM533t3c+fY+L9BYRI9Y1MatyJqQbiZec/E4I74jszm04gX0ln4/lz LyQjYy3tJC0A2y3sRWlpZpHZhmbo3T9rTfen X-Google-Smtp-Source: ABdhPJwF6fmICWF2+YuXxzejcw+8Z8c/FnUIDWT97M/kJLnP4gATIt3tQCEzJ9gxvKavfLcGEiMyvA== X-Received: by 2002:a5d:570d:: with SMTP id a13mr630507wrv.239.1622736224742; Thu, 03 Jun 2021 09:03:44 -0700 (PDT) Received: from [192.168.2.117] (86-84-29-36.fixed.kpn.net. [86.84.29.36]) by smtp.gmail.com with ESMTPSA id l13sm3639349wrv.57.2021.06.03.09.03.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Jun 2021 09:03:44 -0700 (PDT) To: Ayesh Karunaratne Cc: PHP internals References: <06f92428-a426-0afa-72ab-053e224a87ce@seld.be> <4c8f7ea1-6112-8046-846c-b701ab707752@gmail.com> Message-ID: <1008623e-faed-aa39-3b58-48d37d306e5d@gmail.com> Date: Thu, 3 Jun 2021 18:03:42 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: nl Subject: Re: [PHP-DEV] json_encode indent parameter From: tdegroot96@gmail.com (Timon de Groot) On 3-6-2021 17:53, Ayesh Karunaratne wrote: > Hi Timon, > Thank you for this RFC. I think the `string|int $indent` approach is great 🚀! > > Reading the PR, it looks like `$indent=0` is essentially turning off > pretty-print, which I think is intuitive. Basically, yes. With `$indent=0`, no indentation will take place but new lines will still be added. > Do you plan to add any sort of validation on negative integers? > Perhaps throw a `\ValueError` exception on $indent < 0? Good question. Personally I'd prefer clamping $indent to 0 when it reaches below 0. But I'd like to hear about what other particpants think about such behavior. Thank you for your feedback :). -- Kind regards, Timon de Groot