Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:60925 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 76155 invoked from network); 21 Jun 2012 14:59:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Jun 2012 14:59:23 -0000 Authentication-Results: pb1.pair.com smtp.mail=laruence@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=laruence@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.42 as permitted sender) X-PHP-List-Original-Sender: laruence@gmail.com X-Host-Fingerprint: 209.85.212.42 mail-vb0-f42.google.com Received: from [209.85.212.42] ([209.85.212.42:54664] helo=mail-vb0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0D/06-42253-9C633EF4 for ; Thu, 21 Jun 2012 10:59:22 -0400 Received: by vbbfs19 with SMTP id fs19so428809vbb.29 for ; Thu, 21 Jun 2012 07:59:18 -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:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=OAu7sUopxHhgsXidPpdmCqDs/YN65IrMQn+oHfALJ2Q=; b=tM2xFZtM67jIkZPrAKSwK7fQaRTzqfuz26TQnoyXmo0YV9f+wf2dTAv2UKOJOxAlPm ymC0wjy3GxBfVKeG3rBsEyJM8BeMBaawZS1CTwLIXytCrO6rBwvMWhQlqcmV/VQFvAAl 4y/5iZWNIscv9OFHDmoAQzji6qNtznYTgWbEkcIO8wQuR3SBVDxix6acZXioTcGBwX4W 31mt5DdrEWlGXTojaWtBLugqRObpsy/PXA/VVBXIaCiB2vxPFkn1PpWuhDq0RFdghwHd HDRDq6i7p6V3kNULCQU6Ob3hvD6zw9kIJFKG16NNl8EnkLGYCA7aLCatKeqRjRg9iAGa jR4Q== Received: by 10.52.155.193 with SMTP id vy1mr11111880vdb.123.1340290758358; Thu, 21 Jun 2012 07:59:18 -0700 (PDT) MIME-Version: 1.0 Sender: laruence@gmail.com Received: by 10.220.162.141 with HTTP; Thu, 21 Jun 2012 07:58:56 -0700 (PDT) In-Reply-To: References: <20120621141241.GA25789@analysisandsolutions.com> Date: Thu, 21 Jun 2012 22:58:56 +0800 X-Google-Sender-Auth: af5S3seOaL08hULpAJX2HPapkwI Message-ID: To: Nikita Popov Cc: Daniel Convissor , PHP internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] json_encode() behavior for incorrectly encoded strings From: laruence@php.net (Laruence) On Thu, Jun 21, 2012 at 10:25 PM, Nikita Popov wrote: > On Thu, Jun 21, 2012 at 4:12 PM, Daniel Convissor > wrote: >> Hi Nikita: >> >>> PHP <=3D 5.3.13, PHP 5.4, master behave as follows when an invalid UTF-= 8 >>> string is encountered: >>> =C2=A0* A warning is thrown, but only if display_errors=3Doff >> >> So the warning is put into the error log? =C2=A0But only if display_erro= rs is >> off? =C2=A0And if display_errors is on, no warning is produced? >> >> That's very counter-intuitive and un-PHP-like. =C2=A0Someone mentioned i= t's for >> security reasons. =C2=A0By that logic, we should get rid of all error >> messages because they all reveal some information that can be used by >> attackers. > > Yes, I agree with this, but other people thing differently about it ;) I think I must missed some infos, I though you was talking that you want to generate wanrings without regard of EG(display_errors). thanks > > Personally I'd actually remove the warning completely with the return > false behavior. The return value makes clear that there was an error > and json_last_error() can be used to determine what exactly went > wrong. The warning seems redundant in this case and could actually > make the use more complicated. > > Nikita > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > --=20 Laruence =C2=A0Xinchen Hui http://www.laruence.com/