PHP Internals News: Episode 71: What didn’t make it into PHP 8.0? – Derick Rethans

PHP Internals News: Episode 71: What didn’t make it into PHP 8.0?

In this episode of “PHP Internals News” we’re looking back at all the RFCs that we discussed on this podcast for PHP 7.4, but did not end up making the cut. In their own words, the RFC authors explain what these features are, with your host interjecting his own comments on the state of affairs.

The RSS feed for this podcast is https://derickrethans.nl/feed-phpinternalsnews.xml, you can download this episode’s MP3 file, and it’s available on Spotify and iTunes. There is a dedicated website: https://phpinternals.news

Transcript

Derick Rethans 0:15

Hi, I’m Derick, and this is PHP internals news, a weekly podcast dedicated to demystifying the development of the PHP language. This is Episode 71. At the end of last year, I collected snippets from episodes about all the features that did not make it into PHP seven dot four, and I’m doing the same this time around. So welcome to this year’s ‘Which things were proposed to be included into PHP 8.0, but didn’t make it. In Episode 41, I spoke with Stephen Wade about his two array RFC, a feature you wanted to add to PHP to scratch an itch. In his own words:

Steven Wade 0:52

This is a feature that I’ve, I’ve kind of wish I would have been in the language for years, and talking with a few people who encouraged. It’s kind of like the rule of starting a user group right, if there’s not one and you have the desire, then you’re the person to do it. A few people encouraged to say well why don’t you go out and write it? So I’ve spent the last two years kind of trying to work up the courage or research it enough or make sure I write the RFC the proper way. And then also actually have the time to commit to writing it, and following up with any of the discussions as well.

Steven Wade 1:20

I want to introduce a new magic method the as he said the name of the RFC is the double underscore to array. And so the idea is that you can cast an object, if your class implements this method, just like it would toString; if you cast it manually, to array then that method will be called if it’s implemented, or as, as I said in the RFC, array functions will can can automatically cast that if you’re not using strict types.

Derick Rethans 1:44

I questioned him on potential negative feedback about the RFC, because it suggested to add a new metric method. He answered:

Steven Wade 1:53

Beauty of PHP is in its simplicity. And so, adding more and more interfaces, kind of expands class declarations enforcement’s, and in my opinion can lead to a lot of clutter. So I think PHP is already very magical, and the precedent has been set to add more magic to it with seven four with the introduction of serialize and unserialize magic methods. And so for me it’s just kind of a, it’s a tool. I don’t think that it’s necessarily a bad thing or a good thing it’s just another option for the developer to use

Derick Rethans 2:21

The RFC was not voted on and a feature henceforth did not make it into PHP eight zero.

Derick Rethans 2:27

Operator overloading is a topic that has come up several times over the last 20 years that PHP has been around as even an extension that implements is in the PECL repository. Jan Bøhmer proposed to include user space based operator overloading for PHP eight dot zero. I asked him about a specific use cases:

Jan Böhmer 2:46

Higher mathematical objects like complex numbers vectors, something like tensors, maybe something like the string component of Symfony, you can simply concatenate this string object with a normal string using the concat operator and doesn’t have to use a function to cause this. Most basically this

Truncated by Planet PHP, read more at the original (another 14876 bytes)

PHP 8.0.0 Release Candidate 5 available for testing – PHP: Hypertext Preprocessor

The PHP team is pleased to announce the eleventh testing release of PHP 8.0.0, Release Candidate 5. This is an extra unplanned release, but we’re not planning to adjust the GA date, however, this may change during the course of the RC cycle. The updated release schedule can, as always, be found on the PHP Wiki page about the PHP 8.0. For source downloads of PHP 8.0.0 Release Candidate 5 please visit the download page.Please carefully test this version and report any issues found in the bug reporting system.Please DO NOT use this version in production, it is an early test version. For more information on the new features and other changes, you can read the NEWS file, or the UPGRADING file for a complete list of upgrading notes. These files can also be found in the release archive. The next release will be the General Availability, planned for Nov 26 2020.The signatures for the release can be found in the manifest or on the QA site.Thank you for helping us make PHP better.

