PHP Core Roundup #2

Published on May 30, 2022 by Ayesh Karunaratne

Welcome back to round #2 of PHP Core Roundup, where we’ll make regular updates on the improvements made to PHP by the PHP Foundation and other contributors. In this second one in the series, we have news about the upcoming PHP 8.2 release, some new RFCs accepted, voted, and being discussed, and some further improvements to PHP made in the past few weeks.

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:

Subscribe to PHP Foundation Updates

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.

PHP 8.2 Release Managers

For each major version of PHP (such as PHP 7.4, 8.0, 8.1, and 8.2), PHP core developers vote and elect one or two release managers along with a veteran PHP core developer who has been a release manager before.

PHP Release managers are responsible for tagging and creating PHP releases throughout the lifecycle of that PHP version, including the alpha/beta/RC releases, and security releases as well as regular patch versions. Lasting for about three and half years, the release managers have the final say last-minute RFCs as well.

For the upcoming PHP 8.2, we had 7 candidates, with Ben Ramsey, one of the PHP 8.1 release managers stepping in as the veteran release manager. After a poll that ended on May 18, Sergey Panteleev and Pierrick Charron were elected as rookie release managers.

Congratulations Sergey, Pierrick, and Ben on being PHP 8.2 release managers!

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.

Things marked with πŸ’œ are done by the PHP Foundation team.

  • Implemented: Deprecate ${} string interpolation πŸ’œ

    RFC by Ilija Tovilo was accepted with 31:1 votes in favor, and is now implemented in PHP core. This RFC proposes to deprecate string interpolation with ${var} and ${expr} patterns with {$var} and {${expr}} patterns.

    On top 1,000 most downloaded packages as per Packagist data, over 40 packages contained at least one occurrence of this now-deprecated pattern. Fixes are being made to the libraries, you can help out by testing your libraries and submitting pull-requests to the relevant repositories.

    This RFC is likely to be followed up with another RFC vote to decide whether the deprecated string interpolation patterns should throw an error, or silently ignored in PHP 9.0

    Learn more about this RFC on PHP.Watch.

  • Implemented: Readonly Classes πŸ’œ

    MΓ‘tΓ© Kocsis follows up PHP 8.1 readonly properties feature with support for marking the entire class as readonly in this new RFC. In PHP 8.2, all properties (must be typed) of the class will be implicitly readonly if the class is declared as readonly.

    Learn more about this RFC on PHP.Watch.

  • Accepted: MySQLi Execute Query

    RFC by Kamil Tekiela and Craig Francis was accepted unanimously with 24 votes. This RFC proposes to add a new mysqli_execute_query function to the MySQLi extension that greatly simplifies the multiple function calls it required to prepare, bind parameters, execute, and retrieve data with mysqli_prepare/execute/stement_get_result functions.

    Learn more about this RFC on PHP.Watch.

  • Accepted: Undefined Property Error Promotion

    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).

  • Under Discussion: Expand deprecation notice scope for partially supported callables

    Juliette Reinders Folmer follows up on the Deprecate partially supported callables RFC (implemented in PHP 8.2) to widen the scope of the deprecation to include is_callable function and when type verification is executed on the callable type.

    Learn more about this RFC on PHP Internals News Podcast hosted by Derick Rethans.

  • Under Discussion: Stricter implicit boolean coercions

    RFC by Andreas Leathley is currently under discussion, which discovers ways how various types are coerced with boolean values. A lengthy discussion is underway.

  • Under Discussion: Fetching properties in constant expressions πŸ’œ

    RFC by Ilija Tovilo proposes adding support for fetching properties in constant expressions using the -> operator. This will make it possible to fetch the name and value of enums in constant expressions.

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: Curl extension support for CURLOPT_MAXFILESIZE_LARGE and CURLOPT_XFERINFOFUNCTION options in PR #7823 and #8557 by David Carlier.
  • New: Add ReflectionMethod::hasPrototype() in PR #8487 by Ollie Read.
  • New: Add ReflectionFunction::isAnonymous() in PR #8499 by Nicolas Grekas.
  • New: Socket extension support for TCP_NOTSENT_LOWAT and SO_MEMINFO options in PR #8559 and commit 2410e378 by David Carlier.
  • New: idate() now accepts format specifiers "N" (ISO Day-of-Week) and "o" (ISO Year) in commit 12702a20 by Pavel Djundik.
  • Improved: Tidy extension’s tidy class properties are now typed, and tidyNode properties are declared readonly. PR #8515 by MΓ‘tΓ© Kocsis πŸ’œ.
  • Improved: It is now possible to declare constants in stubs. This change will make it easier to keep the manual always up-to-date as well as static analyzers to get type information about constants. PR #7434 by MΓ‘tΓ© Kocsis πŸ’œ.
  • Changed: Build ext/zip as shared library by default on Windows in PR #8549 by Christoph M. Becker.
  • Fixed: Bug #8548 stream_wrapper_unregister() memory leak in PR #8587 by Ilija Tovilo πŸ’œ.
  • Fixed: ini_get() could be optimized-out by the optimizer in PR #8507 by Arnaud Le Blanc πŸ’œ.
  • Fixed: Crash while unregistering dl()’-ed extension in ZTS in PR #8435 by Arnaud Le Blanc πŸ’œ.
  • Fixed: Add JIT guards for INIT_METHOD_CALL when the method may be modified PR #8600 by Arnaud Le Blanc πŸ’œ.
  • Fixed: Datetime format string to follow POSIX spec in ftp_mdtm in PR #8259 by Jihwan Kim.
  • Fixed: parse_url() can not recognize port without scheme in PR #7844 by @pandaLIU.
  • Fixed bug #72185: php-fpm writes empty fcgi record causing nginx 502 by Jakub Zelenka and @loveharmful πŸ’œ.
  • Fixed: Bug #79589: ssl3_read_n:unexpected eof while reading by Jakub Zelenka πŸ’œ.
  • Fixed: Memory leak in Enum::from/tryFrom when type coercion occurs in internal enums in PR #8633 by Ilija Tovilo πŸ’œ.
  • Improved: Add internal C API for fetching backed enums by value in PR #8518 by Ilija Tovilo
  • Fixed: Several bug fixes in Date extension by Derick Rethans πŸ’œ.
    • Bug #51987 DateTime fails to parse an ISO 8601 ordinal date (extended format) in PR #8589.
    • DateInterval::createFromDateString does not throw if non-relative items are present in PR #8458.
    • Bug #72963 Null-byte injection in DateTime::createFromFormat and related functions.
    • Bug #GH-8471 Segmentation fault when converting immutable and mutable DateTime instances created using reflection in PR #8497.
    • Bug #68549 Timezones and offsets are not properly used when working with dates in PR #8589.
    • Updated to timelib 2021.12 in PR #8589 by Derick Rethans πŸ’œ. Also fixes bug #51934, GH-7758, #68549, #66019, and #81565.
    • Bug #52015 Allow including end date in DatePeriod iterations in PR #8550.
    • DatePeriod properties are also going to be properly declared as readonly soon (PR #8534).
    • Bug #74671 DST timezone abbreviation has incorrect offset in PR #8595.
    • Bug #78139 timezone_open accepts invalid timezone string argument in PR #8595.

Apart from the highlighted changes above, there have been more improvements and fixes from Alex Dowad, Nikita Popov, Dmitry Stogov, and more contributors.

Mailing List Discussions

Other News

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.

πŸ’œοΈ 🐘

PHP Roundup is prepared by Ayesh Karunaratne from PHP.Watch, a source for PHP News, Articles, Upcoming Changes, and more.