Open Collective
Open Collective
Loading
PHP Core Roundup #14
Published on June 30, 2023 by Roman Pronskiy

There have been numerous updates and enhancements to the PHP core over the past month, from thought-provoking RFCs to minor yet profound adjustments. Let's dive in and keep up with the most recent PHP developments.

Started over a year ago, the PHP Core Roundup series offers a summary of the latest developments, discussions, and news about PHP Core, contributed by both PHP Foundation members and other participants. This post is the thirteenth in the PHP Core Roundup series.

PHP 8.3.0 QA Releases and Feature-freeze


The upcoming PHP 8.3 version is scheduled to be released on November 23. The newly elected PHP 8.3 release managers made the first QA releases of PHP 8.3 — PHP 8.3.0 Alpha 1 — on June 08, and the second alpha release on June 22.

These alpha versions aren't intended for production environments but are provided for testing and local development.

Compiled Windows binaries are available at windows.php.net/qa, Docker images are available at Docker Hub. For macOS, PHP 8.3.0-dev packages are available via Homebrew from shivammathur/php tap.
If you want to compile the source code yourself, you can find it on php/php-src repository on GitHub.

July 18 marks the feature-freeze for PHP 8.3. It means that all major changes to the language must be discussed and voted on prior to this date in order to make it to PHP 8.3.


Releases


The PHP development team released three new versions in June 2023:
All three include a security fix: GHSA-76gg-c692-v2mw. The random byte generation function used in the SOAP HTTP Digest authentication code was not checked for failure. This could result in a stack information leak.

PHP 8.2.7 and PHP 8.1.20 additionally include several bug fixes and improvements, notably in areas such as Core, Date, Exif, FPM, Hash, LibXML, MBString, Opcache, PCNTL, PGSQL, Phar, Soap, SPL, Standard, and Streams.


Recent RFCs and Mailing List Discussions


Hundreds of awesome PHP contributors put their efforts into improvements to the PHP code base, documentation, and the php.net website. Here is a summary of some changes made by the people behind PHP. Things marked with 💜 are done by the PHP Foundation team.

RFC Updates


Following are the RFCs and major pull-requests discussed, voted on, and implemented since our last update.


Accepted: Marking Overridden Methods by Tim Düsterhus

PHP 8.3 will have a new attribute #[\Override]. If this attribute is added to a method, the engine will validate that a method with the same name exists in a parent class or any of the implemented interfaces. If no such method exists, a compile time error will be emitted.

The similar concepts exist in Java, TypeScript, C++, C#, Swift, Kotlin, and other languages.


Implemented: Define proper semantics for range() function by George Peter Banyard 💜


In the forthcoming PHP 8.3 release, the range() function will have improved behavior. It will now issue warnings or throw exceptions if it receives incompatible or unusable arguments.


Implemented: mb_str_pad() by Niels Dossche


PHP 8.3 will include a new function that works similarly to the existing `str_pad()` function, but with support for multibyte strings. This is a welcome addition for developers working with multibyte strings, as it will make it easier to manipulate and format these strings in PHP.


In Voting: Deprecations for PHP 8.3 by George Peter Banyard 💜, Christoph M. Becker, Máté Kocsis 💜, Tim Düsterhus, Go Kudo, Andreas Heigl


The aim is to clean up some of the older, less consistent parts of PHP to make the language more reliable and predictable. The following list provides a short overview of the functionality targeted for deprecation:
  • Passing negative $widths to mb_strimwidth()
  • The NumberFormatter::TYPE_CURRENCY constant
  • Unnecessary crypt() related constants
  • MT_RAND_PHP
  • Global Mersenne Twister

In Voting: Deprecate Functions with Overloaded Signatures by Máté Kocsis 💜


This RFC proposes to deprecate a number of functions that have overloaded signatures, meaning they behave differently based on the number or type of arguments passed to them. The goal is to make PHP's function signatures more consistent and predictable.



Under Discussion: Closure self-reference by Danack, KapitanOczywisty


This RFC proposes to allow closures to be aliased to a variable that can be used within the closure:
<?php

$fibonacci = function (int $n) as $fn {
    if ($n === 0) return 0;
    if ($n === 1) return 1;
    return $fn($n-1) + $fn($n-2);
};

echo $fibonacci(5);


Merged PRs and Commits


This month, the PHP core team has been hard at work improving the PHP language. See a list of the commits made by the team and grouped by author here.

We are incredibly grateful for the commitment and dedication of all contributors. Stay tuned for next month's roundup as we continue to make PHP better together.


Support PHP Foundation


At PHP Foundation, we support, promote, and advance the PHP language. We financially support six part-time PHP core developers to contribute to the PHP project. You can help support PHP Foundation at OpenCollective or via GitHub Sponsors.

A big thanks to all our sponsors — PHP Foundation is all of us!

Follow us on Twitter @ThePHPF to get the latest updates from the Foundation.
💜️ 🐘