Hacker News new | past | comments | ask | show | jobs | submit login

Unfortunately PHP is consistently inconsistent. It lets people do that, and it won't ever break. Until they "make it right".

Sure the guy didn't test the parameter as being empty, but if you pass a string instead of a float, an error should be raised, and that never happened until the fix. That's the big problem with PHP :/




"Sure the guy didn't test the parameter as being empty, but if you pass a string instead of a float, an error should be raised"

Just like you should not pass strings in place of numbers, in accounting software of all things. Why can't just everbody get it absolutely right the first time?

Any language that can do anything also allows you to shoot yourself in the foot. And I think that was the case here, brainless programming; PHP hardly pulled out the rug under something reasonable in this case, they simply defined previously undefined behaviour... and when that happens, that always breaks crappy programs that depended on it, no matter in what language they're written. It's the big problem with idiots; PHP has nothing to do with it.


>Just like you should not pass strings in place of numbers, in accounting software of all things. Why can't just everbody get it absolutely right the first time?

Because the input is a text box? Text is, after all, the way for people to input data into a computer.


It stills shows a lack of rigour on the part of the developer. A simple "empty()" and "is_numeric()" check should be done on any user input expecting a float BEFORE you pass it off to a number formatting function expecting a float.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: