PHP Roundup #1
Published on April 28, 2022 by Roman Pronskiy
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 there.
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.
RFC 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 George 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 George 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.
- 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.
Merged PRs and Commits
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.
- New: Introduce CURLOPT_XFERINFOFUNCTION by David CARLIER.
- Fixed: Constants in Enum classes causes php-fpm worker to segfault by Ilija Tovilo. 💜
- Fixed: SplFileObject: key() returns wrong value by George Peter Banyard. 💜
- Fixed: Bug #76003 FPM /status reports wrong number of active processes by Jakub Zelenka 💜
- Fixed: Bug #77023 PHP-FPM cannot shutdown processes by Jakub Zelenka 💜
- Reviewed and merged various fixes and improvements to FPM by Jakub Zelenka: 💜
- Emitting error for invalid listen port (implemented by David Carlier)
- SELinux dumpable (implemented by David Carlier)
- Clang warning in socket cleanup (implemented by David Carlier)
- Listening queue MacOS support (implemented by David Carlier)
- New default for listen backlog on Linux (implemented by Cristian Rodríguez)
- Kqueue typo in remove callback type (implemented by David Carlier)
- Fixed: Various (1, 2, 3) bugs related to DateTime support, as well as reimplementing serialization support for all classes, by Derick Rethans 💜
- Improved: Migrated most of the CI setup from Azure Pipelines to GitHub Actions by Ilija Tovilo 💜
- Fixed: Registry settings are no longer recognized by Christoph M. Becker, reported by Vladimir S.
- Several engine improvements by Dmitry Stogov and Nikita Popov.
Apart from the highlighted changes above, there have been more improvements and fixes from @divinity76, Marco Pivetta, Arnaud Le Blanc, Alex Dowad, and more.
Mailing List Discussions
- Canonicalize "iterable" into "array|Traversable" and Reflection, started by George Peter Banyard. 💜
- MySQLi Execute Query RFC, started by Craig Francis.
- NULL Coercion Consistency, also started by Craig Francis.
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.
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 and let us know what you think about the PHP Roundup.
💜️ 🐘
PHP Roundup is prepared by Ayesh Karunaratne from PHP.Watch, a source for PHP News, Articles, Upcoming Changes, and more.
👀 1👍️ 4