r/programming • • Oct 21 '26

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 Oct 21 '26

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 Oct 21 '26

Oh they just have AI now šŸ˜‚

1

u/Leading_Standard_998 Oct 22 '26

Apparently it's called "SI" now lmao

4

u/Theemuts Oct 22 '26

Slop Intelligence

1

u/sysop408 Oct 26 '26

Stupid Idiocy

13

u/blazedd Oct 21 '26 • 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 Oct 22 '26 • 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 Oct 25 '26

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 Oct 23 '26

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

1

u/Big_Combination9890 Oct 23 '26

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 Oct 22 '26

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 Oct 23 '26

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 Oct 23 '26 edited Oct 23 '26

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 Oct 25 '26

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 Oct 26 '26

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 Oct 26 '26

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 Oct 26 '26

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 Oct 22 '26

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 Oct 22 '26

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 Oct 25 '26

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 Oct 22 '26

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 Oct 22 '26

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 Oct 22 '26 edited Oct 22 '26

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 Oct 22 '26

...say that again