Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:118489 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 42333 invoked from network); 26 Aug 2022 09:00:24 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 26 Aug 2022 09:00:24 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id CDEC0180339 for ; Fri, 26 Aug 2022 02:00: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-vs1-f44.google.com (mail-vs1-f44.google.com [209.85.217.44]) (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 02:00:23 -0700 (PDT) Received: by mail-vs1-f44.google.com with SMTP id n125so1045098vsc.5 for ; Fri, 26 Aug 2022 02:00: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=P3WOuzq5/hCjf4gCNokMUwmNyl5z/qC4X2htOM6lAw8=; b=LECjWXgXKACaHWp53o72z6bSIYN860pMy8pgE5BvQOiq7+G3xVy0ufDfQXle2URSPp /+Xr7swEuDVx2BaKJ/sAFJ9WKW6/j6zSoiu44JejK3kHbjEcgfMyAvQ566BPd0yxYbr1 eLE8fw5zsk6s4WR6Bo4u9OoKvlj9v3wPPZYWU2X8pI5Wfk4kjGW3F7uiMMCleasRYt3r 08pUmCiOr96Dm+hnUdXkZb0MlVWRRrwzCBoW1yql9k0TyZMUYN5xA6hd1WVO5VDQDUXg 1JlgfKzfNA3k3CXqox8IWM/VI85AokymswGkraTHaTyBrb/h0TYSriP80LcdosPl2pN3 +Inw== 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=P3WOuzq5/hCjf4gCNokMUwmNyl5z/qC4X2htOM6lAw8=; b=36rX1/37Q0/ludtvbmHKFyn6NcvMXpgjUzCi9BXQBtoiRipUp+Jrv1T6lHGBqa6wDZ QYf8OWamq18YIwKKxBkP1WpTYBJkahEeN/SKed2t8sPtQJspUCsIggoBxWLq/q1JfFFQ yN46FLee61dWS+hWc1ehktb+YKiOerrNDQ3AxGQc+wxG3e7enIWVJW4iMqeUhxJFhkzQ u3Mkr3gAtY5tc/qFLFzaNxfyo7M9vLKPeeRtK08ccNvljiOM+Aw3dUPSAeWhfzzY2pRd C0yLJmJtD7fIAanXt3lWQybn5ZyzSC5nh/zScQ4MKTxPmGOQUH5BpcU8VFy77B9AW3Zw 6p6w== X-Gm-Message-State: ACgBeo0Y+P/yViDkpRIZ5zX7bH4wDAiRGEthxm//IXEA5GKAU5LQdDSG moN2yg3dbgc9K6Mm1TpJq1aaypvZDi+UCmz/XL4GwAIZohM= X-Google-Smtp-Source: AA6agR4BSJ+ZbU80vwhJmLfX5kA1I9TS0a79d9XMolj0VNa763Rync7pWkydhKzwJOEvVgAp46fNJO4n0+qPCKE8B4s= X-Received: by 2002:a05:6102:40d:b0:390:54c6:b51a with SMTP id d13-20020a056102040d00b0039054c6b51amr3277481vsq.13.1661504422546; Fri, 26 Aug 2022 02:00:22 -0700 (PDT) MIME-Version: 1.0 References: <8D53AD5B-7CFC-4820-9EE4-FEB365D327A8@woofle.net> In-Reply-To: <8D53AD5B-7CFC-4820-9EE4-FEB365D327A8@woofle.net> Date: Fri, 26 Aug 2022 11:00:11 +0200 Message-ID: To: Dusk Cc: David Gebler , juan carlos morales , PHP Internals List Content-Type: multipart/alternative; boundary="000000000000e611ab05e72124f4" Subject: Re: [PHP-DEV] RFC json_validate() - status: Under Discussion From: michal.brzuchalski@gmail.com (=?UTF-8?Q?Micha=C5=82_Marcin_Brzuchalski?=) --000000000000e611ab05e72124f4 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Dusk, pt., 26 sie 2022 o 08:17 Dusk napisa=C5=82(a): > On Aug 25, 2022, at 21:47, Micha=C5=82 Marcin Brzuchalski < > michal.brzuchalski@gmail.com> wrote: > > The same goes here and I'm not convinced we should introduce next small > function that can be simply implemented in user land. > > What "simple implementation in userland" do you have in mind? Can you > provide an example? > > json_decode() is not an acceptable substitute here -- as David Gebler has > observed, decoding a large JSON structure can have a significant impact o= n > memory usage, even if the data is immediately discarded. Any implementati= on > based on string processing, on the other hand, is likely to be dramatical= ly > slower, and may have subtle differences in behavior from PHP's JSON parse= r. A `json_decode()` is a substitute that IMO solves 99% of use cases. If I'd follow your logic and accept every small addition that handles 1% of use cases, somebody will raise another RFC for simplexml_validate_string or yaml_validate and the next PhpToken::validate. All above can be valid if we trust that people normally validate 300MB payloads to do nothing if they DON'T fail and there is nothing strange about that. Cheers, --000000000000e611ab05e72124f4--