Hacker news

  • Top
  • New
  • Past
  • Ask
  • Show
  • Jobs

What's New in PHP 8.6 (https://www.php.net)

287 points by netol about 23 hours ago | 133 comments | View on ycombinator

yabones about 18 hours ago |

Appears the big scary vulnerability that was announced recently is in 8.5+, so definitely upgrade your stuff if you're on a new version... For the rest of us in "debian land" running 8.3-8.4, looks like there's nothing to worry about for now.

https://github.com/php/php-src/security/advisories/GHSA-8mjj...

https://github.com/php/php-src/security/advisories/GHSA-2fjv...

The other Critical CVE looks very very difficult to actually exploit, since it has to do with a very specific configuration during startup.

https://github.com/php/php-src/security/advisories/GHSA-gr4f...

beberlei about 23 hours ago |

Most excited about the ZTS overhead reduction. If you are unfamiliar PHP can run either with or without thread safety (think using pthreads in PHP requests).

If the overhead can be further reduced (and people have ideas) then it could be that we only need ZTS mode anymore in the future and that can open up one avenue for PHP to get native async support similar to the existing parallel extension: https://github.com/krakjoe/parallel

More "hands-on" is the stream error handling improvements. This greatly improves the old file stream APIs to now allow throwing exceptions instead of returning false on errors:

  $context = stream_context_create([
    'stream' => [
        'error_mode' => StreamErrorMode::Exception,
    ],
  ]);

  try {
    $config = file_get_contents('/etc/app/config.json', context: $context);
  } catch (StreamException $e) {
    // handle error
  }

p4bl0 about 19 hours ago |

I'm a bit sad that there's still no way to limit the number of arguments of a user-defined function in the type system. The internal functions have that.

I know that introducing such a behavior by default could break existing code, but it seems relatively easy to introduce this feature in a backward compatible way by using the void type. For example :

    function foo (void) {}
    foo(42); // fatal error: foo() expects exactly 0 arguments, 1 given

    function bar ($a, $b, void) {}
    bar(1, 2, 3); // fatal error: bar() expects exactly 2 arguments, 3 given

    function baz ($a, $b=null, void) {}
    baz(1, 2, 3); // fatal error: baz() expects at most 2 arguments, 3 given

nticompass about 20 hours ago |

I /finally/ just upgraded our PHP app from 7.4 to 8.3 (totally not just because of the PHP vulnerabilities). I can't wait to jump to 8.5, so I can use the pipe (`|>`) operator.

I'd love to upgrade to 8.6 so I can use function partials!

ModernTimes about 14 hours ago |

Got hit with the deprecated metaphone() function, but Gemini wrote me a PHP native drop-in replacement, wish me luck.

petecooper about 18 hours ago |

williamdclt about 19 hours ago |

I can't make up my mind on FPA. On the one hand it's very elegant and I always feel like I need it when writing code, on the other hand it makes a function declaration look reaaaaally close to a function invocation, which is super confusing

grzes about 12 hours ago |

do you guys now if PHP 8.6 will be included in upcoming Debian Forky?

kijin about 23 hours ago |

Before you all get excited about the new version, patch the old version you're running now!

The PHP team announced that they're going to release a critical fix between 14:00 and 14:30 UTC today. Doesn't say whether 8.6 is affected too, but the vulnerability is probably at the top of their mind right now -- even more so than the 8.6 release.

jmyeet about 19 hours ago |

I'm honestly disappointed at the number of snark comments on HN about PHP. It's like posting 2007 memes. Yes, we all know the story of htmlspecialchars(). We can make fun of "global" when we don't realize "global" actually means "request scoped". We get it.

I've always viewed PHP as having these ideal features:

1. A stateless functional core. It's cheap to run and quick to start. Compare this to Java or even Python. There's no loading a bunch of class libraries;

2. Every request has an environment created then torn down. That means it's hard for a given request handler to leak memory or other resources. You compare this to, say, Java's servlet API (which only really existed because the startup costs were too high) where resource leaking is a real problem and then you get into GC and STW pauses; and

3. Every request is single-threaded. This is ideal. Async network/IO requests are handled via extensions. You should never need to spawn a thread in a request handler directly. You eliminate a whole class of bugs by doing this.

