Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:118527 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 52305 invoked from network); 27 Aug 2022 00:50:25 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 27 Aug 2022 00:50:25 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9A5C11804B5 for ; Fri, 26 Aug 2022 17:50:23 -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, 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-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) (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 ; Fri, 26 Aug 2022 17:50:23 -0700 (PDT) Received: by mail-ed1-f49.google.com with SMTP id b44so3927191edf.9 for ; Fri, 26 Aug 2022 17:50:23 -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=KTGalCqLL9ciNbnTTpbmUUiqxQ/cH/LEg6UjEIjrNvE=; b=ZCLCmTO5n2UMCXcDhg8rnQtaLfLut3g8QkE1yoJADufgU4WdojJUIGvpfoCq3CPPnQ rh7kV/oZK/o3EAHrqxQV1nyOtJDVuneA8+944scR9HPIbeCG/7bxrDvN+wFajrwAVey0 p/tlgGEWuVpwfKcPai83X1C6+hXHBV6VKPF6OcwP4ZiOwNt4wjXcV43OQ7SJHKjYlICR ZD3go7O5k9V+pVcPOxGpu9q/SpL+HHf+0JIq5IXSwrV65SCBqVjp9fcjtGRLFFOo6jOa MZz9ebi1Yi/+BISM1DojMm2doySw3rcJRf+80nMAY+z7HfuOQxiIuWct1ORPlr7vynp/ lCfg== 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=KTGalCqLL9ciNbnTTpbmUUiqxQ/cH/LEg6UjEIjrNvE=; b=yIvO+ZgVnBDqJHxWSFFECdMVwiRjJjKwHQezGtSrc/58DoHyHPDlo1h50OEAiodm2p aUY2Re6JX0xqtP/9R+25aqyvwOFJSrK+uaVELjrHcM0uNnrVURGbjjXuiVAThPJ8SsjM 91N1CgCdnlCNChKUEOwvQcdNO5gi6nwIIaT4QyRmJR6PObDHDKOfCUR08WWeBNtOMI7k GXmUU/SLC8KmlucV38u6G+f0JpBbx1638z/WQ3JzrHMzxBZ0E7sq5NKwqNphcOTxbHzR ERpJNKqjJXcDIfPlulgWVbF5wT+Q2/uzvQjBSL2ZPEBMaVNCvzOLEMTaELQiyXwc/2aT w3iw== X-Gm-Message-State: ACgBeo0W/HqETCQW+XJvkV3sQbm0cogiywt1A/yZ8DvWwBzp1fgtpMq2 8zwZVVTuwY9f/KIbBcxF7zf6q1xSWpaWdqNxb49d1UnQ X-Google-Smtp-Source: AA6agR7UCUinpuWIYHCIROMnTTV+HnpqGZ9XgMm8j9lRpvf0nvznNoRvPF45S78mQNbZ0AE2vMdR8u7/4RWvam3KC0Q= X-Received: by 2002:a05:6402:3590:b0:447:a871:c48a with SMTP id y16-20020a056402359000b00447a871c48amr8372647edc.356.1661561421940; Fri, 26 Aug 2022 17:50:21 -0700 (PDT) MIME-Version: 1.0 References: <8D53AD5B-7CFC-4820-9EE4-FEB365D327A8@woofle.net> In-Reply-To: Date: Sat, 27 Aug 2022 01:50:10 +0100 Message-ID: To: juan carlos morales Cc: PHP Internals List Content-Type: multipart/alternative; boundary="00000000000053cd6405e72e6ab5" Subject: Re: [PHP-DEV] RFC json_validate() - status: Under Discussion From: davidgebler@gmail.com (David Gebler) --00000000000053cd6405e72e6ab5 Content-Type: text/plain; charset="UTF-8" Juan, You can always offer two votes on the RFC - one for the function itself, then one for should it return boolean or return an int representing the json_last_error constants and let it be decided that way. I think on the whole, I agree with the sentiment that returning boolean and checking json_last_error() on false is probably the best / least worst option. So if I could vote, I would vote yes and for the boolean option, with a secondary preference for returning int if boolean option is rejected. And I was unconvinced about the whole idea originally, so a good example of where positive, robust discussion can change someone's mind. Good luck with progressing the RFC, I don't think I have anything else to add. On Sat, Aug 27, 2022 at 12:46 AM juan carlos morales < dev.juan.morales@gmail.com> wrote: > OMG, I need to take a rest, sorry for this, here it goes again; the > about JSON_INVALID_UTF8_IGNORE opinion is the same, but previous code > was wrong > > Code: > > > var_dump(json_decode("{ \"a\xb0b\" : \"dummy\" }", true, 512), > json_last_error_msg()); > var_dump("------------"); > var_dump(json_decode("{ \"a\xb0b\" : \"dummy\" }", true, 512, > JSON_INVALID_UTF8_IGNORE), json_last_error_msg()); > > Result: > > NULL > string(56) "Malformed UTF-8 characters, possibly incorrectly encoded" > string(12) "------------" > array(1) { ["ab"]=> string(5) "dummy" } > string(8) "No error" > > Saying so, now ... yes I support and think is NEEDED the usage of the > JSON_INVALID_UTF8_IGNORE , as json_validate() result goes in the same > direction with json_decode(). I think we need to have this flag. > > RFC: https://wiki.php.net/rfc/json_validate > Implementation: https://github.com/php/php-src/pull/9399 > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > > --00000000000053cd6405e72e6ab5--