Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85771 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 45857 invoked from network); 10 Apr 2015 16:37:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Apr 2015 16:37:31 -0000 Authentication-Results: pb1.pair.com header.from=jakub.php@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=jakub.php@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.181 as permitted sender) X-PHP-List-Original-Sender: jakub.php@gmail.com X-Host-Fingerprint: 209.85.213.181 mail-ig0-f181.google.com Received: from [209.85.213.181] ([209.85.213.181:37476] helo=mail-ig0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AB/C0-41461-A4CF7255 for ; Fri, 10 Apr 2015 12:37:30 -0400 Received: by igblo3 with SMTP id lo3so2370169igb.0 for ; Fri, 10 Apr 2015 09:37:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=YSsWR3vGBZIbhc2kFFc0a2imDhNjQaYTmc3Wgz/5fUw=; b=XjU+lUw31DdAexOTR0RJl0KcLGPUEN2i+3D/euzKIVndoSjUyY7B1Z6c0LLNqV1vnw lbOCKyFvFSYXZdoxG9wGqRaTOivCyDiQoL997TbYdOw86VkTQZ/wloFJ0I54YPeSgHZs Buq5xHWoMnanTLJKvSPlQ8VIPYno4mVjWoiqs32KLLhj3RS9mg6TCrK5jLGXxzrGFflW t82w4xaPYexBUD+N7fL4xyUBZSubtfVzifn00B88WNMGdGEM/7BqIfEC/lpYTmub4uww rRxdCEUt1G8ctzROViRY5iSALA3ivGC3+7wkYjWce4VIK9CgUxngtjNe5YvGomvqnLP+ RVvw== MIME-Version: 1.0 X-Received: by 10.50.7.34 with SMTP id g2mr2661553iga.36.1428683847092; Fri, 10 Apr 2015 09:37:27 -0700 (PDT) Sender: jakub.php@gmail.com Received: by 10.107.39.18 with HTTP; Fri, 10 Apr 2015 09:37:27 -0700 (PDT) In-Reply-To: References: Date: Fri, 10 Apr 2015 17:37:27 +0100 X-Google-Sender-Auth: AIzVnLjeJbqKITEVuIiQmjRBGx0 Message-ID: To: Yasuo Ohgaki Cc: PHP internals list Content-Type: multipart/alternative; boundary=089e0122eda033d07f05136161c3 Subject: Re: [PHP-DEV] JSON float number as string From: bukka@php.net (Jakub Zelenka) --089e0122eda033d07f05136161c3 Content-Type: text/plain; charset=UTF-8 Hi Yasuo, On Fri, Apr 10, 2015 at 1:29 AM, Yasuo Ohgaki wrote: > > Could you add "json_encode" type hint also? > > Large int/float must be treated as string or GMP object (we don't have GMP > float yet, though) > Currently, there is no way to encode large "numeric" JSON data correctly > when it is stored as > string. > > string json_encode ( mixed $value [, int $options = 0 [, int $depth = 512 > [, array $type_spec = NULL]]] ) > > where $type_spec specifies correct data representation. i.e. numeric, > string, bool > > json_encode() type hint should work like Zeev's type hint. > i.e. No data type conversion, but validate its content. > > Again this is a bit off-topic. I think that it would be good if you could create a bug report for this. It would be great to add an example how the $type_spec should work (e.g. if you mean something like http://json-schema.org/examples.html ) Cheers Jakub --089e0122eda033d07f05136161c3--