Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114715 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 83065 invoked from network); 3 Jun 2021 15:40:15 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 3 Jun 2021 15:40:15 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 433851804BE for ; Thu, 3 Jun 2021 08:53:47 -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,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 forward101p.mail.yandex.net (forward101p.mail.yandex.net [77.88.28.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 3 Jun 2021 08:53:46 -0700 (PDT) Received: from sas1-2c02ca35cfae.qloud-c.yandex.net (sas1-2c02ca35cfae.qloud-c.yandex.net [IPv6:2a02:6b8:c14:3992:0:640:2c02:ca35]) by forward101p.mail.yandex.net (Yandex) with ESMTP id B542432830C9 for ; Thu, 3 Jun 2021 18:53:43 +0300 (MSK) Received: from sas1-e20a8b944cac.qloud-c.yandex.net (sas1-e20a8b944cac.qloud-c.yandex.net [2a02:6b8:c14:6696:0:640:e20a:8b94]) by sas1-2c02ca35cfae.qloud-c.yandex.net (mxback/Yandex) with ESMTP id MBfF1tVRd9-rhJaGh2P; Thu, 03 Jun 2021 18:53:43 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=php.watch; s=mail; t=1622735623; bh=rn7/VAU1JHbFSvF01becUCrA1W1/G8R39lilrxDxUNI=; h=To:Subject:From:In-Reply-To:Cc:Message-ID:Date:References; b=HSJYFNyV+oFldrDuWfdLSNHOpIqdXhVLJXLnTIntuo/IoHiYFpVq0UTqUBlYOGGU8 0WYLv80qCPGqAWoDecSLSYAGSGZk/X7THu38gnVRu2UEqyZCqo6ximq7iBlR0EuJPa pHfA5P3TskogFC7YHPb7XQIs2lF9X9iZz6eYrlLU= Authentication-Results: sas1-2c02ca35cfae.qloud-c.yandex.net; dkim=pass header.i=@php.watch Received: by sas1-e20a8b944cac.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id zzvd44GTLN-rgLWRqkF; Thu, 03 Jun 2021 18:53:42 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) Received: by mail-oi1-f172.google.com with SMTP id m137so2851755oig.6 for ; Thu, 03 Jun 2021 08:53:42 -0700 (PDT) X-Gm-Message-State: AOAM532LnbJX5+d/H2dtu6oIua4BLW8ZyB2P0M2LlT++mEtRINdZbLwO ouDDzBOP3trxe4iWnY0FYPDZPJ0jmtiuBRd3Vvs= X-Google-Smtp-Source: ABdhPJxs511pl9kuC4OOfHzzan8E4t7HyR5dltH8EvYHy0EuOqBRysOvnokmqb82CyWiy0NdJ1TUphQh1cV/kBjgy9o= X-Received: by 2002:aca:d07:: with SMTP id 7mr357278oin.100.1622735618679; Thu, 03 Jun 2021 08:53:38 -0700 (PDT) MIME-Version: 1.0 References: <06f92428-a426-0afa-72ab-053e224a87ce@seld.be> <4c8f7ea1-6112-8046-846c-b701ab707752@gmail.com> In-Reply-To: Date: Thu, 3 Jun 2021 21:23:09 +0530 X-Gmail-Original-Message-ID: Message-ID: To: Timon de Groot Cc: PHP internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] json_encode indent parameter From: ayesh@php.watch (Ayesh Karunaratne) Hi Timon, Thank you for this RFC. I think the `string|int $indent` approach is great = =F0=9F=9A=80! Reading the PR, it looks like `$indent=3D0` is essentially turning off pretty-print, which I think is intuitive. Do you plan to add any sort of validation on negative integers? Perhaps throw a `\ValueError` exception on $indent < 0? --- Thank you. Ayesh. On Thu, Jun 3, 2021 at 9:19 PM Timon de Groot wrote: > > On 3-6-2021 16:15, G. P. B. wrote: > > That's incorrect, as of PHP 8.0 Fast ZPP has a way to deal with the mos= t > > common union types, including int|string. > > > > Best regards, > > > > George P. Banyard > > I found that STR_OR_LONG works fine, thanks for acknowledging! > > -- > > Kind regards, > > Timon de Groot > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php >