Nothing

Nothing to see here. Move along.
User avatar
b0b
Posts: 29108
Joined: 4 Aug 1998 11:00 pm
Location: Cloverdale, CA, USA
Contact:

Post by b0b »

Code: Select all

[2010-01-08 19:13 UTC] endosquid at endosquid dot com

Description:
------------
php -r 2>/dev/null 'print number_format("",0) . "\n";'
on our old PHP 5.1.6 Solaris 8 box (that we are transitioning off of) returns 0.

Now, we're testing our code, and we run into this behavior change:
php -r 2>/dev/null 'print number_format("",0) . "\n";'
on our new RHEL5 with 5.3.1 from the REMI repository returns NULL. Is this the default behavior expected? If so, why did this change happen? If not, where did we go wrong?

Reproduce code:
---------------
php -r 2>/dev/null 'print number_format("",0) . "\n";'

Expected result:
----------------
We expect to see 0 returned, not NULL.

Actual result:
--------------
NULL is returned.
	
 [2010-01-08 19:20 UTC] rasmus@php.net

Why are you passing an empty string in place of a number there?  You 
are essentially asking for an empty string to be printed with 0 decimal 
places and you are getting back an empty string.  You also get a big 
warning about that, of course.  How about "a",0 what do you expect that 
to return?  

I think the right solution for you here is to be explicit about casting 
your weird inputs to a float.  number_format((float)$weird,'0') will 
take care of it.

 [2010-01-08 21:26 UTC] endosquid at endosquid dot com

I submit that you may have missed the point:

We are passing a (possibly uninitialized, or null-valued) variable to the function, in hundreds of places and web pages, and we would not expect such a fundamental function to suddenly return a different result.  What is unreasonable about expecting a "number formatting" function to default to "0" if given non-numeric or null input, *esp* since that has been the behavior since Day 1?

 [2010-01-08 21:39 UTC] rasmus@php.net

No, I am not missing the point.  This same behaviour could very well be 
a bug in an app as well.  If this was changed in a minor version, I'd 
agree with you on the BC change, but we have been working on catching 
these weird edge-case scenarios that lead to unexpected bugs.

 [2010-01-08 21:51 UTC] endosquid at endosquid dot com

This is going to cause us MONTHS or fixing code for no real benefit since this behavior change is arbitrary and seemingly, was made for no reason. We are all engineers and developershere, and can't seem to get the reasoning behind returning NULL when a number is called for in the return. 

It's not a number definition, but FORMATTING. How do you format nothing in the numerical system? By having it be zero. You don't have NULL dollars in your bank account, do you? 

Please escalate this to someone who can answer the question as to why this was changed. If no one knows, then why was default behavior changed?

 [2010-01-08 22:23 UTC] rasmus@php.net

Months?  Being a bit dramatic here?

sed -i "s#number_format(#number_format((float)#g" *.php

Escalate?  Oh how I wish I had someone to escalate to.  

The change was part of standardizing all of PHP on the same parameter 
parsing code.  It is called zend_parse_parameters() internally.  Most 
of PHP was using this already, but there were still some stragglers 
like number_format().

The first PHP 5.3 release candidate was back in March 2009.  We put 
these release candidates out there so people who "will have MONTHS of 
work" because of small changes can chime in then and make their case.  
The release candidate period lasted until July.


 [2010-01-08 22:38 UTC] endosquid at endosquid dot com

Dramatic? You've obviously never worked in a change-request-release environment. We have number_format in literally thousands of places across 50 or 60 separate products. Each of those changes will have to be coded, tested, written-off, released, tested by the clients since this is tax data and has to be precise for tax planning and retirement planning.

So, before you go belittling the developers and users depending on PHP, perhaps you should stop and think about the massive effect this change has had on us and not act so dismissive.

5.3.x was not available on our last platform, which is why we are moving to a supported, fairly-recent platform. Why you have so much anger towards this bug is not a proper way to triage or respond to user requests. We have done nothing but explain how this change will massively affect our calculations.

Our only feasible option is to patch php back to the old behavior, but my C is fairly rusty and we ran into issues with time testing the ins and outs from buffers in the number_format function in math.c

 [2010-01-08 22:47 UTC] rasmus@php.net

I have worked in such environments.  Much bigger ones, in fact.  Part 
of your responsibility in your position is to keep track of your tools 
and the changes coming down the pipeline.  5.3 was available to you as 
a release candidate in March of last year, and even earlier directly 
from our revision control system.  Many things have changed and there 
are many many people out there affected by these changes, we recognize 
that.  That is also why we are not likely to reverse a change like this 
that others in your situation have now accounted for, tested and 
deployed in production for many months simply because it is 
inconvenient for you.

 [2010-01-08 23:05 UTC] endosquid at endosquid dot com