PHP 8.0 feature focus: Named Arguments – platform.sh

Last week’s installment talked about the most contentious new feature of PHP 8.0. In our 10th and final installment, we’ll cover the formerly most contentious feature, one that somehow managed not only to generate little pushback this time around, but to become one of PHP 8.0’s top new features.
In every programming language that has functions (that is, all of them), functions can be called by passing an ordered list of arguments to them as input parameters.

Platform.sh | Journeys Erin Austin + Céline Villet Boongo – platform.sh

Speaking the language of family: how two Platform.sh veterans forged a friendship across the Atlantic Ocean One’s daily commute takes her to the Strasbourg – Saint-Denis stop of the Paris Métro, from where she steps out onto the Boulevard St. Denis, walks a half-block to the Boulevard de Sébastopol, and turns left, passing the sidewalk tables of a trendy brasserie before marching through the elaborately carved stone archway of her office building.

HTTP/2 Push is dead – Evert Pot

One of the hot features that came with HTTP/2 was PUSH frames. The main idea is
that if the server can predict what requests a client might want to make, the
server can preemptively send request/response pairs to the client and warm it’s
cache.

This is a feature I’ve been very interested in for a long time. I feel that it
can be incredibly useful for APIs to invalidate & warm caches, remove the need
for compound requests (which I feel is a hack, although sometimes a
necessary one).

To help advance this idea, I’ve worked on a Internet Draft to let API
clients tell the server what resources they would like to have pushed, I built
a Node.js framework with first-class, deeply integrated Push support, and
added support for Prefer-Push to Ketting.

Unfortunately HTTP/2 push always felt like feature that wasn’t quite there yet.
It’s usefulness was stunted due to Cache-Digest for HTTP/2 being killed
off, and no browser APIs to hook into push events.

The Chrome team has considered removing Push support since at least 2018. The
main reason being that they hadn’t really seen the performance benefit for
pushing static assets. At the time, I tried to defend the feature for
the API use-case.

Yesterday, the Chrome team announced to remove the feature from their HTTP/2 and HTTP/3 protocol implementations.

I’m a little sad that it never got to its full potential, but with this step,
I no longer think it’s worthwhile to invest in this feature. So I’m ceasing
my work on Prefer-Push, and will also remove support from the next major
Ketting version.

On a positive note, I spent a lot of time thinking and working on this, but
it is sometimes nice to just be able to close a chapter, rather than to wait
and let it sizzle out. It’s not an ideal conclusion, but it’s a conclusion
nonetheless.

Current alternatives

Lacking server-driver push, we’re back to many small HTTP request, or compound
requests. This means you either have the N+1 problem, or (in the case of
compound requests) poor integration with HTTP caches. More on this here.

If you’re going the ‘compound request’ route, there is a draft of a similar
header as Prefer-Push; Prefer: transclude, which Ketting also
supports.

A feature that I hoped would work well in the future with Server Push was
server-initiated cache invalidation. We never quite got that. To work around
this, we use Websockets and will keep doing this for the forseeable future.

To reduce general latency of fetching many things, the 103 Early Hints
can help, although this is not supported yet in Chrome, and this is also
only really useful for speeding up delivery of assets like images, css and
Javascript as there’s no way to hook into 1xx responses programmatically in
a browser.

PHP Internals News: Episode 70: Explicit Octal Literal – Derick Rethans

PHP Internals News: Episode 70: Explicit Octal Literal

In this episode of “PHP Internals News” I talk with George Peter Banyard (Website, Twitter, GitHub, GitLab) about an RFC that he has proposed to add an Explicit Octal Literal to PHP.

The RSS feed for this podcast is https://derickrethans.nl/feed-phpinternalsnews.xml, you can download this episode’s MP3 file, and it’s available on Spotify and iTunes. There is a dedicated website: https://phpinternals.news

Transcript

