r/webdev • • 28d ago

Question How warranted is the PHP hate?

I feel like there has been a lot of hate on PHP, especially after the recent blowout regarding PHP vulnerabilities that even ended up on mainstream media. I even saw absolute non-techy people bringing up PHP and talking authoritatively about how "bad" and "old" it was lol. Not to mention the AI-shills saying one should just use Claude to create one owns CMS (!!). I am also aware that most PHP hate is usually misaligned hate intended for badly managed WordPress sites. And that some people just prefer other languages or love a hatetrain.

But one thing in particular that got to me was someone who mentioned that PHP has a page with vulnerabilities listed that go back 20 years and have yet to be patched. And that if you are a dev who is in any way interested in security within one's projects, you just don't use PHP at all. It was like having only a screen-door for your house with no locks. Do other languages have similar list of unsolved vulnerabilities? What makes them inherently more secure?

I dug around to find information about other popular programming languages and frameworks and it seems like at least right now, many are being found to have vulnerabilities due to AI being used to find them. React had a critical issue about a year ago, and Python earlier this year (although they did not blow up in the press like this).

Anyway, I would like to hear from people who use PHP regularly for work, beyond WordPress and who can maybe compare it to other languages/stacks as well. Please no low-effort replies from people who last used PHP 20 years ago or just don't like it, if possible.

0 Upvotes

89 comments sorted by

View all comments

-11

u/Apprehensive-Fan8999 28d ago

14 year old article, still applies today… https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/

4

u/allen_jb 28d ago

Parts of this article were wrong, or at least outdated, when it was written, around PHP 5.4. We're now on PHP 8.6 and it's even more wrong.

A lot of it also comes from not understanding PHP's history. PHP is a language that evolved rather than being designed.

  • PHP is full of surprises: mysql_real_escape_string, E_ALL
  • PHP is inconsistent: strpos, str_rot13

Much of the inconsistencies in the core library come from the fact that, particularly in the early days, functions names simply mirrored those of the libraries they were using. For example, mysql_real_escape_string is literally the name of the C library function and strpos is the C function name.

The only thing I can think of they're referring to about E_ALL is that it didn't include E_STRICT at one point, but this changed in, I believe, 5.4, which came out around the same time as the article was written.

The RFC system that was introduced around PHP 5.3 (and revised further since) has helped ensure that new additions and significant changes make the language much more consistent.

  • PHP requires boilerplate: error-checking around C API calls

So does C. They literally just mirrored how the C functions work (minus the having to deal with pointers and other ultra-low-level stuff).

===, ==

You just don't (want to) understand PHP's type system. (Also much improved since PHP 5.4)

PHP is opaque: no stack traces by default or for fatals, complex error reporting

Stack traces are now shown by default for any thrown error or exception. Most extensions now use thrown errors / exceptions (by default). Error reporting was significantly revised in PHP 7 and other changes since.

Don't comment with these things

This entire section is just "I want to ignore all the arguments against what I'm writing". The author just wants to shit on PHP, no matter what.

I could go on, but what's the point when the author themselves doesn't want to consider any arguments against what they're writing. I've got better things to do with my day.

Is PHP a perfectly designed language? No. Does it have plenty of problems? Yes. But if you go looking for them, so does every other language. I mean I just don't know what to say when, in the PHP 5 era people were complaining about PHP's loose typing system and problems it created, many of them apparently chose to move to JavaScript.

6

u/RePsychological 28d ago edited 28d ago

that...that's not how that works......to bring up a 14-year-old article and be like "Yeah...totally relevant in this webdev world where things are constantly changing 2-3 times a year..."

Edit: If someone's blasting to everyone "Read this article or you're just wrong" in every single fucking comment they're putting down....while also saying:

"Asking out of ignorance who would like to be educated" ......seriously?

-5

u/Apprehensive-Fan8999 28d ago

Then read it, and actually spend some time refuting it’s points. I assert it is still relevant, you assert it is not. I let the article stand, explain where you believe it is wrong.

As the OP said, this bug is over a decade old. So it seems an article over a decade old describing the failings isn’t as outdated as you assert.

5

u/Klopferator 28d ago

A lot of the whining in the article is consciously writing bad code and then complaining it doesn't work the way he thinks it should work. And a lot of his points aren't even true anymore, the author doesn't seem to have taken a look at PHP since PHP 7 came out.

-4

u/Apprehensive-Fan8999 28d ago

As I keep asking, and no one answers, what is wrong with the article and what is better? Asking out of ignorance who would like to be educated.

3

u/RePsychological 28d ago

