Use a:visited in your CSS stylesheet – Evert Pot

By default browsers will render links blue, and links that have been visited
purple.

This quality of life feature goes back as far as I can remember, a casual
search tells me the feature existed in Mosaic.

I kinda love blue links. They’re so recognizable as links. But with CSS, many
people change the colors of their links.

a { color: #44F }

Unfortunately, when setting a new color the ‘purple visited link’ feature also
gets disabled. I think this is a shame, as there’s so many instances where
you’re going through a list of links and want to see what you’ve seen before.

The 2 examples I ran into today were:

  • AWS Cloudwatch Logs
  • Stackoverflow search results

In each of these products I often find myself going through a list of results,
to find the exact log I need, or to go through a couple of answers before I find
a good one.

Except, every time I hit back, or go to a previous tab it’s up to me to remember
which I have and haven’t visited.

AWS Cloudwatch logs

I get that not everyone wants to multi-colored links across their application,
but if you’re making a list, consider the humble purple link!

a:visited { color: purple }

Confession: I added this rule minutes before I posted this article. Turns out
that while I was annoyed by other applications, I’m guilty of the same thing.

Xdebug Update: January 2020 – Derick Rethans

Xdebug Update: January 2020

Another month, another monthly update where I explain what happened with Xdebug development in this past month. It will be published on the first Tuesday after the 5th of each month. Patreon supporters will get it earlier, on the first of each month. You can become a patron here to support my work on Xdebug. If you are leading a team or company, then it is also possible to support Xdebug through a subscription.

In January, I worked on Xdebug for just over 90 hours, on the following things:

Xdebug 2.9.1 and Xdebug 2.9.2

This month brought two releases. The Xdebug 2.9.1 release restores step debugging performance as it was in Xdebug 2.7.2, while still maintaining the resolved breakpoint feature. Beyond improved performance for debugging, it also addresses a whole range of smaller issues.

The 2.9.2 release is a normal bug fix release, which addresses three relatively minor issue.

With the latest 2.9.2 I also updated the Xdebug web site to have a latest release download page and a historical release download page. On top of that, the code behind the web site no longer computers SHA256 checksums of the download files, but instead they are now committed to GIT. The separation makes the general download page much leaner, which allows me to put other related downloads on that same page too. Which brings me to the next topic.

Business Supporter Scheme and Funding

I have moved the supporters in the Business Supporter Scheme to a more prominent place, right on the front page of https://xdebug.org

In January, no new supporters signed up.

If you, or your company, would also like to support Xdebug, head over to the support page!

Besides business support, I also maintain a Patreon page and a profile on GitHub sponsors.

Podcast

The PHP Internals News has returned with the second season. In this weekly podcast, I discuss in 15-30 minutes, proposed new features to the PHP language with fellow PHP internals developers. It is available on Spotify and iTunes, and through an RSS Feed. In the first episode I spoke with Nikita Popov about Preloading and WeakMaps.

PHP Internals News: Episode 39: Stringable Interface – Derick Rethans

PHP Internals News: Episode 39: Stringable Interface

In this episode of “PHP Internals News” I chat with Nicolas Grekas (Twitter, GitHub, LinkedIn, Symfony Connect) about the new “Stringable Interface” that Nicolas is proposing, as well as about voting rights (on RFCs).

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:16

Hi, I’m Derick. And this is PHP internals news, a weekly podcast dedicated to demystifying the development of the PHP language. Hello, this is Episode 39. Today I’m talking with Nicholas Grekas about an RFC that he’s produced called stringable interface. I already spoke with Nicholas last year about the work that Symfony does the new PHP versions come out to look at deprecations and to make sure that versions of Symfony work with new versions of PHP. But this time Nicholas came up with his own RFC called the stringable interface. Nicholas, could you explain what streamable is?

Nicolas Grekas 0:54

Hello, and Stringable is an interface that people could use to declare that they implement some the magic toString() method.

Derick Rethans 1:02

Because currently there’s not necessary to implement an interface, and PHP’s internals will always use toString if it is available in a class, right?

Nicolas Grekas 1:10

Yeah, absolutely.

Derick Rethans 1:11

What is true reason why you would want to have a stringable interface.

Nicolas Grekas 1:16

So the reason is to be able to benefit from union type in PHP 8. Right now, if you want to accept a string as an argument, it’s pretty easy. You just add the string type, right? Let’s say now you want to accept a string or a stringable object, stringable an object being something that implements this method. If you want to do that, you can not express the type using types today.

Derick Rethans 1:42

Because if you choose string, and then the name of an object that would only do that specific object.

Nicolas Grekas 1:47

Yes, there are some cases in Symfony especially because this is where work and I do open source. Where we do want to not call toString method until the very latest moment. after example is in the code: one is from Drupal. Drupal computes some constraint validation messages, lazyly, and it’s pretty important to them because computing the message itself is pretty costly. They don’t need to compute it all the time. Actually, we added the type, the string type in Symfony five, before it was released and Drupal came and say: Oh, this is breaking our code and our features, what should we do now? And we removed the type and we replaced it by some annotation saying: Okay, this is a string or a stringable object. So in the future, when will add up PHP 6 would like to be able to express that using a type of real one,

Derick Rethans 2:41

PHP 6?

Nicolas Grekas 2:42

No, PHP 8, that’s true. Strings and PHP 6.

Derick Rethans 2:49

Yay.

Nicolas Grekas 2:51

Another example is also is pretty similar, actually. It’s in the symfony auto wiring system. We have services that we wire and so

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

Type Matching in PHP – larry@garfieldtech.com

Type Matching in PHP

One of the nice features of Rust is the match keyword. match is similar to `switch`, but with two key differences:

  1. It requires an exhaustive match, that is, every possible value must be accounted for or a default must be provided.
  2. match is an expression, meaning you can assign the return value of one of its branches to a variable.

That makes match extremely useful for ensuring you handle all possibilities of an enumerated type, say, if using an Optional or Either for error handling. Which… is something I’ve been experimenting with in PHP.

It’s hard to make a PHP equivalent of match that forces an exhaustive match, as PHP lacks enumerated types. However, emulating an expression match turns out to be pretty easy in PHP 7.4, and kind of pretty, too.

Larry
2 February 2020 – 1:46pm

PHP Internals News: Episode 38: Preloading and WeakMaps – Derick Rethans

PHP Internals News: Episode 38: Preloading and WeakMaps

In this episode of “PHP Internals News” I chat with Nikita Popov (Twitter, GitHub, Website) about PHP 7.4 preloading mishaps, and his WeakMaps RFC.

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:16

Hi, I’m Derick. And this is PHP internals news, a weeklish podcast dedicated to demystifying the development of the PHP language. This is Episode 38. I’m talking with Nikita Popov about a few things that have happened over the holidays. Nikita, How were your holidays?

Nikita Popov 0:34

My holidays days were great.

Derick Rethans 0:36

I thought I’d start with something else then I did last year. In any case, and wanting to talk to you this morning about something that happens to PHP seven four over the holidays. And that is issues with preloading on Windows with PHP seven four. I have no idea what the problem is here. Would you try to explain this to me?

Nikita Popov 0:56

So there were actually quite a few issues with preloading in early PHP 7.4 releases. The feature definitely did not get enough testing. Most of the issues have been fixed in 7.4.2. But if you’re using preload-user, what you have to use if you’re running on the root, then you will probably still see crashes and that’s going to be fixed in the next release.

Derick Rethans 1:20

In 7.4.3.

Nikita Popov 1:22

Right. But to get back to Windows, Windows has a well very different process architecture than Linux. In particular, on Linux, or BSD we have fork. Which basically just takes a process and copies its entire memory state to create a new process. This is a lot cheaper than it sounds because it’s all like reuses memory until it’s actually changed.

Derick Rethans 1:48

Its copy on write.

Nikita Popov 1:49

Copy on write exactly. The same functionality does not exist on Windows, or at least it’s not publicly exposed. So on Windows, you can only create new processes from scratch, that look, we use our memory from the previous one. And for OPcache, this is a problem because OPcache would really like to reference internal classes as defined by PHP. But because we store things in shared memory, which is shared between multiple processes, we now have the problem that these internal classes can reside at different addresses, in these different processes. On Linux, it’s always going to be the same address because we are forking and that keeps the address. On Windows each process could have a different address. And especially because Windows since I think Windows Vista, uses address space layout randomization. This is actually pretty much always going to be a different address.

Derick Rethans 2:51

Because that’s a security feature?

Nikita Popov 2:52

Exactly. It’s a security feature.

Derick Rethans 2:54

Would it also be a problem on Linux if you’d start a process instead of forking it?

Nikita Popov 2:59

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