Open Collective
Open Collective
Loading
PHP Core Roundup #9
Published on February 2, 2023 by Roman Pronskiy


The first for the year 2023, and the ninth in the series, this episode of PHP Core Roundup is full of exciting new developments in PHP and about PHP 8.2, the latest PHP version released last month! January was a busy month with many RFC proposals, discussions, votes, and some that are already included for the upcoming PHP 8.3 version that is scheduled for November 2023.

The PHP Foundation currently supports six part-time PHP contributors who work on 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.

PHP 8.2 Released


PHP 8.2 is here! With type-system improvements, `readonly` classes, sensitive parameter redaction support, a new "random" extension, and several new features and improvements, PHP 8.2.0 was released on December 08th, followed by a security-fix release 8.2.1 on January 05th.

Over 110 people, along with our six PHP Foundation members, helped shape PHP 8.2.
Thank you for your amazing efforts 🙏🏼💜.

PHP 8.2 Release Announcement on php.net contains a summary of what’s new and changed in PHP 8.2. Detailed lists and guides are also available on PHP.Watch: PHP 8.2 and Stitcher.io.

PHP 8.3 RFCs and Discussions


Discussions and proposals for new features and changes for the upcoming PHP version 8.3 were being made even before PHP 8.2.0 was released. January was a particularly eventful month with several proposals and discussions, including a few that went to a vote, and a few that are now implemented in the PHP master branch.

Most of the proposed improvements are in improving existing PHP functionality, especially the new readonly properties/class and the random extension. There were also discussions and proposals about adding a new syntax similar to Swift to declare granular get/set access to properties, passing the calling scope to class magic methods, and more.

Additionally, the Deprecations for PHP 8.3 RFC is also being drafted and discussed on features that the community proposes to deprecate in PHP 8.3 and remove in PHP 9.0.

Recent RFCs, Merged PRs, Discussions, and Commits


Changes and improvements to PHP are discussed, reported, and voted on by the PHP Foundation Team, the PHP development team, and contributors. Bug reports are made to the PHP issue tracker, changes are discussed in mailing lists, minor code changes are proposed as pull requests, and major changes are discussed in detail and voted on as PHP RFCs. Documentation and the php.net website changes are also discussed and improved at their relevant Git repositories on GitHub.

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, and implemented since our last update.
  • RFC In Voting: Readonly amendments 💜
    RFC by Nicolas Grekas and Máté Kocsis, attempts to address some of the shortcomings of PHP 8.1 readonly properties and 8.2 readonly classes.
    This RFC proposes allowing readonly classes to be extended by non-readonly classes (currently not allowed, and causes a fatal error), and to allow reinitializing readonly properties during cloning (within the __clone() magic method).

  • RFC Accepted: More Appropriate Date/Time Exceptions 💜
    RFC by Derick Rethans, proposed to introduce Date/Time extension-specific exceptions and errors. This detailed RFC suggests more specificity in the exceptions with exception classes such as DateInvalidTimeZoneException, and DateMalformedPeriodStringException, as well as promoting some of the current PHP warnings to Error exceptions.

    The vote was accepted, and the pull-request is nearly ready to be merged.

  • RFC Implemented: Randomizer Additions
    RFC by Joshua Rüsweg and Tim Düsterhus, proposed to add new “building block” methods to \Random\Randomizer (added in PHP 8.2) that implement commonly useful operations that are either verbose or very hard to implement in userland.

    The RFC proposed to add two new methods: getBytesFromString(), to generate a random string containing specific characters, and getFloat()/nextFloat(), to generate a random floating point value.

  • RFC Under Discussion: Pass Scope to Magic Accessors 💜
    RFC by Nicolas Grekas and Ilija Tovilo, proposing to pass the calling scope to magic accessors to make it trivial to get it. While it is currently possible to retrieve the calling scope by retrieving the backtrace, the RFC proposes to pass the calling scope as the last argument to the magic methods, making it easier compared to fiddling with the debug backtrace.

  • RFC Under Discussion: Path to Saner Increment/Decrement operators 💜
    PHP's increment and decrement operators can have some surprising behaviours when used with types other than int and float. Various previous attempts (1, 2, 3) have been made to improve the behaviour of these operators, but none have been implemented.

    The goal of this RFC by George Peter Banyard is to normalize the behaviour of $v++ and $v-- to be the same as $v += 1 and $v -= 1, respectively.

  • RFC Under Discussion: Saner array_(sum|product)() 💜
    RFC by George Peter Banyard suggests improvements to the existing array_sum() and array_product() functions by emitting a warning when the arrays being summed/multiplied contain invalid types. This can introduce backwards-incompatible effects (apart from the warning) on code that relies on the current behavior of the functions.

  • RFC Under Discussion: Add SameSite cookie attribute parameter 💜
    RFC by George Peter Banyard proposes adding support for SameSite cookies as a function parameter to setcookie, setrawcookie, and session_set_cookie_params functions. While PHP 7.3 and later supports SameSite cookies when the cookie options are passed as an array, this RFC proposes to add a new parameter that accepts a SameSite enum value. The proposed SameSite enum contains Strict, Lax, and None members, which are the only accepted values.

  • RFC Under Discussion: Add file_descriptor() function 💜
    RFC by George Peter Banyard proposes a new file_descriptor() function that returns the integer file descriptor of a given stream, if the underlying file system supports it.

  • RFC Declined: Asymmetric Visibility 💜
    PHP’s property visibility modifiers (public, protected, and private) apply to both get and set operations. This RFC by Ilija Tovilo and Larry Garfield proposed a new syntax inspired by Swift to asymmetrically declare the visibility modifiers individually for get and set operations: 

  • class Foo
    {
        public private(set) string $bar;
    }
  • In the snippet above, public private(set)indicates that get operations are public, while set operations are private.

    However, the vote held for this RFC did not pass. A lengthy mailing list discussion on this RFC is available here.


Notable Mailing List Discussions


Merged PRs and Commits

  • Alex Dowad continued with his series of improvements in mbstring extension optimizations. PHP 8.2 received several impactful performance improvements in mbstring extension too.
  • Tim Düsterhus made several improvements and fixes to the new "random" extension.
  • Max Kellermann made several improvements in making several pointers const, along with a new RFC to clean up PHP source's header include calls.
Following are some changes that did not go through an RFC process because they are either planned, bug fixes, or progressive enhancements. There are automated unit and integration tests for each of these changes, the PHP core developers review all pull requests.

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!
Follow us on Twitter @ThePHPF to get the latest updates from the Foundation.

💜️ 🐘
🎉  2🚀  1