News for hackers. Stuff that matters.
Re:A call to PHP's mt_rand generates only odd numbers by sneak on Friday July 24, 2015 @08:57AM (#9941617)
Almost everything in PHP is surprising behavior.

And yes, in the eleventy billion cases where PHP should yell at you that it's doing something totally different than what you wanted, it instead just goes about its day silently.

Re:A call to PHP's mt_rand generates only odd numbers by KingMob on Friday July 24, 2015 @09:42AM (#9941913)
Which is why it was a great fit for MySQL, which would silently store invalid dates and truncate over-long strings with no warnings.
Re:A call to PHP's mt_rand generates only odd numbers by mratzloff on Friday July 24, 2015 @10:49AM (#9942350)
You joke, but I'm pretty sure this is one of the reasons why that stack was so successful. Same principle behind HTML rendering. "It's displaying something, isn't it? Errors are only suggestions."
Re:A call to PHP's mt_rand generates only odd numbers by krick on Friday July 24, 2015 @03:14PM (#9944456)
I'm not so sure. It's kind of true for HTML (forgiveness was not "good" property of the format, but of the browser: 1 site works in one browser, but not in the other, and user will blame the browser, so let's display whatever the hell we can). But PHP in the early days was kinda handy (even though hacky) tool, allowing to use simple syntax to render HTML instead of custom Perl-scripts. And then it just got popular.

MySQL was once actually superior open-source database, being more performant and simpler to setup and use than PostgreSQL. And then, once again, it just got popular.

I don't think being faulty helped these technologies, although it sometimes is the case.

Re:A call to PHP's mt_rand generates only odd numbers by k_roy on Friday July 24, 2015 @11:00AM (#9942427)
There are warnings. Most people just ignore them in their APIs
Re:A call to PHP's mt_rand generates only odd numbers by KingMob on Thursday July 30, 2015 @12:19PM (#9976018)
Trying to insert over-large data should have been an error by default from the outset, never a warning. Ilooked at MySQL in 2000 and went "You had one job, database; protect my data."
Re:A call to PHP's mt_rand generates only odd numbers by vog on Friday July 24, 2015 @10:17AM (#9942128)
This is so true. It is the main reason I switched to PostgreSQL and never looked back.
Re:A call to PHP's mt_rand generates only odd numbers by gmac on Friday July 24, 2015 @10:44AM (#9942317)
... and accept nonsensical SQL queries, returning whatever it feels like.
Re:A call to PHP's mt_rand generates only odd numbers by coldtea on Friday July 24, 2015 @05:21PM (#9945270)
>Almost everything in PHP is surprising behavior.

It's not. White it does have several surprising behaviors, "almost everything" is just an example of uniformed BS people say when it comes to PHP.

C also has undefined behavior and several bad decisions, ditto for C++, Javascript, etc. But PHP is just an easy target for trolls.

Re:A call to PHP's mt_rand generates only odd numbers by sarciszewski on Friday July 24, 2015 @10:46AM (#9942327)
Even worse, some of the Internals teams argue in favor of silently trucking along instead of, e.g. throwing an exception: http://www.serverphorums.com/read.php?7,1250372

EDIT: because of HN's annoying "you are posting too fast" limit I cannot reply to the comment below.

The arguments against Exceptions began in the comments on the relevant pull request: https://github.com/php/php-src/pull/1397

Re:A call to PHP's mt_rand generates only odd numbers by _lce0 on Friday July 24, 2015 @12:02PM (#9942901)
from that thread..

   At what point do we stop blaming the developers for not knowing how to
   use our badly designed features, and accept responsibility for exposing
   an API that is hostile towards simple, efficient, and correct implementations?
Re:A call to PHP's mt_rand generates only odd numbers by paragon_init on Friday July 24, 2015 @12:23PM (#9943078)
It might be worth noting that 'sarciszewski was the author of that remark.
Re:A call to PHP's mt_rand generates only odd numbers by juliangregorian on Friday July 24, 2015 @11:38AM (#9942708)
Wow, that thread is current! This mentality really is systemic to PHP. It's like the exact opposite of "let it crash".
Re:A call to PHP's mt_rand generates only odd numbers by claar on Friday July 24, 2015 @11:59AM (#9942876)
Actually that thread seems to strongly argue that either an Exception or fatal error should be thrown. I'm not seeing anyone in that thread wanting to silently truck along -- am I missing it?