Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:60987 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 91129 invoked from network); 27 Jun 2012 11:40:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Jun 2012 11:40:32 -0000 Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.170 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.213.170 mail-yx0-f170.google.com Received: from [209.85.213.170] ([209.85.213.170:37093] helo=mail-yx0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 22/74-02132-031FAEF4 for ; Wed, 27 Jun 2012 07:40:32 -0400 Received: by yenl12 with SMTP id l12so899635yen.29 for ; Wed, 27 Jun 2012 04:40:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=K5DQL64+Ac+NtSYq6JAUYvwILl/saIHUIQQU6v+giLE=; b=sMJ7vIetk4G7EdzoDhF8+9tYQc6VJnyx65lzsrlp+ynGtFKWD4n5yKnpcVGexuC1R0 QAAlVEY865XaZqpkKa1s2GoOcMJne0fO0CpXP97b3+pSu7g3/iFtV4np5NKrPgm748AY 0J3CrwxP5uj9kRGlNZodrCjbsEBZhyFpAt/Y2uUgYzFqtcb93Ww62HLc8tB6XnCrCeaK PFLb5iZeRjQp8Tm9qw6YSPJC8ZJRzU4/affI39lEOYHYB/vXjIdZMfRYBfgI8NYX0qml P1qBPBZuwhMRc/FeywwOnTRCx7K5qv1vDPfZ5fZwN5esFzbCe8bcNYhz2EMcAH9tuikS XKhw== MIME-Version: 1.0 Received: by 10.236.79.74 with SMTP id h50mr22032067yhe.104.1340797230027; Wed, 27 Jun 2012 04:40:30 -0700 (PDT) Received: by 10.147.113.7 with HTTP; Wed, 27 Jun 2012 04:40:29 -0700 (PDT) In-Reply-To: References: <20120621141241.GA25789@analysisandsolutions.com> <4FE33EDF.2000409@lerdorf.com> <4FE61E9D.5050908@sugarcrm.com> <4FE734C4.2010706@lerdorf.com> <4FEA489D.1010601@sugarcrm.com> Date: Wed, 27 Jun 2012 13:40:29 +0200 Message-ID: To: Nikita Popov Cc: Benjamin Eberlei , Stas Malyshev , Rasmus Lerdorf , Gustavo Lopes , "internals@lists.php.net" Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] json_encode() behavior for incorrectly encoded strings From: pierre.php@gmail.com (Pierre Joye) hi, On Wed, Jun 27, 2012 at 1:30 PM, Nikita Popov wrote: >> Why not in the spirit of others have a new function json_last_error_msg() or >> something similar? > > I implemented it with json_last_error(true) returning just a string, > not an array. You can get the array using array(json_last_error(), > json_last_error(true)) if you really want. But usually you will only > need one of them as they both have different use cases. The > stringified version for debugging and the error code version for > detecting the error programmatically. I do not think this signature is consistent with the other error functions. I'd to go with the _msg or _string equivalent. Cheers, -- Pierre @pierrejoye | http://blog.thepimp.net | http://www.libgd.org