Welcome to the first PHP Roundup, where weโll make regular updates on the improvements made to PHP by the PHP Foundation and other contributors. PHP Roundup is prepared by Ayesh Karunaratne from PHP.Watch, a source for PHP news and articles on upcoming changes.
In this series, we highlight some of the interesting and major improvements made to the PHP language. Traditionally, the PHP team releases a new minor version of the interpreter towards the end of each year, but the changes and improvements are discussed and implemented throughout the year.
You donโt necessarily have to be a PHP Foundation backer to follow the PHP Roundup. Weโll be publishing the posts on our website, and you can subscribe to a newsletter:
The PHP Foundation currently supports six part-time PHP contributors who work on both maintenance and new features for PHP. Maintenance is not limited to fixing bugs, but also includes work to reduce technical debt, making life easier for everyone working on PHP. The contributors funded by the PHP Foundation collaborate with other contributors on code, documentation, and discussions.
Things marked with ๐ are done by the PHP Foundation team.
Letโs get straight to the updates.
Every major change to PHP is discussed and implemented with the consensus of the PHP community. Each RFC proposes a set of changes, and the PHP Internals community holds a vote that lasts two weeks by default.
Accepted: Allow null and false as stand-alone types ๐
RFC by Gina Peter Banyard was accepted unanimously with all 38 votes in favor and is now merged into PHP.
Prior to this change, null
and false
could only be used as part of a Union Type, but not as stand-alone types. This change further improves PHPโs type system to be more expressive and defensive. See the true
type RFC below that proposes adding true
as a type too.
Learn more about this RFC from the PHP Internals News podcast hosted by Derick Rethans.
Implemented: Redacting parameters in back traces
RFC by Tim Dรผsterhus, approved with 24:1 votes in favor, is now implemented in PHP core.
This RFC proposed adding a #[SensitiveParameter]
attribute that redacts the parameter's actual value when it is spewed out in stack traces and var_dump
output. The attribute can be used to prevent leaking sensitive information in debugging logs.
Learn more about this RFC from the PHP Internals News podcast hosted by Derick Rethans.
Discussion: Add true type ๐
RFC by Gina Peter Banyard is currently under discussion, to add true as a type to PHP. In PHP 8.0 Union Types, we added false
as one of the possible members of Union Types, but left out true
. This RFC proposes to complete it by adding true
as a type as well.
Accepted: Undefined Variable Error Promotion
RFC by Mark Randall accepted with 33:8 votes in favor.
This proposes to convert the current behavior of PHP raising a warning for accessing an undefined variable (PHP 8.0+) to throw an Error exception instead in PHP 9.0.
Voting: Undefined Property Error Promotion
Another RFC by Mark Randall proposes to throw an error on undefined class property access, similar to the now accepted changes with undefined variables. Notably, PHP 8.2 already emits deprecation notices on dynamic property creation (with a few exceptions).
Voting: Readonly classes ๐
RFC by Mรกtรฉ Kocsis proposes to add support for readonly classes. In such a class, all properties are readonly
and dynamic properties are forbidden. Voting is scheduled to start on April 27th.
Accepted: Deprecate ${} string interpolation ๐
RFC by Ilija Tovilo accepted with 31:1 votes in favor.
This RFC proposes to deprecate "${foo}"
and "${(foo)}
" string interpolation patterns. It does not deprecate the standard "{$foo}
" pattern.
Accepted: Deprecate and Remove utf8_encode and utf8_decode
Learn more about this RFC from the PHP Internals News podcast hosted by Derick Rethans.
Some of the minor changes made to PHP are first made as a pull request to the PHP GitHub project, and if deemed acceptable by PHP core maintainers, they are merged without going through a formal RFC process. We have automatic tests in place to flag PRs that break existing functionality. The majority of the minor changes from the community are made through PRs.
Apart from the highlighted changes above, there have been more improvements and fixes from @divinity76, Marco Pivetta, Arnaud Le Blanc, Alex Dowad, and more.
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.
A big thanks to all our sponsors โ PHP Foundation is all of us!
A special mention goes to mailcoach.app for providing us with a platform for the newsletter.
Follow us on Twitter @ThePHPF to get the latest updates from the Foundation.
๐๏ธ ๐
PHP Roundup is prepared by Ayesh Karunaratne from PHP.Watch, a source for PHP News, Articles, Upcoming Changes, and more.