Derick Rethans 0:15

Hi, I’m Derick, and this is PHP internals news, a weekly podcast dedicated to demystifying the development of the PHP language.

Derick Rethans 0:24

This is Episode 70. Today I’m talking with George Peter Banyard, about a new RFC that he’s just proposed for PHP 8.1, which is titled explicit octal literal. Hello George, would you please introduce yourself?

George Peter Banyard 0:38

Hello Derick, I’m George Peter Banyard, I’m a student at Imperial College London, and I contribute to PHP in my free time.

Derick Rethans 0:46

Excellent, and the contribution that you’re currently have up is titled: explicit octal literal. What is the problem that this is trying to solve?

George Peter Banyard 0:56

Currently in PHP, we have four types of integer literals. So decimal numbers, hexadecimal, binary, and octal. Decimal is just your normal decimal numbers; hexadecimal starts with 0x, and then hexadecimal characters so, null to nine and A to F, and then binary starts with 0b, and then it’s only zeros and ones. However, octal notation is just a decimal, something which looks like a decimal number, which was a leading zero, which doesn’t really look that much different than a decimal number, but it comes from the days from C and everything which just uses like a zero as a prefix.

Derick Rethans 1:48

But I have seen is people using like array keys for the, for the month names right and they use 01, 02, 03, you get 07, and 08 and 09, and then they look at the arrays. They notice that they actually had the zeroth element in there but no, but no eight or nine. That’s something that is that PHP no longer does I believe. No, it’s mostly that the parser doesn’t pick it up anymore. Instead of silently ignoring the eight, it’ll just give you an error. You’ve mentioned that there’s these four types of numbers with octal being the one started with zero. But what’s the problem with is that a moment?

George Peter Banyard 2:31

Sometimes when you want to use, which looks like decimal number. So, for example, you’re trying to order months, and use like the full two digits for the month number, instead of just one, you use 01, as an array key. When you get to array, it will parse error because it can’t pass 08 as an octal number, which is very confusing, because it. Most people don’t deal with octal numbers that often, and you would expect everything to be decimal. Because numeric strings are always decimal, but not integers literals. So, the proposal is to add an explicit octal notation, which would be 0o. So python does that, JavaScript has it, Rust also has it, to allow like a by more explicit to say oh I’m dealing with an octal number here. This is intended.

Derick Rethans 3:33

Beyond having the 0b for binary, and the 0x for hexadecimal, the addition of 0o for octal is the plan to add. And is that it?

George Peter Banyard 3:45

That’s more or less the proposal. It’s non-BC, because the parser before would just parse or if you had 0o, so t

Truncated by Planet PHP, read more at the original (another 12825 bytes)

PHP 8.0.0 Release Candidate 4 available for testing – PHP: Hypertext Preprocessor

The PHP team is pleased to announce the tenth testing release of PHP 8.0.0, Release Candidate 4. At this time, we’re not planning to adjust the GA date, however this may change during the course of the RC cycle. The updated release schedule can, as always, be found on the PHP Wiki page about the PHP 8.0. For source downloads of PHP 8.0.0 Release Candidate 4 please visit the download page.Please carefully test this version and report any issues found in the bug reporting system.Please DO NOT use this version in production, it is an early test version. For more information on the new features and other changes, you can read the NEWS file, or the UPGRADING file for a complete list of upgrading notes. These files can also be found in the release archive. The next release will be the General Availability, planned for Nov 26 2020.The signatures for the release can be found in the manifest or on the QA site.Thank you for helping us make PHP better.

PHP 8.0 feature focus: Attributes – platform.sh

Metaprogramming gets more meta in PHP 8.0. Last time, we looked at one of the three headline features of PHP 8.0: Constructor Property Promotion. Today, we’ll look at the second: Attributes.
A history of change Some PHP changes are proposed, discussed, implemented, and approved in short order. They’re uncontroversial, popular, and have a natural way to implement them.
And then there are the ones that are tried, fail, and come back multiple times before they are finally accepted.