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/
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php