Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78739 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 75372 invoked from network); 5 Nov 2014 17:28:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Nov 2014 17:28:12 -0000 Authentication-Results: pb1.pair.com smtp.mail=are.you.winning@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=are.you.winning@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.48 as permitted sender) X-PHP-List-Original-Sender: are.you.winning@gmail.com X-Host-Fingerprint: 209.85.192.48 mail-qg0-f48.google.com Received: from [209.85.192.48] ([209.85.192.48:47788] helo=mail-qg0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 40/35-50436-B2E5A545 for ; Wed, 05 Nov 2014 12:28:11 -0500 Received: by mail-qg0-f48.google.com with SMTP id q108so12501427qgd.21 for ; Wed, 05 Nov 2014 09:28:08 -0800 (PST) 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=/6ZmMxcykk49c4tjcmKe/g0QhproWiUXuXVhyRjchQg=; b=VJUah+ugiLmTPtbxPLDiCnFmolWBVnmO9eVWneaJNpikY9gDTY1uPuLGJg4ETkYXQZ ZaLO4ZHXZESjmWGq4csaQI7rCTysUfMsIG4+c+MOTIMF5x79GtxUqrWJJ+y+7pqpLTGC tqBp54s76Icu/f3ExizXCa8ZKHZaCarijEd2tAe3BjLcwAH8q2Q4yxVhnO8VPd+YaE0w tEWEeeu7Bco4Oh/D8jFGnoeX0R78MK+xVIKE4aghOk/COCALehLV6Sbuj1D8IRxNBenS 941YHqirCxfNGCmcJ7hRxEy/n1Aosiz6ReVSTx2qRvxgY25e6SWZX7EPdiIkN2SXWg7/ 7r9w== MIME-Version: 1.0 X-Received: by 10.140.105.37 with SMTP id b34mr84468318qgf.91.1415208488593; Wed, 05 Nov 2014 09:28:08 -0800 (PST) Sender: are.you.winning@gmail.com Received: by 10.140.239.194 with HTTP; Wed, 5 Nov 2014 09:28:08 -0800 (PST) In-Reply-To: References: Date: Wed, 5 Nov 2014 17:28:08 +0000 X-Google-Sender-Auth: 02qbONBVDf1rk70bVQFu4KltBJk Message-ID: To: Jakub Zelenka Cc: Chris Wright , Ferenc Kovacs , Juan Basso , PHP Internals Content-Type: multipart/alternative; boundary=001a1137c9283eeee805071fe7dc Subject: Re: [PHP-DEV] Add a new flag for json_encode From: cw@daverandom.com (Chris Wright) --001a1137c9283eeee805071fe7dc Content-Type: text/plain; charset=UTF-8 On 5 November 2014 17:21, Jakub Zelenka wrote: > > > On Wed, Nov 5, 2014 at 4:52 PM, Chris Wright wrote: > >> >> I'm sorry, but I don't understand why it would need to be deprecated. For >> me "making it the default behaviour" would mean "changing the default value >> of the $flags argument to JSON_PRESERVE_FACTIONAL_PART". The flag would >> still function in exactly the same way - old code which pass flags >> explicitly would continue to work in the same way, and any code which did >> not want the new behaviour would only have to pass 0 to flags to get that >> behaviour back. >> >> > > Then passing any flag will automatically disable it unless all current > constants will be ORed with that value. > > It means if you set default as (options = JSON_PRESERVE_FACTIONAL_PART in > zif_json_encode) and you pass just PHP_JSON_UNESCAPED_UNICODE then > fractional part will be disabled (unless the constants are ORed). It's not > really default like other defaults in json_encode because it's changed by > any flag. > > Indeed, but this is how anything else in PHP with a $flags argument works... if I pass ENT_QUOTES to htmlspecialchars() it isn't handled as ENT_COMPAT | ENT_HTML401 | ENT_QUOTES. When you pass a $flags argument to a function explicitly, you are saying "I don't want the default behaviour, I want more control", so I would be a little surprised if my controlled options were suddenly changed and now I have to add another flag to get the behaviour I wanted (and had before the default value was changed). Of course, this is just my view :-) Thanks, Chris > That being said if it's just me who doesn't like it and there are no other > objection, I don't mind if it gets in. Let's just wait few days if there > isn't anyone who also thinks that adding such feature to micro release is > not the best idea... > > Cheers > > Jakub > --001a1137c9283eeee805071fe7dc--