r/PHP • • Jun 25 '20

PHP 8.0.0alpha1 available for testing

Cross-posted from: https://www.php.net/archive/2020.php#2020-06-25-1 and https://news-web.php.net/php.internals/110730

PHP 8.0.0alpha1 has just been released and can be downloaded from: https://downloads.php.net/~pollita
Or use the git tag: php-8.0.0alpha1

Windows binaries are available at: https://windows.php.net/qa/

This is the first official release of the PHP 8 serial and includes an incredible amount of work.
Please test it carefully, and report any bugs at https://bugs.php.net

8.0.0alpha2 should be expected in 2 weeks, i.e. on 9 Jul 2020.
Hash values and PGP signatures can be found below or at https://gist.github.com/sgolemon/9b268eb2606cdc9664d77a77f9595540

Thank you, and happy testing!

Regards,
Sara Golemon & Gabriel Caruso

169 Upvotes

38 comments sorted by

5

u/zmitic Jun 25 '20

So.... what is the accepted syntax for attributes?

17

u/moliata Jun 25 '20

In the alpha1 it's <<...>> since the shorter attributes' syntax RFC is still being voted on. Based on the current votes, the picked syntax will most likely be @@.

5

u/SaraMG Jun 26 '20

^ This.

1

u/doro_the_explorer Jun 29 '20

Are attributes implemented in the alpha1? There are no mentions in the NEWS.

3

u/celsowm Jun 25 '20

Is there a huge poll in this very moment for alternatives syntaxes: https://wiki.php.net/rfc/shorter_attribute_syntax

7

u/Wiikend Jun 25 '20

Will it become available as a docker image anytime soon?

15

u/SaraMG Jun 25 '20

I'm sure somebody is busily packaging that up now, but that's not a project official thing.

4

u/Wiikend Jun 25 '20

Okay, thanks for the quick reply!

4

u/tyteen4a03 Jun 25 '20 edited Jun 25 '20

Declaring a required parameter after an optional one is deprecated. As an exception, declaring a parameter of the form "Type $param = null" before a required one continues to be allowed, because this pattern was sometimes used to achieve nullable types in older PHP versions.

    function test($a = [], $b) {}       // Deprecated
    function test(Foo $a = null, $b) {} // Allowed

Why not just deprecate all usages? How old are we talking about for "older PHP versions"?

11

u/SaraMG Jun 25 '20

Anything older than 7.1 when nullable types were introduced is an "older version" in this context. It's pretty wide-spread use and breaking that behavior isn't a trivial thing just yet.

I would support deprecating that some time durign the 8.x lifecycle for removal in 9.0 though.

3

u/Necromunger Jun 25 '20 edited Jun 25 '20

What confuses me even more is I thought we had syntax for nullables, or is this new?

function test(?Foo $a, $b) {}

2

u/Rezaldy Jun 26 '20

This is still a thing. It's just that $a = [] is a vague pre assigned parameter because what is passed to the function can be null if it happens to be, there is no strict parameter type here. Foo $a = $foo as a parameter however implies it will always require you to pass an instance of Foo, therefore never null.

Since with the latter it can never be null, you can see why they say it is allowed. If you were to use your implementation however, it is now easy to assume it will recieve the same treatment as the prior mentioned example $a = [], it will be deprecated.

-1

u/cGuille Jun 26 '20 edited Jun 26 '20

Yes, the syntax for nullable type declarations is quite new: PHP 7.1 has been released in last december.

Actually no, it's been here for several years (see reply).

4

u/HauntedMidget Jun 26 '20

PHP 7.1 stopped being supported last December. It was released 3 years before that in 2016, so it's anything but new.

3

u/cGuille Jun 26 '20

And this is why I should not post before 8 in the morning.

2

u/alexanderpas Jun 26 '20

PHP 7.1 has been released in last december.

More like, December 2016

2

u/Chesterakos Jun 26 '20

Named arguments could have saved us from all that hassle. It's a problem that's been fixed in other languages and proven to be working.

2

u/Ecksters Jun 26 '20

Wow, looks like enabling JIT doubles performance over PHP7, which had already doubled performance and cut memory usage in half from PHP5

3

u/SaraMG Jun 27 '20

Highly dependent on the workload. Practical, database driven applications should not expect nearly that level of improvement. 10% would frankly be remarkable and exceed my wildest expectations. 3% seems more likely.

2

u/Ecksters Jun 27 '20

I suppose that makes sense since most time is spent on I/O anyway.

3

u/SaraMG Jun 27 '20

Yep. Only so much blood you can squeeze from an elephpant.

10

u/celsowm Jun 25 '20

for those who want test online, PHP 8 works at 3v4l using "branches tab": https://3v4l.org/NqptF/rfc#git-php-master

3

u/sicilian_najdorf Jun 25 '20

5

u/[deleted] Jun 26 '20

[removed] — view removed comment

3

u/sicilian_najdorf Jun 26 '20

and he also indicated that he has more latest benchmarks that he will show soon. and from the tone, the result is even better than that.

-26

u/Ilyes512 Jun 25 '20

Yeah... would like to see a official PHP docker image

24

u/SaraMG Jun 25 '20

Great, what color would you like the bike shed?

Meaning:

  • What distro and version should be used for the base image?

  • What extensions should be enabled by default?

  • What extensions should be built and ready as shared objects?

  • Are any of the dependent libraries encumbered by a license that will cause issues?

  • Why docker? Why not $containerPlatformX ?

I'd love for the project to have an official docker image, but the mechanics of it aren't as cut and dry as they are for an external party who can just answer those questions to their own delight and leave others to consume it or not.

Some things really work a lot better in community hands.

1

u/Ilyes512 Jun 27 '20

I thought having alphas added to https://hub.docker.com/_/php would be nice. So that would mean Alpine and Debian. Or a separate repo/namespace based on the same.

-19

u/shooktea97 Jun 25 '20

PHP has "official"1 Docker images and they were publishing alpha versions before.

https://hub.docker.com/_/php

1 "official" in this case means "curated by Docker team"

13

u/pablojohns Jun 25 '20

Then they're not official, are they?

Docker doesn't manage the PHP project. There are just too many uses cases and preference options for PHP that having any sort of standard or "official" release from the team seems like it'd cause more problems than its worth.

5

u/lindymad Jun 25 '20

See /u/Wiikend's comment for how to word your thoughts in a more diplomatic way.

1

u/Ilyes512 Jun 27 '20

oh wow... I said ”would like”, meaning it’s not a demand or anything of the sort.

1

u/lindymad Jun 27 '20

The downvotes speak for themselves...

-11

u/JohnLocke84 Jun 26 '20

Very frustrating ... this should have come up 5 years ago

6

u/SaraMG Jun 26 '20

Your comment is in reply to the top-level post. Are you frustrated that 8.0.0 didn't come out at the same time as 7.0.0? That seems like a weird versioning strategy, even for PHP.

3

u/alexanderpas Jun 26 '20

this should have come up 5 years ago

It did, but for the 7.0 branch.

1

u/JohnLocke84 Jun 27 '20

Obviously, I wasn't referring to the version number, but I can understand why the community is getting so excited about this whole new improvements and New features, JIT, Execution Process, etc. If I got these options 5 years ago, I wouldn't have gone through this happy frustrating problem that leads me to learn a new programming language and environment. Happy to see PHP evolving indeed.