Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91363 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 85345 invoked from network); 23 Feb 2016 19:52:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Feb 2016 19:52:57 -0000 X-Host-Fingerprint: 2.218.134.83 unknown Received: from [2.218.134.83] ([2.218.134.83:23104] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 47/95-38634-798BCC65 for ; Tue, 23 Feb 2016 14:52:56 -0500 Message-ID: <47.95.38634.798BCC65@pb1.pair.com> To: internals@lists.php.net References: Date: Tue, 23 Feb 2016 19:52:52 +0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:42.0) Gecko/20100101 Firefox/42.0 SeaMonkey/2.39 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 2.218.134.83 Subject: Re: [RFC] Deprecations for PHP 7.1 From: ajf@ajf.me (Andrea Faulds) Hi Nikita, Nikita Popov wrote: > This RFC is incomplete -- I'm posting it now so people can suggest other > things that should be deprecated. I expect it to grow over time and don't > plan to vote on it in the immediate future. I think this would be a good opportunity to look at our existing php.ini directives, with view to getting rid of some more of them eventually. Three in particular spring to mind: * `precision` and `serialize_precision` - These determine how many digits are printed when outputting floating-point numbers. - `serialize_precision` is used when serialising or exporting numbers, and would seem to exist solely to allow you to shoot yourself in the foot, by discarding possibly important information when serialising - an operation that's supposed to perfectly reproduce a value! - `precision` is used in other contexts, and is more problematic, because its default value is 14 which is less than the maximum number of decimal digits in a PHP float. This means that, by default, PHP doesn't print floats to their full precision - including in var_dump(). This can create unreasonable confusion when debugging (why are two numbers that appear identical with var_dump() reported as inequal?), means potentially important information is removed by default, and really ought not to be a global setting anyway: if you want to format your numbers with reduced precision, do so explicitly. - Both of these are settings which code may implicitly depend on and break when they are changed. The manual is unhelpful here, because it doesn't warn you that `precision` is used when floats on any page except that for php.ini! * `mbstring.func_overload` - This piece of magic replaces the standard string functions with their mb_* equivalents. It is the character encodings equivalent of magic quotes: it simply assumes that all string operations on binary strings, if replaced by "multi-byte" versions, will suddenly handle character encodings properly. They won't necessarily, so this is quite a reckless setting. Worse, this setting prevents you from using the normal, non-"multi-byte" string functions when you need them for binary data, so PHP packages which deal with binary data are broken when this php.ini setting is turned on. Luckily, apps which rely on this setting being on could be easily fixed: by using find/replace. There might be others worth dealing with, too, these are just the first three I thought of. Thanks. -- Andrea Faulds https://ajf.me/