I get it. Yours is bigger, you've worked better, you are at the cutting edge of everything, and you have infinite resources to test every new version of every piece of software in your stack. Got it. I'm shamed and have no options. So, you're going to give a cover-all answer to make sure that you don't have to do anything. Ok, I get it. I hope no one ever does this to you, because it makes you lose faith in the product.

We will push forwrd with patching the source. It would appear that the 1194th line in math.c is the one that needs changing. returning 0 as opposed to returning nothing? I'll edit and compile.

 [2010-01-08 23:20 UTC] rasmus@php.net

Wow, a classic case of how not to treat unpaid volunteers who provide 
critical pieces of your money-making infrastructure.

 [2010-01-08 23:22 UTC] endosquid at endosquid dot com

Just look in the mirror, pal.

You need classes on how to listen to others.

 [2010-01-08 23:47 UTC] bjori@php.net

Sir.

This issue was recently brought to my attention.
On behalf of PHP I would like to apologize. I see that now that you have been treated unfairly.

After carefully reviewing this bug report with our board of directors on 4chan, we have come to the conclusion that your "rusty C skills" should be enough to fix the issue.
I would therefore like to remind you that rasmus@php.net is http://en.wikipedia.org/wiki/Rasmus_lerdorf

Again, I sincerely apologize. We will try to stop fixing bugs in PHP.

 [2011-08-23 01:41 UTC] 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.

 [2012-06-22 03:37 UTC] foobie1390 at yahoo dot com

Poop
User avatar
Roger Crawford
Posts: 5264
Joined: 10 Sep 1999 12:01 am
Location: Griffin, GA USA

Post by Roger Crawford »

Interesting read, but I got null out of it.
Rick Collins
Posts: 6006
Joined: 18 May 2000 12:01 am
Location: Claremont , CA USA

Post by Rick Collins »

...but closer to home:

This morning my cat came home at dawn, after being out all night.
I asked, "where have you been all night"?
And, he said NOTHING.
User avatar
Kenneth Caine
Posts: 67
Joined: 8 Jan 2009 9:55 am
Location: Pennsylvania, USA

Post by Kenneth Caine »

Must I read all of the 107 previous pages before I post or do they pretty much say nothing and I can start right in from here? I want to make sure I don't go off topic or post a previously posted post.
User avatar
Roger Crawford
Posts: 5264
Joined: 10 Sep 1999 12:01 am
Location: Griffin, GA USA

Post by Roger Crawford »

Kenneth, you most likely will post something similar even if you do read through the entire thread, But..think nothing of it.
User avatar
Alan Brookes
Posts: 13218
Joined: 29 Mar 2006 1:01 am
Location: Brummy living in Southern California

Post by Alan Brookes »

Kenneth Caine wrote:Must I read all of the 107 previous pages before I post or do they pretty much say nothing and I can start right in from here? I want to make sure I don't go off topic or post a previously posted post.
Yes, you have to read all 107 pages. Everything you could possibly imagine about nothing has already been discussed. To know that what you're adding has not already been discussed you have to read everything that has gone before.
User avatar
b0b
Posts: 29108
Joined: 4 Aug 1998 11:00 pm
Location: Cloverdale, CA, USA
Contact:

Post by b0b »

Don't listen to him, Ken. You don't have to read nothing. :P
<pre> </pre>
-𝕓𝕆𝕓- (admin) - Robert P. Lee - Recordings - Breathe - D6th - Video
Paul Graupp
Posts: 4922
Joined: 24 Jan 2001 1:01 am
Location: Macon Ga USA

Post by Paul Graupp »

I don't read NOTHING ! I dis-count it !! :whoa: :eek: :? :?
Rick Collins
Posts: 6006
Joined: 18 May 2000 12:01 am
Location: Claremont , CA USA

Post by Rick Collins »

I opened this thread again today hoping to find NOTHING new __ I did, 107 pages of it.
User avatar
Alan Brookes
Posts: 13218
Joined: 29 Mar 2006 1:01 am
Location: Brummy living in Southern California

Post by Alan Brookes »

b0b wrote:...You don't have to read nothing. :P
You don't have to write nothing, neither. :whoa:
User avatar
Scott Shipley
Posts: 1925
Joined: 22 May 2006 12:01 am
Location: The Ozark Mountains
Contact:

Post by Scott Shipley »

Image
Paul Graupp
Posts: 4922
Joined: 24 Jan 2001 1:01 am
Location: Macon Ga USA

Post by Paul Graupp »

I was going to put up some counts but forgot where they were...leaves me with NOTHING !! :whoa: :?
User avatar
Scott Shipley
Posts: 1925
Joined: 22 May 2006 12:01 am
Location: The Ozark Mountains
Contact:

