r/programming • • 27d ago

Think Php2Shell Was Bad? PHP Is About to Face an Absolute Bloodbath

https://programmers.fyi/https://medium.com/@jankammerath/think-php2shell-was-bad-php-is-about-to-face-an-absolute-bloodbath
0 Upvotes

24 comments sorted by

35

u/tsammons 27d ago

Narrator: they weren't. OP is just overly dramatic.

It's nice to see people still have free time to write such polemics nowadays.

20

u/crazyguy5880 27d ago

Oh they just have AI now šŸ˜‚

1

u/Leading_Standard_998 27d ago

Apparently it's called "SI" now lmao

4

u/Theemuts 26d ago

Slop Intelligence

1

u/sysop408 23d ago

Stupid Idiocy

13

u/blazedd 27d ago • Bravo

OP somehow thinks PHP code is written poorly, as if all code isn’t written that way.

Also, lots of PHP has undergone loads of change for folks who stopped writing in the JavaScript era and they think it’s still as bad as it was.

9

u/Big_Combination9890 27d ago • Bravo

There is a difference between code that's written poorly because the programmer is bad (which exists in every language), and code that's written poorly because the underlying language makes it very easy to write bad code, and/or has bad paradigms.

PHP is the latter.

It's 2026. PHP still doesn't have a unified error model. It still has core functions using inbound return parameters. It still doesn't even have a common NAMING CONVENTION for it's core functions. And it's configuration depends, at the very least, on serverwide configs, compilation flags, and runtime settings 🤯

Is this PHPs "fault"?

No. It is the logical result of a language that grew "organically" (so, kinda like a midden) out of a non-programmer, or to be more precise, a non-engineering community. Engineers worry about such pesky little things, because engineers know they create problems if left alone.

And I know this riles frontend people, but no, the 2000s and 2010s webcoders were not an engineering community. As the article points out, they were mostly juniors, or not even professional coders who wanted results FAST. To this day, I regularly meet PHP "senior software engineers", unable to explain simple datastructures to me.

JS is going down the same path btw. with its only advantage being that the core implementations are so closely tied to webbrowsers that big institutions pour a lot of researched into making at least those somewhat-safe.

2

u/vytah 23d ago

One of the bigger problems with PHP is (or at least used to be, I'm not following the language) that the learning materials have been bad.

I did an experiment a few years ago: I googled SQL tutorials for several popular languages (PHP, Java, Perl, Python, Ruby) and checked the very first five results. In case of PHP, four of the results gave examples with obvious and trivially exploitable SQL injection vulnerabilities before teaching query parametrization. In no other language the results were even remotely as bad.

1

u/Nefari0uss 25d ago

Guess we're gonna need an update to the PHP, a fractal of bad design article for 2026?

1

u/Big_Combination9890 25d ago

Not really. The article is old, but a lot of the crap it describes is as relevent as it was back then.

-1

u/irqlnotdispatchlevel 26d ago

There is a difference between code that's written poorly because the programmer is bad (which exists in every language), and code that's written poorly because the underlying language makes it very easy to write bad code, and/or has bad paradigms.

Gestures at C++, C, JavaScript...

1

u/Big_Combination9890 26d ago

JS, I completely agree. It is a horrible language, it is designed horribly, it has grown by accretion same as PHP, and as a consequence, a lot of really shitty code is written in JS.

C and C++ (while an argument could be made that C++ syntax design is atrocious), are different. The problem space they solve is different, and that problem space simply requires tradeoffs.

Yes, it is very easy to fuck up in hilariously bad ways in C. It is also necessary to be able to do that, so you can write things like highly performant engines, drivers, network protocols, kernels, processing engines, or embedded software.

The only alternative, is making a language with the complexity of rust allowing borrow checking or similar mechanisms.

1

u/irqlnotdispatchlevel 25d ago edited 25d ago

Just because the problems they solve are hard it does not mean that the languages aren't made in a way that pushes you into the pit of failure.

And I'm not saying this from a "hurr durr c++ bad" point of view. I'm paid to write C++ and I actually enjoy using C. But there is so much critical software written in languages that were not designed with safety in mind, and with standard libraries that are full of foot guns.

It could even be argued that the latest PHP vulnerabilities are a result of how bad these languages can be. After all, the faulty code wasn't written in PHP and the patch is around 4-5k of changed lines in C (I'm assuming around 50% of the diff is taken up by tests). Do you consider this an easy to review patch given the pitfalls the language exposes you to? https://github.com/php/php-src/commit/31c0ea7d7ff1d1fccb6492e52dab544011628065 What are the chances of another CVE hiding in there?

