287 points by netol about 23 hours ago | 133 comments | View on ycombinator
yabones about 18 hours ago |
beberlei about 23 hours ago |
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 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 givennticompass about 20 hours ago |
I'd love to upgrade to 8.6 so I can use function partials!
ModernTimes about 14 hours ago |
petecooper about 18 hours ago |
williamdclt about 19 hours ago |
grzes about 12 hours ago |
kijin about 23 hours ago |
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'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 |
trippsydrippsy about 22 hours ago |
vdanielpop about 23 hours ago |
Edit: Thank you for pointing out the `prefers-reduced-motion` media feature, I did not have that enabled.
pryanshu89 about 21 hours ago |
tivatech about 21 hours ago |
zsoltkacsandi about 23 hours ago |
undefined about 18 hours ago |
nticompass about 19 hours ago |
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 |
krick about 14 hours ago |
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 |
shdon about 21 hours ago |
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)));
/facepalmorigini about 22 hours ago |
HackerThemAll about 21 hours ago |
New CVEs/RCEs? https://www.php.net/archive/2026.php#2026-11-18-1
phplovesong about 22 hours ago |
durmusk about 20 hours ago |
rarisma about 21 hours ago |
AuthorizedCust about 19 hours ago |
I get the popularity and installed-base arguments, but I shudder when I see the code.
majestic5762 about 22 hours ago |
- no RCE
skeledrew about 23 hours ago |
shevy-java about 22 hours ago |
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...