Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:118312 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 52937 invoked from network); 29 Jul 2022 17:33:10 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 29 Jul 2022 17:33:10 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3F6141804BD for ; Fri, 29 Jul 2022 12:31:58 -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-vk1-f169.google.com (mail-vk1-f169.google.com [209.85.221.169]) (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 12:31:57 -0700 (PDT) Received: by mail-vk1-f169.google.com with SMTP id y129so2757824vkg.5 for ; Fri, 29 Jul 2022 12:31:57 -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=kb4bLnHZpKMquk3IoSWTV0AojlAmE8bC5ZQUQGzY3AA=; b=o3konAoZjAOv2RPfaZUgwKe7VmRyrK+XjGuK7zAxKe6uhcbGO37x0XJM0VXnDKUsmA b2vykIdY0JE3+i5UytVezw0YuWOIM/SICepXa2AtN0bAdPXKtChusZkAhqBCA1w/bRag /WlnfBsInevWaedipc72gzJqO29/rvqETHPW2HXCeF+EbZQikXx+gl2VMEv9FshNfW9R BNPPb1ZoVcvUMvhbrd59BoaaJc07S4NlBjsyGUoK9uk3jcMTIXj7IS3tfm1ijJSuKX8n LpACkeAvF4YulDMn3d6abaEmACf13ajSIfi1eVJg1HAL8uBHVoCtonhtORRnkiOuDbF3 Badw== 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=kb4bLnHZpKMquk3IoSWTV0AojlAmE8bC5ZQUQGzY3AA=; b=q4vE8OiYEOsIKwb6F0Gbv/BA+Gme4aMcLK+cl/HmKcwvk90S6PxxOhGU8FrjLFKhkh lBIdtR4hDDR2yOqanqrUdZuxnQ7mnG5wItvr1RS4IM1qkRDyF+ywx91h1/4qn73ImrLK 2czlD05Z1NZqxPs8qFCqBktI9hqM0Q9fdjsz7ERvPTgH4vE9ewpCYJLloqJLoqe6oAWO xiO0FRGTsu2aj5m9X2otLPbQNGtm+oKQ8i5xy7h+E0FX8i+H8bd87EpCzhaeXTCELpEr AWDHfyD8/F+mp7QIF4jOEH6eBOCnaOGIYTvuDjkjr+4DwwL1opEoqKJ0U6xIJ3cS1qIn h7iA== X-Gm-Message-State: AJIora8NVZuQLq70Iko4FN+L0gg/SVLKGakKFxjY7O1PiFf0c6OXb6iq zJOUhWIoAfOAX9Yu4Z64fQdrpM0pVABZ2vIqWI4= X-Google-Smtp-Source: AGRyM1vgteatj+2MLY6Pq4LzdlSJlG9jM3/eTLEDStip3Tj9HRhHZuMKBLfqAhkCilT+s6/GTjMFOWDAfXfU48g2EQ0= X-Received: by 2002:a1f:300c:0:b0:36f:eb7d:746f with SMTP id w12-20020a1f300c000000b0036feb7d746fmr1979559vkw.27.1659123117005; Fri, 29 Jul 2022 12:31:57 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Fri, 29 Jul 2022 21:31:46 +0200 Message-ID: To: juan carlos morales Cc: PHP Internals List Content-Type: multipart/alternative; boundary="0000000000000728e105e4f6b4d1" Subject: Re: [PHP-DEV] RFC Idea - is_json - looking for feedback From: michal.brzuchalski@gmail.com (=?UTF-8?Q?Micha=C5=82_Marcin_Brzuchalski?=) --0000000000000728e105e4f6b4d1 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Juan, pt., 29 lip 2022, 16:26 u=C5=BCytkownik juan carlos morales < dev.juan.morales@gmail.com> napisa=C5=82: > I am following the RFC guideline for the first time. ( > https://wiki.php.net/rfc/howto) > > As suggested there, I am here to get a feeling from you, regarding the > following RFC for PHP. > > # Change (draft): > > New function in php called like: > > is_json(string $string): bool > > ## Description > ### Parameters > string $string -> string to find out if is a valid JSON or not > > ### Return > Returns a bool. The function is capable to determine if the passed string > is a valid JSON (true) or not (false). > > # Why this function ? > > At the moment the only way to determine if a JSON-string is valid we have > to execute the json_decode() function. > > The drawback about this, is that json_decode() generates an in memory an > object/array (depending on parameters) while parsing the string; this lea= ds > to a memory usage that is not needed (because we use memory for creating > the object/array) and also can cause an error for reaching the memory-lim= it > of the php process. > Personally I'd vote NO. Cheers, Micha=C5=82 Marcin Brzuchalski > --0000000000000728e105e4f6b4d1--