Xdebug Update: October 2020 – Derick Rethans

Xdebug Update: October 2020

Another monthly update where I explain what happened with Xdebug development in this past month. These will be published on the first Tuesday after the 5th of each month.

Patreon and GitHub supporters will get it earlier, on the first of each month.

I am currently looking for more funding, especially now some companies have dropped out.

You can become a patron or support me through GitHub Sponsors. I am currently 66% towards my $1,000 per month goal.

If you are leading a team or company, then it is also possible to support Xdebug through a subscription.

In October, I worked on Xdebug for about 75 hours, with funding being around 45 hours. I worked mostly on the following things:

Xdebug 3

Xdebug had its first beta release in October, 3.0.0beta1 so that uses can test out the new speed improvements, new functionality, new ways of configuring things, as well as support for PHP 8.

Some bugs were found, and I’m continuing to work together with JetBrains to make sure all the new configuration methods are also supported with/through PhpStorm.

There are also several anecdotal reports that Xdebug 3 is indeed a lot faster in many environments. I have asked the community for benchmarks, but I have not seen any write ups beyond a tweet, and an article.

PHP Internals News: Episode 69: Short Functions – Derick Rethans

PHP Internals News: Episode 69: Short Functions

In this episode of “PHP Internals News” I talk with Larry Garfield (Twitter, Website, GitHub) about a new RFC that’s he proposing related to Short Functions.

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

Hello, this is Episode 69. Today I’m talking with Larry Garfield, about an RFC that he’s just announced called short functions. Hello Larry, would you please introduce yourself?

Larry Garfield 0:35

Hello World, I’m Larry Garfield, the director of developer experience at platform.sh. These days, you may know me in the PHP world mainly from my work with PHP FIG. The recent book on functional programming in PHP. And I’ve gotten more involved in internals in the last several months which is why we’re here.

Derick Rethans 0:57

I’m pretty sure we’ll get back to functional programming in a moment, and your book that you’ve written about it. But first let’s talk about short functions, what are short functions, what is the problem that are trying to solve?

Larry Garfield 1:11

Well that starts with the book actually. Oh. Earlier this year, I published a book called Thinking functionally in PHP, on functional programming in PHP, during which I do write a lot of functional code, you know, that kind of goes with the territory. And one of the things I found was that the syntax for short functions, or arrow function, or can be short lambdas, or arrow functions, you know whatever name you want to give them, was really nice for functions where the whole function is just one expression. Which when you’re doing functional code is really really common. And it was kind of annoying to have to write the long version with curly braces in PSR 2, PSR 12 format for functions that I wanted to have a name, but we’re really just one line anyway does return, blah blah blah. It worked, got the job done.

Larry Garfield 2:13

Then hanging around with internals people, friend of the pod Nikita Popov mentioned that it should be really easy. Now that we’ve got short functions, or short lambdas, do the same thing for named functions. And I thought about. Yeah, that should be doable just in the lexer, which means, even I might be able to pull it off given my paltry miniscule knowledge of PHP internals. So, I took a stab at it and it turned out to be pretty easy. Short functions are just a more compact syntax for writing functions or methods, where the whole thing is just returning an expression.

Derick Rethans 2:56

Just a single expression?

Larry Garfield 2:58

Yes. If your function is returning two parameters multiplied together, it’s a trivial case but you often have functions or methods that are doing. Just one expression and then returning the value. It’s a shorter way of writing that. Mirrored on the syntax that short lambdas use. It doesn’t enable you to really do anything new, it just lets you write things in a more compact fashion. But the advantage I see is not just less typing. It lets you think about functions in a more expression type way, that this function is simply a map from input to this expression, which is a mindset shift. So yes it’s less typing but it’s also I can think about my problem as simply an expression translatio

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

PHP 8.0 feature focus: Constructor Property Promotion – platform.sh

The last post talked about how PHP 8.0 makes PHP faster. Today, we’ll look at a way that it will make you faster.
Perhaps the largest quality-of-life improvement to PHP 8.0 is Constructor Property Promotion. The syntax has been borrowed largely from Hack, Facebook’s PHP fork, although it exists in other languages like TypeScript and Kotlin with various syntaxes.
It’s easiest to explain with an example. Consider your typical service class in a modern application:

PHP 8.0 feature focus: Just-in-Time compilation – platform.sh

Last time, we looked at ways in which PHP 8.0 has become stricter. Today, we look at the next step in PHP becoming faster.
Some background Computers don’t actually understand programming languages; they understand very low level instructions no human could write by hand. There are many ways of getting from a human-readable language like PHP or Rust to a computer-understandable set of instructions.
The most basic, and usually most performant, way is to compile the human-friendly source code directly to CPU instructions “Ahead-of-Time” (AOT).

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

The PHP team is pleased to announce the tenth testing release of PHP 8.0.0, Release Candidate 3. 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 3 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 Release Candidate 4, planned for Nov 12 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: Language tightenings – platform.sh

In our last chapter we went over several smaller feature improvements to PHP. Today, we’ll cover several minor language changes that make PHP safer, but may trip up some older code.
There’s been a very steady trend in PHP over the last several years toward making the language tighter. That means more edge cases that are “undefined behavior that kinda silently works most of the time” turn into explicit warnings or errors, behavior that was documented but totally illogical gets adjusted to be more logical, and so on.