lol no. [presents an asininely long drivel of a necro'd article]..."either read the entire thing and present a thesis as to why it's wrong....or you're just wrong....even though php has changed VASTLY in 14 years and it can be safely assumed that this is irrelevant."

-2

u/Apprehensive-Fan8999 28d ago

The author asked a genuine question. If, as you say, PHP is vastly better than then, surely you can cite at least a handful of reasons why… no?

3

u/RePsychological 28d ago edited 28d ago

you have the burden of proof here. Not me. If you stand behind that article so heavily, then you take the time to explain why it's still relevant.

Tired of this shit where people just slap a book in someone's face because of their own biases, and then be like "either read this or fuck off and you're just wrong...definitively and absolutely." with zero effort in what you're trying to say...and then you sit there acting like that's validation.

Edit: If someone's blasting to everyone "Read this article or you're just wrong" in every single fucking comment they're putting down....while also saying:

"Asking out of ignorance who would like to be educated" ......seriously?

-3

u/StoneCypher 28d ago

"you have the burden of proof in me saying something i haven't read is wrong"

he really doesn't 😂

-2

u/StoneCypher 28d ago

look at you trying to argue that you shouldn't have to read something to know if it's right or wrong

-1

u/StoneCypher 28d ago

stop being a neckbeard. php still has every single one of the problems in that 2012 article that you didn't read.

14 years later, nothing got fixed.

2

u/ElectrSheep 28d ago

That article is extremely out-of-date. Much of the information it contains is factually incorrect with respect to modern PHP.

-2

u/Apprehensive-Fan8999 28d ago

Please, help me understand… which parts?

3

u/ElectrSheep 28d ago edited 28d ago

God damn, this article is ass. It's even worse than I remember. In addition to the factual inaccuracies and out-of-date information, there are numerous statements that strongly call into question the author's understanding of programming language design and implementation.

Here's a very incomplete list of things from that article that have either since been fixed, replaced, are particularly misleading, appear to have been misunderstood by the author, or were never really true to begin with.

  • No stack traces
  • E_STRICT is a thing
  • ?: is left associative
  • There are no references [...] there's no pass-by-object identity like in Python
  • Constants are defined by a function call taking a string; before that, they don't exist
  • There's nothing called int in the language
  • Accessing a non-existent object property
  • The __toString method can't throw exceptions
  • PHP errors and PHP exceptions are completely different beasts. They don't seem to interact at all.
  • Fatal errors can't be caught by anything.
  • There is no finally construct
  • You can't require that an argument be an int or string or object or other "core" type
  • A function's return value can't be hinted
  • Passing the current function's arguments to another function is done by call_user_func_array('other_function', func_get_args())
  • Closures require explicitly naming every variable to be closed-over
  • A closure can't refer to private methods, even if it's defined inside a class
  • No named arguments to functions
  • Function arguments with defaults can appear before function arguments without
  • Variadic functions require faffing about with func_num_args, func_get_arg, and func_get_args. There's no syntax for such a thing.
  • Perl, Python, and Ruby all have some concept of "property" access via code; PHP has only the clunky __get and friends
  • Built-in types are not objects and can in no way be made to look like objects
  • An instance method can still be called statically
  • There are several ways to actually be dynamic in PHP, and at a glance there are no obvious differences or relative benefits
  • Despite that this is the language's only data structure, there is no shortcut syntax for it; array(...) is shortcut syntax
  • There are no generators
  • Every time a page is hit, PHP recompiles the whole thing before executing it
  • There is no easy way to "insulate" a PHP application and its dependencies from the rest of a system. Running two applications that require different versions of a library, or even PHP itself? Start by building a second copy of Apache.
  • No interactive debugging
  • Magic quotes
  • register_globals
  • mysql_real_escape_string

0

u/StoneCypher 28d ago

nobody still having php discussions has any hope of relevance

-1

u/Apprehensive-Fan8999 28d ago

Heh, i agree. Everything I wrote in PHP has long since been replaced with Angular. It’s why I am genuinely curious what is better now vs then because I don’t think it is and those who think PHP is amazeballs now, seem incapable of explaining why.

1

u/StoneCypher 28d ago

angular is also more than a decade deceased

1

u/Apprehensive-Fan8999 28d ago

Agree to disagree on this one.

1

u/StoneCypher 28d ago

nah, facts exist.  not everything is an opinion.

angular shops can’t hire.  nobody uses it as a result

0

u/Apprehensive-Fan8999 28d ago

As stated in my GP that people seem upset about but never can be bothered to dispute. 😂

1

u/StoneCypher 28d ago

that people seem upset about 

sure

1

u/MonorailPurple 28d ago

This is what people who know fuck all about php link to to let others know how irrelevant they are.

It’s genuinely used as a point in other languages as well to point out how people who have zero experience or knowledge of an ecosystem feel like they can comment on it and why they should be dismissed.

That article is famous among programmers. For being comically wrong. If you’d been in programming for a while you’d know this.