Live data from Hacker News

These are things in PHP which make me sad

phpsadness.com

81–90 of 217 posts

Re: These are things in PHP which make me sad

#81

things about php that make me sad: 1. it exists 2. it's used 3. many of its users make more money than me 4. it has poisoned the market, clients have learned to expect and even demand php-braindeath

I often find that PHP coders lack a total understanding of the LAMP stack. "Apache configuration? Huh? I don't know, our admins do that." "MySQL? I don't know, I'm not a DBA. I'm a developer." "UNIX commands?!! I don't like going in the terminal. I'm a developer." No, sorry, you're not a developer. You're a glorified web page editor.

Re: These are things in PHP which make me sad

#82
post #49

Mandatory function arguments: function foo($arg1,$arg2) { return; } foo('bar'); Warning: Missing argument 2 for foo() Lame. But omitting arg2 is allowed if you give it a default value: function foo($arg1,$arg2=FALSE) { return; } Blah. Instead I'd rather make arg2 truly optional just by testing if it's defined.

What would the ideal language return for your function call foo('bar'). It would seem to me that missing an argument should return some sort of notice, like in the case where someone else is using it.

I prefer Javascript for example: JQuery's calling conventions would not be possible if function args were mandatory.

Re: These are things in PHP which make me sad

#83

I hate PHP, but this article isn't very good. It's strange that there is an "implications for the internals" reason. Guess what, you can just read the internals. It's open source. The parser emits weird error messages because it is a very simple yacc grammar. (And because they turn off yacc's "produce better error messages" mode.) If you want good error messages, it's going to cost you -- just read perl's toke.c if y…

You can just read the internals, but that doesn't mean that the criticism is wrong. Certain problems do suggest deeper internal issues.

"Good error messages cost a lot" and "They turned off yacc's 'produce better error messages' mode" seem to contradict one another.

And no, in a lot of cases the parser emits weird error messages because the internal variables are named weird things. If you're telling me it's unreasonably difficult for PHP to produce a better error message than "Unexpected CONSTANT_NAME" than why name your constants unintuitively?

Re: These are things in PHP which make me sad

#84
post #16

There's a lot of valid points there, but "#33 Cannot override private methods with a subclass" is the right behavior. That's exactly what private is for, and it's important to know that such names are non-colliding and you can rely on their implementation. Use protected for overridable methods. You shouldn't mock or directly test private methods in unit tests — they're not part of the interface!

"#41 Cannot create a final abstract class" is borderline too

Yup, wouldn't a final class with a private constructor be more appropriate there?

Re: These are things in PHP which make me sad

#85

What makes me sad is that people will defend this horrible language to the death, regardless of how many problems there are with it. I don't get it; we know how bad PHP is, so why do people fight so hard? Oh, and to demonstrate: "PHP has no native Unicode type, no native Unicode handling, and cannot treat Unicode strings as strings." This true statement, composed of three observations about deficiencies in the langua…

It's bad, but it's also very, very good.

What aspect of PHP is "very very good"? Genuinely curious to know.

Re: These are things in PHP which make me sad

#86
post #2

This is by far my (least?) favorite: http://ca.php.net/empty ----- The following things are considered to be empty: - "" (an empty string) - [...] --> "0" (0 as a string) - [...] - var $var; (a variable declared, but without a value in a class) ----- Why the heck is "0" considered empty?

You should check out JavaScript - the type coercion is similar but even worse.

but JS isn't behaving weirdly with return values. Overall, JavaScript is much less WTF than php.

Re: These are things in PHP which make me sad

#87
post #18

The ridiculously terrible behavior of == is what makes me the saddest. http://www.php.net/manual/en/types.comparisons.php We then have === which does what == is really supposed to do, but even that still sometimes does the Wrong Thing.

Except when you're comparing objects!

I want to make sure that object A and object B are instances of the same class. Also, I want to make sure that they are equal i.e. that every attribute is equal. Also, since I'm now used to always using === instead of == for such comparisons, I use === to make the comparison. I would think that == would perform an == comparison on every attribute, whereas === would perform an === comparison on every attribute.

Nope! Using === actually verifies that the A and B are in fact references to the same object in memory, just like the "is" operator in Python. Got me again, PHP! How do I do my === comparison? Manually, that's how!

Re: These are things in PHP which make me sad

#88

I've definitely run into #1 on the list. "Paamayim Nekudotayim" is a transliterated version of פעמיים נקודתיים‎, which means "double colon" in Hebrew. Zeev and Andi are Israeli, which kind of explains it, but the error message is still pretty useless.

I'm actually quite fond of that particular quirk. At least it's easy to search for!

Re: These are things in PHP which make me sad

#89
post #26

Earlier quoted context omitted.

A better PHP than PHP: You mean like Railo? http://www.getrailo.com/com/index.cfm/whyrailo/developers/ (Scroll to bottom where they address why for PHP devs)

that article is strikingly inarticulate. if you've got to tell me to scroll to the bottom, then it's a complete failure at selling railo, whatever it is

I am getting a 404 with the link right now. Railo is a JBOSS project that is an open source version of CFML. Here's what they say about Railo in comparison to PHP:

• Simplicity

More powerful tags for simple file, email, database and other common operations.

• Best Practices Support

If you want to build OO apps using TDD, you can do so. If not, you can still hack out working scripts in minutes.

• Frameworks

A wide range of frameworks designed to make it quick and easy to build well designed web applications.

• OSS Projects

RIAForge has hundred of pre-built projects so you can quickly deliver anything from a blog to a content management system.

• Robust deployment

Railo CFML is easy to manage and deploy, but it's sitting on top of the Java Virtual Machine so it can be deployed to any servlet container or J2EE application server and can take advantage of all of the tooling available for deploying and maintaining Java applications (JMeter, Maven, etc.).

Is this more clear?

Re: These are things in PHP which make me sad

#90

Earlier quoted context omitted.

you could say that all other web platforms are blub because they don't see the value that PHP brings to the table. a total idiot can install PHP and get a system that will meet the performance and reliability needs of 99.5 of web sites out there. tomcat, mod_perl, the ten different ways people host Ruby sites and all that make a lot more trouble for you. I've run PHP-based web servers for hundreds of sites that have…

a total idiot can install PHP and get a system that will meet the performance and reliability needs of 99.5 of web sites out there. This is like living in a house where the builders were "total idiots" and hammered in all the screws with a hammer instead of screwing them in with a screwdriver. Sure, it holds together. It might not even collapse in a light breeze. But one day, you'll want to reshingle the roof, or the…

and it pick mongrel 2 I have to evaluate a number of different products for hosting ruby, each of which claims to be way better than all the others... yeah right
Post reply on HN