Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:118319 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 96075 invoked from network); 30 Jul 2022 04:45:32 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 30 Jul 2022 04:45:32 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id AB4D4180380 for ; Fri, 29 Jul 2022 23:44:28 -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-yw1-f173.google.com (mail-yw1-f173.google.com [209.85.128.173]) (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, 29 Jul 2022 23:44:28 -0700 (PDT) Received: by mail-yw1-f173.google.com with SMTP id 00721157ae682-3238de26fb1so50650377b3.8 for ; Fri, 29 Jul 2022 23:44:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=bohUOFLLqG+Zgoa9Z2l0c+e+LwqoX1FQKU7DaHJSpGA=; b=M4YC5w+xrk4SlxfYJg2A4EYWsE07Llhx0Sg/m4Gf4mh9JKZHAO1vu/Jv9myTdtW36p C0uDQAOxTinNGkJd39ur59TV/vpe4BV+q3XiekhjxUNvDvro5BkCWUkxMXxY+w8T6Vo1 wthaIt39/qjTCK57f7VGWNr13wr5S8iR8gYciAQvKgOFOzeQEz7XwWTQd0BFQ+fee1qn VMWkTcdYrJR+sbPycNAImpVsa+gQf5yoxrReioFsid3Ra6xYFbidQbm+5Gp5Bw3esxKG nV2AbitXmyID51jXB19bhGKlPmGkKCmBiKrfuVBkkJQioPo8bdCaTYUgGLEv2wsUY229 wdvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bohUOFLLqG+Zgoa9Z2l0c+e+LwqoX1FQKU7DaHJSpGA=; b=iNOlLplQh+F0BEio3ek+eYYbTrIw61LnXEqIEOPTCy9WV/OOnD2L7ZE1LWE0H6S0Oi m9DutRCKgyNtQwRODYBHsb1sn3wZut/cAC+cM0eUf/X+YV8lAJ1Vmr6nnLAE7JuMudGz 5XdFTWiMb6SWUbD+4CQx/0olY6RxVIPa9wxo2ZdOQ0nd6ylNnDooYODqneV/M2+suijy QzFf5TRMwfZI6oPFCLLTbuMuvy3k6JTfnSiDSTvUzTDXK7HSrKWwQtxaKCJyVRLYOF0j Uw+9VwxhN2MK7+j11y73AT0j0a5vs1dtxXlMu0uoFDfMOIZ0H0jw780QNBB07ZqXq40h EMug== X-Gm-Message-State: ACgBeo3nJ2+VjG7mZJU22cYUtTB/+1TSY4AzdMBx6EQS5ik3JxZnTYZo 6bjLSA9HhQAreNbI2Wn7CntIBYUmxAImuLHgw50= X-Google-Smtp-Source: AA6agR5PsNsX76PZD7c3EZ2T2lAskmLONZs9xBW/f6+bsR+1jisY3vc0VtUSWjbKjxR/vrkyzTnRPP/ujM2TLPbmQE0= X-Received: by 2002:a81:a154:0:b0:31f:4847:8dc with SMTP id y81-20020a81a154000000b0031f484708dcmr5815253ywg.501.1659163467757; Fri, 29 Jul 2022 23:44:27 -0700 (PDT) MIME-Version: 1.0 References: <0d5ad8ab-aa7a-c37c-2d26-17e6b6953b4e@alec.pl> <5426361E-43A2-4B3D-9042-57FAD6F1FF0D@woofle.net> In-Reply-To: <5426361E-43A2-4B3D-9042-57FAD6F1FF0D@woofle.net> Date: Sat, 30 Jul 2022 08:44:17 +0200 Message-ID: To: Dusk Cc: Aleksander Machniak , PHP Internals List Content-Type: multipart/alternative; boundary="0000000000001ebcca05e5001946" Subject: Re: [PHP-DEV] RFC Idea - is_json - looking for feedback From: dev.juan.morales@gmail.com (juan carlos morales) --0000000000001ebcca05e5001946 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable El s=C3=A1b, 30 jul 2022 a las 8:30, Dusk () escribi=C3=B3= : > On Jul 29, 2022, at 23:05, Aleksander Machniak wrote: > > json_decode() has $depth argument, I think is_json() probably also > should. And I'm not sure about JSON_INVALID_UTF8_IGNORE flag. > > > > My point is that if you use these with json_decode() you might also nee= d > to use these with is_json() > > How about if validation were a flag to json_decode() -- perhaps > JSON_VALIDATE_ONLY -- which made it return a placeholder value like true > instead of the decoded structure? (It can't return null on success; that'= s > used for errors if JSON_THROW_ON_ERROR isn't set.) > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > > I thought about that too, and yes can also be a valid approach that would not interfeer with my development. What I personally dont like about that approach is that a developer is able to specify flags that are related to exclusively with result generation, and when they get mixed with JSON_VALIDATE_ONLY would not make sense. for example: json_decode($jsonStringHere, false, 512, JSON_BIGINT_AS_STRING | JSON_INVALID_UTF8_SUBSTITUTE | JSON_OBJECT_AS_ARRAY | JSON_THROW_ON_ERROR | JSON_VALIDATE_ONLY); So the end result, is not clear by reading the line itself, I mean , the mechanism (of having another constant in json_decode()) is not enough to make the function self-expressive. --0000000000001ebcca05e5001946--