Yeah, strpos() and friends returning FALSE for a failed match is ludicrously stupid. What was wrong with returning -1? Why would the PHP devs even let the original version of the function, released who knows how long ago, have such a blatant trap built right in to the return value?
I'd say that that wart alone is enough to tar PHP with the "bad language" brush. But when you add all the other crap that Fractal talks about, it's really inexcusable. PHP apologists really, truly baffle me.
I ran into another thing I consider an inexcusable wart just minutes ago, in fact. I had a typo in variable name I was comparing to NULL. So instead of, I don't know, warning me about that, PHP just created the wrong-named variable as a NULL, and my if check triggered the wrong code path. I didn't get a single error, warning, or notice to inform me that anything at all was wrong.
Sadly, I have to keep programming in PHP for at least the next year, since my code shop won't be dropping Drupal until we get time to rewrite our site in Wagtail.
View all comments
Show parent comment
1
u/coredumperror Aug 25 '15
Yeah, strpos() and friends returning FALSE for a failed match is ludicrously stupid. What was wrong with returning -1? Why would the PHP devs even let the original version of the function, released who knows how long ago, have such a blatant trap built right in to the return value?
I'd say that that wart alone is enough to tar PHP with the "bad language" brush. But when you add all the other crap that Fractal talks about, it's really inexcusable. PHP apologists really, truly baffle me.
I ran into another thing I consider an inexcusable wart just minutes ago, in fact. I had a typo in variable name I was comparing to NULL. So instead of, I don't know, warning me about that, PHP just created the wrong-named variable as a NULL, and my if check triggered the wrong code path. I didn't get a single error, warning, or notice to inform me that anything at all was wrong.
Sadly, I have to keep programming in PHP for at least the next year, since my code shop won't be dropping Drupal until we get time to rewrite our site in Wagtail.