Is PHP perfect? No. The class separator as the backslash still offends me more than a decade later. I really wish Facebook's Hack had become PHP because it's got a vastly better type system, core collection classes (list, vec, dict) and it did things a decade ago that PHP is only added with this release (eg polling).

As for partial functions, the use case seems to be versioning? I actually prefer the Javascript polyfill method here where possible. Don't make users care about this kind of stuff.

m4rtink about 20 hours ago |

CVEs!

trippsydrippsy about 22 hours ago |

[dead]

vdanielpop about 23 hours ago |

Can we not have animations that slow down my scroll on these kinds of pages? It's so pointless.

Edit: Thank you for pointing out the `prefers-reduced-motion` media feature, I did not have that enabled.

pryanshu89 about 21 hours ago |

[flagged]

tivatech about 21 hours ago |

[flagged]

zsoltkacsandi about 23 hours ago |

[flagged]

undefined about 18 hours ago |

undefined

nticompass about 19 hours ago |

Gotta love all the "PHP bad" comments that appear on any PHP post (regardless of what it's about). I, for one, am I excited about this release. Modern PHP (php8+) is pretty nice and a lot of the old "PHP bad" issues from back in the day are non-existent.

Though, I guess I've been a PHP developer for a long time now. Professionally, since 2012 and has a hobby years before that. I refuse to stop learning/using PHP!

Yes, there are other web server languages. Yes, PHP had its issues. Yes, legacy PHP can be pretty awful (ask me how I know). But, it's not going anywhere and all the "PHP bad" comments are not helpful.

PaulHoule about 13 hours ago |

Love the partial function application syntax but it's a little scary to me that people are writing PHP scripts that use select, Xpoll, etc.

krick about 14 hours ago |

Ok, let's see what do we have in here.

Not a huge fan of partial function application syntax. Was it really necessary when you already have short anonymous function? What does it cost you to write that explicitly? Like, 10 extra characters? It is way more readable and clear what you mean when a variable has a name, not just `?`. WTF is `?`?

Pretty much the same for DocComments for params. Uh... why? I don't see anything wrong with the old way.

Duration class... well, we all already had duration classes in our projects, didn't we? It looks alright, but it's a real pity operator overloading isn't a native part of the language still. Why do we still have to `->add()` instead of `+`?

Similarly harmless but not hugely exciting are `clamp()` and `SortDirection`. The former isn't that hard to implement, but I don't think I ever did somehow, so thank you. SortDirection is literally just a built-in enum, not a huge deal. Libraries will still use their own implementations for a long time just to preserve back-compatibility.

Polling... Well, I'd usually opt for some other language instead of using PHP like that, but sometimes you need it.

Stream Error Handling and Readonly Defaults are great and overdue.

All in all, doesn't look to be a terribly exciting update.

pwmglenn about 21 hours ago |

Partial application in PHP? WOW.

shdon about 21 hours ago |

I guess the clamp function really is needed, as even in their release notes, they did the clamping using min/max incorrectly.

Their PHP8.5 examples are written as:

  var_dump(max($value, min($lower_bound, $upper_bound)));
but that should be:

  var_dump(max($lower_bound, min($value, $upper_bound)));
/facepalm

origini about 22 hours ago |

Ah yes the clamp() function good thats in

HackerThemAll about 21 hours ago |

> What's New in PHP 8.6

New CVEs/RCEs? https://www.php.net/archive/2026.php#2026-11-18-1

phplovesong about 22 hours ago |

Still no builtin unicode support? What the hell is this? A web language that does not default to unicode, thats pretty weak for a language in 2026

durmusk about 20 hours ago |

Hopefully not another php2shell

rarisma about 21 hours ago |

Perhaps it will contain something new that will come back to haunt us in six or so months.

AuthorizedCust about 19 hours ago |

Why is this language still around?

I get the popularity and installed-base arguments, but I shudder when I see the code.

majestic5762 about 22 hours ago |

What's New in PHP 8.6?

- no RCE

skeledrew about 23 hours ago |

[flagged]

shevy-java about 22 hours ago |

[flagged]