zlacker

PHP 8.2

submitted by TimWol+(OP) on 2022-12-08 12:22:05 | 263 points 282 comments
[view article] [source] [go to bottom]

NOTE: showing posts with links only show all posts
1. Dachan+s2[view] [source] 2022-12-08 12:43:58
>>TimWol+(OP)
Not as big a leap compared to 8.1 since Nikita left full-time development, but still a good trend. Lots of good changes to types (removing dynamic properties by default, redacted properties, readonly classes, more complex types etc).

https://stitcher.io/blog/new-in-php-82

4. tored+34[view] [source] 2022-12-08 12:53:54
>>TimWol+(OP)
There is an error in the examples on this release page about traits with constants, it says that

return self::CONSTANT; // Fatal error

however that is actually allowed, what is an fatal error is

return Foo::CONSTANT; // Fatal error

compare

https://3v4l.org/dIeOk#v8.2rc7

https://3v4l.org/11of1#v8.2rc7

Prohibit direct access through a trait name

https://wiki.php.net/rfc/constants_in_traits

◧◩
5. TimWol+k4[view] [source] [discussion] 2022-12-08 12:55:48
>>Aachen+24
Only this specific curly braces syntax, which is less powerful than the still-supported '{$foo}' variant: https://wiki.php.net/rfc/deprecate_dollar_brace_string_inter...
◧◩
6. jorams+s4[view] [source] [discussion] 2022-12-08 12:57:16
>>Aachen+24
PHP string interpolation has 3 possible syntaxes: $var, {$var} and ${var}. The last one is now deprecated. I've never seen it used in the wild, and it has some odd limitations. It's discussed in the RFC[1].

[1]: https://wiki.php.net/rfc/deprecate_dollar_brace_string_inter...

11. nixcra+H5[view] [source] 2022-12-08 13:05:41
>>TimWol+(OP)
PHP 8.2.0 changelog - https://www.php.net/ChangeLog-8.php#8.2.0

PHP supported versions - https://www.php.net/supported-versions.php

◧◩◪◨
19. conrad+v7[view] [source] [discussion] 2022-12-08 13:17:46
>>pwytho+v6
Pick one framework between Symfony and Laravel and follow the docs.

Maybe read https://stitcher.io posts about the new features since 8.0 to have a grasp of the language changes.

21. Cianti+R7[view] [source] 2022-12-08 13:21:04
>>TimWol+(OP)
As someone who has written in past a lot of PHP and Python, I find it interesting that PHP devs can do a lot of breaking changes, and don't get a huge amount of flak for it.

Python 2 -> 3 change really was painful for Python community, but PHP does these almost fundamental breaking changes so often, that maybe people just get used to it? I haven't really followed Python past version 2, but I think they are less likely to ever do such amount of breaking changes.

There must be a lot of unmaintained PHP codebases that will break if PHP is updated by hosting provider etc. Someone must be pulling a lot of hairs because of this.

Edit: Those dogpiling there, I rest my case with josefresco's comment:

https://news.ycombinator.com/item?id=33907628

It's painful. Dropping dynamic properties? That will be a lot of fun. WordPress is probably biggest segment for PHP usage.

◧◩◪
60. trilli+Sb[view] [source] [discussion] 2022-12-08 13:46:32
>>nathel+ja
Yes. Looks like the canonical use if for ENV vars though?

https://www.php.net/manual/en/configuration.file.php

◧◩◪
65. tiffan+ic[view] [source] [discussion] 2022-12-08 13:48:21
>>zmxz+lb
Related to #2, doesn’t this then make PHP stateful - which some might argue is a negative.

EDIT: have you looked at ngx-php. It’s blazing fast and provides you that event loop.

https://github.com/rryqszq4/ngx-php

https://www.techempower.com/benchmarks/#section=data-r21

◧◩◪
70. mgkims+1d[view] [source] [discussion] 2022-12-08 13:58:02
>>adlpz+r9
The 7 series is 'done' with security updates as of now. https://www.php.net/supported-versions.php

So there's some argument to be made to be in the 8.x series. It's probably not something you should be losing sleep over just yet, but at least have it on your roadmap to address in the coming months.

◧◩◪◨
73. radioj+Ed[view] [source] [discussion] 2022-12-08 14:02:40
>>adlpz+Ca
When I tried updating my network of 200+ WordPress websites to 8.0, more than 40 websites broke directly. It's a bit better on 8.1 but in no way is WordPress ready for 8.x at this point.

PHP 8 is in "beta support" currently, but that's just Core. A lot of plugin developers are lightyears behind it seems:

https://make.wordpress.org/core/handbook/references/php-comp...

◧◩
79. porker+2e[view] [source] [discussion] 2022-12-08 14:05:11
>>user39+j7
For the order of function arguments: sounds like you'd enjoy https://github.com/azjezz/psl.

Yes it's a userland workaround and not a fix for the language, but it's thinking about these issues and a PHP extension (offering better performance) is being talked about.

◧◩◪
87. jjice+9f[view] [source] [discussion] 2022-12-08 14:12:23
>>Y-bar+3b
It's not the same, but MySQL offers like 8 years https://endoflife.software/applications/databases/mysql. Obviously very different software with different goals and monetization models (none vs some). Not apples to apples but figured it was a good example of what someone might have in mind.
◧◩◪
117. user39+Si[view] [source] [discussion] 2022-12-08 14:36:43
>>porker+2e
Yep that's a great library, I'd like to see some of it in core. Same with this: https://github.com/lstrojny/functional-php which overlaps somewhat.

