Edit report at https://bugs.php.net/bug.php?id=50696&edit=1
ID: 50696
Comment by: fdasfas at fas dot com
Reported by: endosquid at endosquid dot com
Summary: number_format when passed a 0 as first function
argument, returns null
Status: Wont fix
Type: Bug
Package: Math related
Operating System: Linux 32 bit
PHP Version: 5.3.1
Block user comment: N
Private report: N
New Comment:
^ 0 isn't some magic all-encompassing number. It means 0. NULL means no number
based on your shitty incorrect input, and is the correct choice.
Previous Comments:
------------------------------------------------------------------------
[2012-06-22 11:54:31] lskdjfsl at mailinator dot com
Just because Rasmus is some big dev does not mean he is right, I don't care
what
your zend_parse_crap() does, a function should return a value that makes sense.
------------------------------------------------------------------------
[2012-06-22 06:26:44] [email protected]
This is a bugs database and not a discussion forum (e.g., hacker news) so
please treat it as such. Sure it's nice to see all of this
excitement and interest in the PHP project (patches welcome! :) but let's try
to be productive and reasonable.
The bug status is "Won't fix" which means it will not change nor be reverted.
This report is 2.5 years old. And the current behavior
exists in both the 5.3 and 5.4 branches.
So while the discussion of this bug veered off course, and frustration was
shown, please consider putting energy towards other tasks like
submitting patches and creating RFCs.
------------------------------------------------------------------------
[2012-06-22 05:41:21] izanagisan at gmail dot com
at so many points in this conversation a little understanding from the
submitter
of the bug would have been beneficial. He led the thread into a silly fuss
instead of making it a search for solutions, even when in his situation there
was
little hope he'd get one. Surely Rasmus was the perfect person to help him, if
he'd just asked kindly instead of proposing the whole PHP development team was
mad for attempting to standardize the language a bit more
months or no months of changing and testing, he handled this poorly
------------------------------------------------------------------------
[2012-06-22 04:20:52] contact at joezimjs dot com
I agree with Endosquid. What you did isn't a "bug fix". Whether or not it
complies with your zend_parse_parameters() nonsense is not the point. A
function should only return values that make sense for that function to return.
number_format is supposed to return a string of a number in a specific format.
NULL is neither a string nor a number.
However, the documentation does dictate that number_format's first parameter is
supposed to be a float, and it is the programmer's job to supply correct
parameters to the functions they use. If you supply a string when there should
be a number, you're doing it wrong.
Sooo, you both fail at your jobs. :D
------------------------------------------------------------------------
[2011-08-23 01:41:43] jacob at jacobweber dot com
Fun thread! Anyway, I was wondering if anyone has a complete list of the
functions
that changed as a result of this zend_parse_parameters() fix. I don't see
anything
specific in the upgrade instructions:
http://www.php.net/manual/en/migration53.incompatible.php
Also, will number_format((float) $x) behave under PHP 5.3.x exactly the same
way
that number_format($x) behaved under PHP 5.2.x? Are there any subtle
differences?
Thanks.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=50696
--
Edit this bug report at https://bugs.php.net/bug.php?id=50696&edit=1