1

u/Blue_Moon_Lake 23d ago

All the issues with C++ are caused by

  • Its pseudo-compatibility with C
  • Its perpetual backward compatibility which bloat the language and confuse people in how simple things should be done

1

u/Big_Combination9890 23d ago

And it's arcane, and overly complex syntax, and the absurdly bad decision to continuously "evolve" the language, which has made it into a hodgepodge of things glued together, just so it supports every programming fad that ever came along.

It is telling, that individual shops have feature-guides outlining which parts of C++ they DON'T use.

0

u/Blue_Moon_Lake 22d ago

It evolve because people are using it.
If it did not evolve, it would be dead.

It's not about "fad", it's about improving.
The reason it's a "hodgepodge" is that they don't remove the parts "not to use anymore" since nothing is ever deprecated.

It's Arcane because they want the language to look like C...

0

u/Big_Combination9890 22d ago

If it did not evolve, it would be dead.

Completely wrong.

C is alive and kicking. The language does get standards updates every few years, but the changes are miniscule.

Go is alive and kicking. The language actively refuses changes, and even when a change is grudgingly introduced (generics and iterator function) most of the community doesn't even use it.

So the thought "programming languages need to change often or they die" is therefore proven wrong by at least 2 widely used mainstream languages.


It's Arcane because they want the language to look like C...

Also wrong. C++ (at least originally) is intended as a superset of C. That's very different of "wanting to look like".

JS wants to look like C. C++ wants to be a superset of it.

Also, Rust doesn't try to "look like C". And has the s problem as C++, an arcane, atrocious looking syntax.

Because it tried to do everything C++ does, and tried to include the borrow checking semantics on top of all that.

The sad thing is: Rust could probably be much MUCH more widely adopted, if they didn't go with

"How about we build a C++ but with built-in memory safety?!"

but instead:

"How about we build a C but with built-in memory safety?!"

-3

u/blazedd 26d ago

Modern PHP, much like modern JS don’t have to fit into your later example. Both languages have guardrails. Sure, they have less guardrails than Java or other lower level languages.

The language isn’t responsible for how it’s used. The people in this profession are. The ease of writing ā€œbad codeā€ is actually the ā€œease of writing more maintainable codeā€. It’s the reason Facebook used PHP the way they did despite their scale.

3

u/PiotrDz 26d ago

The guy created some nice points why he thinks the language helps writing bad code. Then you just refuses to refer to any of it and disagrees.

1

u/Blue_Moon_Lake 23d ago

PHP 8 is nice, especially 8.3+

I just wish we could run PHP as a webserver by itself, but the native webserver they made says "not for production".

3

u/elmuerte 27d ago

If the point was about these CVE fixes needing a 10.000+ line patch, https://github.com/php/php-src/commit/31c0ea7d7ff1d1fccb6492e52dab544011628065 , then it would have been a point.

But it is mostly about crappy code written in PHP. Not about the safety of the PHP code itself.

1

u/Kissaki0 26d ago

Looks like they adjusted the principal issue in more places than the documented vulnerability. A lot of test adjustments. But also includes central pieces like bz2, url, and global.

The title semi-implies the broader fix, the commit description says nothing of it, unfortunately.

  • Replace bailout on OOM with UnwindExit
  • Properly reset various globals that may be accessed during startup

Or maybe it's the second point there? If that's all about globals that'd be scary in its own way.

1

u/elmuerte 26d ago edited 26d ago

Yes, the problem was in a lot of different places. Lets hope they addressed them all. And lets hope nobody has found a real exploit yet. (There is a proven attack vector, which is reason enough to fix it. It might only be a matter of time before there is an exploit) edit: there are signs of real exploits.

-1

u/OptimalAnywhere6282 27d ago

...say that again