The no-brainers to me are the missing array_some()/array_any() array_every()/array_all() and an array_search() that takes a predicate and iterable. I do these now in userland but an optimized native version would be nice.

◧◩◪
121. apocal+yj[view] [source] [discussion] 2022-12-08 14:40:24
>>debesy+N9
The biggest issue is generally server support. Finding servers that support older versions or even package managers that still have the older unsupported versions can be miserable. Thankfully the Sury packages are still around as an alternative, but that's only valid if you're running a system you have full control over (ie a VPS).

A lot of cPanel or similar hosts are also retiring old versions as they hit EOL [1][2][3][4][5] (those all support 7.4 still but most have indicated that will be dropped next year as well). This has made hosting transfers more and more difficult if you don't want to go through the process of upgrading.

The process of upgrading Wordpress sites isn't so bad (generally there's no work, honestly). But not all CMSs are that simple and it can get more laborious when you want to upgrade a Laravel or Symfony site, especially if you've skipped a few versions.

Of course, at the end of the day, it's up to the client to provide budget for these things and if they don't/can't, you just have to push back on their other requests until they do.

1: https://in.godaddy.com/help/retiring-old-php-versions-41164 2: https://www.bluehost.com/hosting/help/php-version-selection-... 3: https://help.dreamhost.com/hc/en-us/articles/215082337-What-... 4: https://wpengine.com/support/php-guide/ 5: https://getflywheel.com/wordpress-support/php-on-flywheel/#p...

◧◩◪◨
135. denton+tm[view] [source] [discussion] 2022-12-08 14:58:15
>>mieko+vi
> I've seen this situation blamed on both OS packagers or language ecosystems, but now I just think the goals between the two just are fundamentally at odds.

I hate language-specific package managers. I can see their value to packagers (less work), but they end up arguing with the platform package manager.

It's like there's a load of CS graduates churning out lots of new, better languages; but what's really needed is just one better language. Similarly we have a score of new package managers, creating incompatibilities; so we add some more package managers, to paper over the incompatibilities.

I'm inclined to the view that perhaps there are too many coders in the world, creating compilers and package managers because they can't get a job doing something useful.

https://www.reddit.com/r/linux/comments/nnxng/petition_lenna...

◧◩◪
137. htag+0n[view] [source] [discussion] 2022-12-08 15:00:45
>>debesy+N9
In general yes, because of security support.

Moving from 7.4 -> 8.2 will be just as much refactoring as moving from 7.4->8.0->8.1->8.2. Security support is in general three years [0] so everything 7.X is now unsupported. Considering the security cadence you can skip one version, but if you skip two you'll probably be out of security support before you migrate to a new version. My philosophy is if you're going to need to do the work to upgrade anyway, you might as well do smaller chunks more frequently and be able to take advantage of the language goodies that come out earlier.

The amount of the language that gets deprecated every year is PHP's fundamental flaw, at least in the last five years.

[0] https://www.php.net/supported-versions.php

◧◩◪
159. vntok+ky[view] [source] [discussion] 2022-12-08 15:53:40
>>pacifi+Ug
How do you mean? The meta ticket (https://core.trac.wordpress.org/ticket/56009#comment:27) is pretty clear that all unit tests are passing, the only issues left being deprecation notices, not errors. Have you tried it and found the core failed somewhere?
◧◩
180. acomje+yQ[view] [source] [discussion] 2022-12-08 17:12:08
>>josefr+A8
I think we need a LTS (long term support) version of PHP. One of the great things about it was the non-breaking upgrades for so many years. I mean no version of php7 is supported?

https://www.php.net/supported-versions.php

I know the web needs constant maintenance, but I wish it wasn't so much. PHP has been pretty good about not breaking changes, but I've noticed a few..

PHP is my goto. Its pretty great. It enabled a startup I was part of to get off the ground.

◧◩◪◨⬒
189. trey-j+OU[view] [source] [discussion] 2022-12-08 17:32:31
>>Y-bar+XS
It doesn't though (granted, support for PHP 7.4 only ended 10 days ago, so you can be forgiven for not knowing): https://www.php.net/supported-versions.php

But PHP 7.4 is not compatible in many ways with PHP 7.3, so lumping them together is not OK. As you can see, PHP 8.0 which was only released two years ago, is no longer receiving active support. Definitely, database LTS is not comparable to programming languages. However such rapid releases of breaking versions is a relatively new phenomenon (thanks NodeJS), and I get the feeling that you've never actually supported a software project for 5+ years.

◧◩
206. neuros+151[view] [source] [discussion] 2022-12-08 18:25:38
>>revski+X9
ASDF has php plugin so you can install multiple versions of php, python, nodejs, etc in your machine without conflicts.

https://asdf-vm.com/

◧◩◪
243. jijji+gs2[view] [source] [discussion] 2022-12-09 02:12:21
>>debesy+N9
PHP 8.x vs 5.x is an order of magnitude performance increase [0] as long as you enable jit and opcache in php8 [1]

[0]https://www.cloudways.com/blog/wordpress-performance-on-php-...

[1] https://stitcher.io/blog/php-8-jit-setup

[go to top]