News for hackers. Stuff that matters.
Re:We will try to stop fixing bugs in PHP by quink on Thursday June 21, 2012 @11:50PM (#4145297)
A) The new behaviour makes more sense.

B) The change was discovered as a difference in behaviour in two major releases that were three years apart.

C) Rasmus Lerdorf can change PHP however he wants. It is precisely because of this that PHP has been so {'widely success', 'pain'}ful.

D) The reporter was being overly dramatic regarding the change going to take a supposedly crazy amount of time to fix.

E) You don't pass a string into a function that's usually returning a string without at least casting to a string when part of its intended behaviour is at times not returning a string. Casting in this case even before the function even changed would have been an exceedingly good idea.

F) (edit) I vote we burn in hell PHP developers who tack on comments to a long closed bug report to offer their opinions like joezimjs did. Especially when they display a basic ignorance in saying crap like "NULL is neither a string nor a number."

Re:We will try to stop fixing bugs in PHP by TylerE on Friday June 22, 2012 @12:02AM (#4145321)
I disagree with point A. The old behavior makes a LOT more sense symbolically.

I tell you that you have no apples. Write the number of apples you have on a piece of paper. What did you write? I bet it was 0, not some arbitrary, non-writable symbol for an abstract concept that could mean "nothing" or "error" or "empty" or ..

Re:We will try to stop fixing bugs in PHP by steve8918 on Friday June 22, 2012 @12:11AM (#4145350)
I don't agree with your analogy. The question is more similar to "Can you please tell me the number format of <silence>".

How can the answer to an unfinished question be "0"? 0 is an actual valid answer, when people are asking for number_format(0, 0).

In this case, NULL is definitely more appropriate, because the input is invalid.

Re:We will try to stop fixing bugs in PHP by masklinn on Friday June 22, 2012 @02:34AM (#4145734)
> he question is more similar to "Can you please tell me the number format of <silence>".

Well in PHP, the number for <silence> is 0, so it would stand to reason that the formatted number for <silence> is 0 as well.

Re:We will try to stop fixing bugs in PHP by ivix on Friday June 22, 2012 @05:41AM (#4146100)
Of course, in a more sane language, it would throw an exception, rather than silently returning a wrong value.
Re:We will try to stop fixing bugs in PHP by phene on Friday June 22, 2012 @12:23AM (#4145390)
What's the numeric representation of the volume of <silence>? 0 dB
Re:We will try to stop fixing bugs in PHP by mturmon on Friday June 22, 2012 @01:13AM (#4145519)
Since dB are a log scale, more properly, it would be -Inf dB.
Re:We will try to stop fixing bugs in PHP by exDM69 on Friday June 22, 2012 @09:28AM (#4146669)
0 dB = atmospheric pressure. -Inf dB = vacuum of space.
Re:We will try to stop fixing bugs in PHP by dpark on Friday June 22, 2012 @01:02AM (#4145491)
So you make up a different question to fit the answer you want? Actually that seems about right for PHP.
Re:We will try to stop fixing bugs in PHP by felipellrocha on Friday June 22, 2012 @12:32AM (#4145416)
I think you missed the point here. Steve's analogy asks for a number format, not a volume...
Re:We will try to stop fixing bugs in PHP by MBlume on Friday June 22, 2012 @12:44AM (#4145440)
Downvoted for cleverness.
Re:We will try to stop fixing bugs in PHP by chavesn on Friday June 22, 2012 @12:27AM (#4145401)
I agree with Steve. "No apples" actually is "0 apples".

Your analogy is a misunderstanding of null. Null is like you asking me how many apples Joe has. I say I don't know. If you write down 0, I'm going to stop you and say, "I didn't say zero, I said I don't know."

Re:We will try to stop fixing bugs in PHP by Too on Friday June 22, 2012 @01:09AM (#4145512)
BOTH behaviors don't make sense. The right behavior is to throw an exception.
Re:We will try to stop fixing bugs in PHP by enjo on Friday June 22, 2012 @01:45AM (#4145585)
Absolutely agree, and that's PHP's biggest issue. It is constantly doing things like this instead of simply complaining and stopping things down like any sane system would.

If I were in charge of PHP, release 6 would be 5.4.4 with the standard library happily throwing exceptions on invalid input. That's it. The language would be 100% more useful instantly.

Re:We will try to stop fixing bugs in PHP by eitland on Friday June 22, 2012 @01:59AM (#4145635)
As mentioned to parent: then you'd have a lot of work to do to clean up one even more widely used language : )
Re:We will try to stop fixing bugs in PHP by gbog on Friday June 22, 2012 @10:30AM (#4146861)
You mean JavaScript, right? Reading this conversation I was wondering how no comment would point at the same or bigger similar issues in JavaScript.
Re:We will try to stop fixing bugs in PHP by eitland on Friday June 22, 2012 @01:57AM (#4145629)
This depends on language. Or you'd have to dismiss at least on widely used systems programming language as well. : )
Re:We will try to stop fixing bugs in PHP by Too on Friday June 22, 2012 @12:16PM (#4147408)
Well...if we are allowed to change language completely we could change to a type safe language (as most systems programming are) and we wouldn't have this discussion in the first place since it would be impossible to call the function with a string parameter...
Re:We will try to stop fixing bugs in PHP by jeffdavis on Friday June 22, 2012 @12:53AM (#4145463)
I tell you that you have "foo" apples. Write the number of apples you have on a piece of paper. What did you write?
Re:We will try to stop fixing bugs in PHP by pelotom on Friday June 22, 2012 @01:10AM (#4145513)
I tell you you have 12/0 apples. Write the number of apples you have on a piece of paper. Some "functions" are not defined for all inputs. Better to give a "that doesn't make sense" answer than a bogus answer.
Re:We will try to stop fixing bugs in PHP by mparlane on Thursday June 21, 2012 @11:52PM (#4145301)
I work on systems where D) is perfectly reasonable. Where one "small" change results in a hell of a lot of regression testing and doc changes.

What I don't get is that they are keen to modify php source. But not to just keep using the same php release?

I agree with E, they take floats not strings apparently.

Re:We will try to stop fixing bugs in PHP by soulclap on Thursday June 21, 2012 @11:55PM (#4145307)
Maybe there are other guidelines (Security related, no maintenance for the old release) that were 'forcing' them to update.
Re:We will try to stop fixing bugs in PHP by Evbn on Friday June 22, 2012 @12:13AM (#4145358)
I guarantee that security guidelines were not involved in any decision about which version of PHP to use in a project. All PHP code is security tainted and needs protection at the underlying data service layer.
Re:We will try to stop fixing bugs in PHP by JaggedJax on Friday June 22, 2012 @12:58AM (#4145475)
I would almost guarantee security guidelines were the reason. He states they are dealing with tax data, and I would bet they handle some credit card data as well. If they even touch credit card data they have to be PCI compliant (http://en.wikipedia.org/wiki/Payment_Card_Industry_Data_Secu...) which requires specific versions of PHP.
Re:We will try to stop fixing bugs in PHP by pilif on Friday June 22, 2012 @03:30AM (#4145834)
If it requires specific versions of PHP, I would hope that doesn't include a self-patched build that deliberately masks erroneous input data by treating NULL as 0

The moment you run a patched build, you're IMHO not running the officially sanctioned version any more.

Re:We will try to stop fixing bugs in PHP by pacmon on Friday June 22, 2012 @12:00AM (#4145316)
Reporter posted this: "...which is why we are moving to a supported, fairly-recent platform". I'm guessing it's the support their after.
Re:We will try to stop fixing bugs in PHP by columbo on Friday June 22, 2012 @09:58AM (#4146760)
I disagree with (A).

According to the php docs

floatval('122.34343The') == 122.34343

floatval('BLARTLBARTFAST') == 0

Why should it take the input and choose a different response than what floatval would respond with?

If floatval returns null on 'BLARTLBARTFAST' and '122.34343The' then this function should return null. If floatval returns 0 (or whatever) than this function should return the same.

It's inconsistent behavior.

Re:We will try to stop fixing bugs in PHP by quink on Friday June 22, 2012 @07:26PM (#4149415)
> I disagree with (A).

Since you quite clearly have no idea what function we're even talking about or what it's supposed to do, I will just point you to the documentation rather than more explicitly explain on how many levels you are wrong: http://www.php.net/manual/en/function.number-format.php

Re:We will try to stop fixing bugs in PHP by arde on Saturday June 23, 2012 @02:02AM (#4150179)
Pointing to the documentation does not work in this case. The documentation shows the user was not sticking to the function specs, yes, but neither does PHP most of the time. If PHP were a consistent (serious) language, I might see your point. It's not: it generally aims for leniency and minimum (well, small) surprise but doesn't seem to be doing it this time. I think you should make your argument clear.