Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109921 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 1813 invoked from network); 29 Apr 2020 14:55:54 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 29 Apr 2020 14:55:54 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 172621804C2 for ; Wed, 29 Apr 2020 06:29:19 -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 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-lf1-f66.google.com (mail-lf1-f66.google.com [209.85.167.66]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 29 Apr 2020 06:29:15 -0700 (PDT) Received: by mail-lf1-f66.google.com with SMTP id l11so1659876lfc.5 for ; Wed, 29 Apr 2020 06:29:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=EUIrnA9pPzEWZGyOhx/eAC3Ig5iZqyXhPmXuDLGFYYs=; b=ApldxMlVKpkBhrE433NadSv/DPxfdYrlIQfJ97q5w5O96VEoyrWSiAPLIZxZEGPVrQ dp1JupmIcIqSSU4s+AbBM9WtcZ38aob4j3ZPmyqMFwq9rR+GJAmyPCzuFBZ9OL2wzc2G i4Dluym6qe7fXXQsu2FISKIONwxeG6LQHWK8GIepFP+qjU0Rkj2P+ohWq5uUBtzynwSC Y9GseFKIG0madlj/VP/Wq8CxjgTUG8N761BtpvAvyRpTu89TqBBKJ92RgMJP3kei7A3O ov5A6EaT9I28BQL383Ae6xiHMtCqKpRzwTbfYaxtOU4qIzBBdL3t4Ka14OwiX7FJcNWa 5sRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=EUIrnA9pPzEWZGyOhx/eAC3Ig5iZqyXhPmXuDLGFYYs=; b=T+hLUNJYWZ4EQzAXXKdTpj3JdGeIWRhwDyIuy3tRnRhD6faE7hPPywifbEQwfCbKPa Ar0/GdVaXWXneT7ERy0NQmly09SVJ0a9LlRoNjDeVtrhpk39exu+8Ag2NavajmSQHghU usv60Mr+NGF6v2WmP5USs6/iNj//ttydGyvOqDnbL1WG3/HFxnsgnAgcfUleVBNT9A8w sgH57qRJQwudfU8rnBX5z33sD60m04aBL86yg18AHjnNDETudshcnk+swsnWCKoa25o7 QJ5ZvnCIVwyAqYQy7w2tiXk8wHsTzgv4x8V/1NRa86eWBtaFogNIr660v5j1H7HTC+5A Pgtg== X-Gm-Message-State: AGi0Puad+zizZb0WiIVZg4905iElVfLAKSiilIhFEXJ+wgn6xLUS9ZHa OT8zUNYirXZvVOTbPCe7LK3HX4TvvaXc+7FPSnA= X-Google-Smtp-Source: APiQypLKaHx5QqpcTWrbNIWtLnd7P0+p7ztk6heghbH1E51rbIWsLM7Y+1pVuHV0Wy6L1ANg0/QOZ2yveh7X6MURcgY= X-Received: by 2002:ac2:531c:: with SMTP id c28mr1908812lfh.138.1588166952306; Wed, 29 Apr 2020 06:29:12 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 29 Apr 2020 14:29:00 +0100 Message-ID: To: Nikita Popov Cc: tyson andre , Internals Content-Type: multipart/alternative; boundary="000000000000094b2c05a46def10" Subject: Re: [PHP-DEV] Moving json extension to core? From: cdtreeks@gmail.com (Aran Reeks) --000000000000094b2c05a46def10 Content-Type: text/plain; charset="UTF-8" I've no objections to JSON becoming part of PHP's core, it's so commonplace these days I'd welcome it. If JSON were to become a part of core, what would people think about introducing support for a streaming JSON parser? Having worked with many integrations where you simply get shipped a large block of JSON, we've frequently encountered issues decoding that with json_decode() due to memory limits being exceeded when bringing it all into memory at the same time. I'm not completely certain how easily achievable this could be, but welcome thoughts from others. Regards, Aran On Wed, 29 Apr 2020 at 14:11, Nikita Popov wrote: > On Wed, Apr 22, 2020 at 7:38 PM tyson andre > wrote: > > > Hi internals, > > > > Currently, it's possible to disable the json extension with `./configure > > --disable-json`. > > However, JSON is widely used in many use cases - web sites, logging > > output, and as a data format that can be used in CLI programs > > to share data with many applications and programming languages, so I'd > > personally find it useful if it was always enabled. > > (e.g. to publish self-contained scripts that don't require polyfills or > > less readable var_export output) > > > > https://wiki.php.net/rfc/jsond mentions that > > > > > The current Json Parser in the json extension does not have a free > > license which is a problem for many Linux distros. > > > This has been referenced at Bug #63520. That results in not packaging > > json extension in the many Linux distributions. > > > > Starting in php 7.0, I'd assume licensing is no longer an issue (correct > > me if I'm wrong). I don't see anything discussed in the RFC or a quick > > search of email threads about making JSON impossible to disable. > > > > Doing this would also make some extensions more convenient to use (e.g. > > memcached with the json serializer, using json encoding for uses such as > > error messages in miscellaneous extensions, etc.) > > > > Another advantage would be that the JsonSerializable interface would be > always available. This would make things simpler for extensions that want > to hook into that. Currently we have a bunch of classes like DateTime, > which do have custom JSON serialization behavior, but do not implement > JsonSerializable, because the class is not always available. > > So tentatively, I'm +1 on making ext/json a required extension. > > > > P.S. What are your thoughts about adding additional conversion specifiers > > such as %j or %v to PHP to call JSON with the default options. > > It's a feature similar to those I've seen in programming languages such > as > > golang - https://golang.org/pkg/fmt/#hdr-Printing > > > > - `printf("console.log("value from php", %j);\n", $value)` > > - `printf("Some command returned %j\n", $boolValue)` > > > > Uh, dunno. Is it really common to want JSON inside printf? I see printf > mostly as something used to output to console, not so much in a web / data > interchange context. > > Regards, > Nikita > --000000000000094b2c05a46def10--