Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109919 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 96603 invoked from network); 29 Apr 2020 14:38:07 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 29 Apr 2020 14:38:07 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9D5C31804C2 for ; Wed, 29 Apr 2020 06:11:31 -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-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) (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:11:30 -0700 (PDT) Received: by mail-lj1-f171.google.com with SMTP id a21so2501476ljj.11 for ; Wed, 29 Apr 2020 06:11:30 -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=oUFSO5BloQNa7cA0EMc9PuI/7RZKgBSghHGWM4XclpM=; b=gRQJyyvJQ50RpYV/z4yf50xE69tEw/nO7stLdpcqnNxLykDpUTqRBfrgtk03llwrLN WVg/GKNp0+Yq4sjCzNwW/36p1UJpILYE61oJ8BqJFg8WXnQeLTYrSsP5JGtidxNTFC7/ aKESSUnmyi1jj1OYx0NSoYwNHsdQONRSTtTAQFEdDqaFaxuSkQN2HhuQ1SzHYc4hBjeF Xyu4MWHrnCauhQ1XmSxH8ieA0tuQhEuwK/eNKmYNoJtjaKzNa9cAh/A8MJi5UVszOYY7 juToUl8BTp0bKNpghQgGA+jeFGEVWu2Jd1AyYnxGbI9qEI+PIq7569+pTAK1d1JhM3Ez +q9g== 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=oUFSO5BloQNa7cA0EMc9PuI/7RZKgBSghHGWM4XclpM=; b=uNIB7o2pIEmULPZaxArCB8SYcHXXqREthoBeC4XuvQlzouRJ1BwbtoAerAIPGByiyK qWxiy5/Z6RmjekOZozlB+LHb5ykatJsJb7TuLqf5+q2BXE97sPVgcogzkd1ZTCfPs63w YB855LKcwpEqny4zEnxDIgIV+rRDLKXsCg/Nj4BH6OYxJX24K8Dowe6N5+FHC31nS/JM kAIjLxj/Fns6492I/P/x2cAOvjNelrf2TLS59xhqy9zbDf9xbn3T+XgXOIBSxUMoMv7i 3JoOb/V3saOJHJhH68yQXkxFt6WQy0Hs9eWgirl6X7FP0g9e89E29KRGVPsTWOD9DPgL rkTg== X-Gm-Message-State: AGi0PuaDyd7TNCuvH261TsuWi2CKABF+ZUORxoIQYTzi10HVfnaQfYr8 1mv12brCej0HvNrE2dZ7PPPJUWDLgzub4a1Vq8E= X-Google-Smtp-Source: APiQypLUtZhpW891hkdO7hR+TkfYKKJkYIlNVgVoafzxCNeeZ3AjQm3aqGshJIRuYQrGLUKF0sp/rDjbmBP/4EG7xyc= X-Received: by 2002:a2e:81d5:: with SMTP id s21mr20455179ljg.258.1588165889138; Wed, 29 Apr 2020 06:11:29 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 29 Apr 2020 15:11:12 +0200 Message-ID: To: tyson andre Cc: Internals Content-Type: multipart/alternative; boundary="000000000000aaa42705a46dafeb" Subject: Re: [PHP-DEV] Moving json extension to core? From: nikita.ppv@gmail.com (Nikita Popov) --000000000000aaa42705a46dafeb Content-Type: text/plain; charset="UTF-8" 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 --000000000000aaa42705a46dafeb--