Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:118535 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 32605 invoked from network); 29 Aug 2022 09:06:10 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 29 Aug 2022 09:06:10 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id BF16A1804AB for ; Mon, 29 Aug 2022 02:06:08 -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_H3,RCVD_IN_MSPIKE_WL,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-ot1-f41.google.com (mail-ot1-f41.google.com [209.85.210.41]) (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, 29 Aug 2022 02:06:08 -0700 (PDT) Received: by mail-ot1-f41.google.com with SMTP id m21-20020a9d6ad5000000b00638df677850so5476102otq.5 for ; Mon, 29 Aug 2022 02:06:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=x08kaBAefwERDOfaJhRgOENBAKYPplXGZP2RrVKezNY=; b=hKGJAMyB/OpWXPd8kGUVBVxb4lBMCmyVWus0+HzzuEFQuz9R4SYOAj5WBHC+0py3wb vrIBz5B1LXqTvTW+Npkyxe39jfUc4CA3ln+l0V0Msf/9eHkVMVIHUTDHc7XJ5Lp2P/zD VBQsgvEwPP5U4YX07kn1kyvi7LkfoKC3A9tMoOge0HIM9R9muCgscpjdsY0lksROR9B+ MK8lU6ANurEVMaM+e5PDvBK9fz8qpwGrDAp8sLTJB38eTn48PGiHDhmWpch/1KTVCe5h CMesYYkbYcM0BSjPY8rIvSnLrpPbjBAKAVlLjqhWizofYeCeY1UzjfBMs3aGYcI2M64J QHng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=x08kaBAefwERDOfaJhRgOENBAKYPplXGZP2RrVKezNY=; b=37S0Utq4lNhkSaSsgFB3BTQdAWuYhUc7/83lSehe9XosON7zye94JsV48B/THzMfQD cwwC1644/DNEplcJuCtJNAT5OircfdkJCuN3Ql816s1c/3Nb1xtT1JFJXUSKf2WCa0c9 jGbhI9XVYFPuPfDU0KQAklMuHIuKQROTuWsUJfGzPr0/EBX+DYgAUDh1ssuclplb+z1a cNZOtqzjpjHXZnO8nvuQ6Q4D4gqK8q9uHimUrbSJeraUMUdeKdQwv2LPDh/YjpVyw82x y6PqsdLDKeeNcgCYpf/dVVT6F1AOAygnM1N/e+qY8u52IeXhOM1zLbuiyX3wIMTIdoVg 76bw== X-Gm-Message-State: ACgBeo0/IpAQm4PBFZFj8kCfKkQuD+E0JABYfwL34HcovLf4VaojT7HF QKTQNFzV+BiOmnZkWsLe4xliyY26U9KbLZenHTg7g0n5kGE= X-Google-Smtp-Source: AA6agR6fgV4meXTd7Ommv4vjvADqpNvcb6aWyQnEmQQLi7yNucDm/BtZDHEzFa8CB6xiIEYzTEeinIv1W8PRrVtItcA= X-Received: by 2002:a05:6830:577:b0:637:1cb5:857 with SMTP id f23-20020a056830057700b006371cb50857mr5988278otc.55.1661763967629; Mon, 29 Aug 2022 02:06:07 -0700 (PDT) MIME-Version: 1.0 References: <8D53AD5B-7CFC-4820-9EE4-FEB365D327A8@woofle.net> In-Reply-To: Date: Mon, 29 Aug 2022 11:05:31 +0200 Message-ID: To: juan carlos morales Cc: PHP Internals List Content-Type: multipart/alternative; boundary="000000000000fdbc3c05e75d9271" Subject: Re: [PHP-DEV] RFC json_validate() - status: Under Discussion From: deleugyn@gmail.com (Deleu) --000000000000fdbc3c05e75d9271 Content-Type: text/plain; charset="UTF-8" On Mon, Aug 29, 2022 at 10:50 AM juan carlos morales < dev.juan.morales@gmail.com> wrote: > There is still 1 open question on the RFC, and is about the return value. > > https://wiki.php.net/rfc/json_validate#open_issuesquestions > > I would appreciate your feedback on this. Even though I was told the > RFC can go with 2 votings, I would like to know your thoughts about > that open question, in short, the return value. > Has the option of returning a Result object been discussed/considered? Can it be an option? I imagine that if `json_validate(): JsonValidationResult` always returns a `JsonValidationResult` which contains a `public readonly bool $valid` and a `public readonly ?string $error` it would be better than both options on the table right now. The option of returning CLI-like results means that we will need a `if (! json_validate())` to treat a valid JSON (really awkward) and the option of using `json_last_error()` relies on an internal state instead of an immutable structure. Effectively, what we need is to return a complex structure which can contain a boolean and a string and that is a class/object. Thoughts? -- Marco Deleu --000000000000fdbc3c05e75d9271--