"Escalate? Oh how I wish I had someone to escalate to." Classic.
PHP Bug: #50696: number_format when passed a 0, returns null
11–20 of 51 posts
Re: PHP Bug: #50696: number_format when passed a 0, returns null
#12Interesting discussion in there, but I think the PHP guys are right on this one. You should never rely on undefined behavior of any API for mission critical code. Always use what is documented so you don't have to cry later..
The PHP guys are right in the same sense a store is right that it doesn't have to take a return without a receipt. But most stores will do so anyway in order to maintain good will. Whenever we come across undocumented or undefined behavior that will change in a new release, we try very hard to not change it unless it's absolutely necessary.
Re: PHP Bug: #50696: number_format when passed a 0, returns null
#13This is why I hesitate to release open source software.
Re: PHP Bug: #50696: number_format when passed a 0, returns null
#14It seems to me that the entire process of testing and writing off is just as important when changing the target platform as it is when changing some of the API calls.
Re: PHP Bug: #50696: number_format when passed a 0, returns null
#15Earlier quoted context omitted.
The PHP guys are right in the same sense a store is right that it doesn't have to take a return without a receipt. But most stores will do so anyway in order to maintain good will. Whenever we come across undocumented or undefined behavior that will change in a new release, we try very hard to not change it unless it's absolutely necessary.
I would argue that it makes a lot more sense for a non-number to return NULL than to return 0. If it returns 0, how do you distinguish between "0" and ""? At least with a NULL return value you can use the function to see if you're even looking at a number at all.
Re: PHP Bug: #50696: number_format when passed a 0, returns null
#16Re: PHP Bug: #50696: number_format when passed a 0, returns null
#17Re: PHP Bug: #50696: number_format when passed a 0, returns null
#18If "" == 0, meaning "" is coerced to 0, shouldn't it coerce to 0 here too?
Re: PHP Bug: #50696: number_format when passed a 0, returns null
#19Go PHP!
Re: PHP Bug: #50696: number_format when passed a 0, returns null
#20This is funny because it's not really a bug at all. I side with the PHP guys on this one. Passing in a string to a number_format function is not even proper form in the first place. I do agree that it should always default to 0 instead of null because it is a numeric function, but still. The usage is the main problem in this case - and who wants to fix a bug for an asshole anyways? A lesson to all who rely on edge ca…