Post by Scott Shipley »

Image
User avatar
Alan Brookes
Posts: 13218
Joined: 29 Mar 2006 1:01 am
Location: Brummy living in Southern California

Post by Alan Brookes »

Uncle Jasper :!: :D
Paul Graupp
Posts: 4922
Joined: 24 Jan 2001 1:01 am
Location: Macon Ga USA

Post by Paul Graupp »

That don't look NOTHING like no Santa to Me... :lol: :lol:
User avatar
Alan Brookes
Posts: 13218
Joined: 29 Mar 2006 1:01 am
Location: Brummy living in Southern California

Post by Alan Brookes »

Image
I try to keep a low profile.
Paul Graupp
Posts: 4922
Joined: 24 Jan 2001 1:01 am
Location: Macon Ga USA

Post by Paul Graupp »

I clicked on your profile file but it don't say NOTHING about St. Nick and such...music and luthiers and trains but no holiday cheer whatsoever !!Did I miss something or is it just some more NOTHING ?? :? :? :(
User avatar
Alan Brookes
Posts: 13218
Joined: 29 Mar 2006 1:01 am
Location: Brummy living in Southern California

Post by Alan Brookes »

http://bb.steelguitarforum.com/viewtopi ... highlight=

It probaby didn't say anything about Super Steelman either. Did you ever hear Clark Kent admit to being Superman ?
Image
User avatar
Archie Nicol
Posts: 6830
Joined: 25 Aug 2004 12:01 am
Location: Ayrshire, Scotland

Post by Archie Nicol »

Just want to wish this tome a Happy Birthday. On Saturday it will be five years old and I'll be fifty years older.

Arch.
User avatar
Alan Brookes
Posts: 13218
Joined: 29 Mar 2006 1:01 am
Location: Brummy living in Southern California

Post by Alan Brookes »

Archie Nicol wrote:Just want to wish this tome a Happy Birthday. On Saturday it will be five years old and I'll be fifty years older...
http://picosong.com/wmJU
I'll drink to that one. Once more, everyone raise your classes, click on the above link, and sing along "Happy Birthday" with the Alan Brookes Septet. :D :roll:
Last edited by Alan Brookes on 20 Jul 2012 9:52 am, edited 1 time in total.
Ray Minich
Posts: 6429
Joined: 22 Jul 2003 12:01 am
Location: Bradford, Pa. Frozen Tundra

Post by Ray Minich »

The very first post....

Topic: Nothing
Bob Knight
From:
Bowling Green KY
Post Posted 21 Jul 2007 6:58 am

Happy Birthday to Nothing...
Lawyers are done: Emmons SD-10, 3 Dekleys including a D10, NV400, and lots of effects units to cover my clams...
Ray Minich
Posts: 6429
Joined: 22 Jul 2003 12:01 am
Location: Bradford, Pa. Frozen Tundra

Post by Ray Minich »

Deleted: Read Alan's follow up below to see why I looked stupid. (Alan, could you kindly destroy your evidence too? Annihilate it so it turns to nothing... eventually)

Sorry all... the rant was meant for another audience.

It meant nothing here...
Last edited by Ray Minich on 27 Jul 2012 9:40 am, edited 2 times in total.
Lawyers are done: Emmons SD-10, 3 Dekleys including a D10, NV400, and lots of effects units to cover my clams...
User avatar
Alan Brookes
Posts: 13218
Joined: 29 Mar 2006 1:01 am
Location: Brummy living in Southern California

Post by Alan Brookes »

Ray Minich wrote:
I get it. Yours is bigger, you've worked better, you are at the cutting edge of everything, and you have infinite resources to test every new version of every piece of software in your stack. Got it. I'm shamed and have no options. So, you're going to give a cover-all answer to make sure that you don't have to do anything. Ok, I get it. I hope no one ever does this to you, because it makes you lose faith in the product.
Excellent response.... should be accompanied by backgound music of "Mister... do you know your an A______".
????? :whoa:
Without reading through all 108 pages, I don't remember this coming up in this post. :\ :?
Are you sure this isn't an excerpt from a completely different topic ? :\ :eek:
Otherwise, what relevance this has amounts to nothing.
User avatar
R. D. Miller
Posts: 63
Joined: 20 May 2005 12:01 am
Location: Sweetwater, Texas

Post by R. D. Miller »

I haven't said nothin' here in a long, long time. I still haven't said nothin'.
Ronnie

"There are two well kept secrets to success. 1. Never tell everything you know . . ."
User avatar
Roger Crawford
Posts: 5264
Joined: 10 Sep 1999 12:01 am
Location: Griffin, GA USA

Post by Roger Crawford »

I say a lot of stuff at home, but my wife says it amounts to nothing.
Locked