PHP Core Roundup #8

Published on by

Welcome to the eighth issue of PHP Core Roundup series! This issue was supposed to bring the great news of PHP 8.2 release, but the PHP 8.2 release date was pushed to December 8, and yet this issue is still full of exciting new updates about whatโ€™s being discussed and improved in PHP.

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.


We publish the posts on our website, and you can subscribe to a newsletter; You donโ€™t necessarily have to be a PHP Foundation backer to follow PHP Core Roundup.

Subscribe to PHP Core Roundup newsletter
We care about your data. Read our privacy policy.

The PHP Foundation: Impact and Transparency Report 2022

Roman Pronskiy wrote a detailed post on PHP Foundationโ€™s impact, timeline, a summary of contributions made to PHP by PHP Foundation team, governance, financials, and more on The PHP Foundation: Impact and Transparency Report 2022.

PHP 8.2 to be released on December 8

PHP 8.2 was scheduled to be released on 24th of November. However, because it falls on the US thanksgiving holiday, and to take some time to fix some bugs reported recently, PHP 8.2โ€™s release managers decided to postpone the PHP 8.2 GA release to 8th of December.

All PHP 7 versions are now End-of-Life

PHP 7.4 is the last version in the PHP 7.4 series, and it reached its end of life on November 28th. This means that there will be no more bugs or security fixes. If you are running any PHP applications on PHP 7 make sure to upgrade to PHP 8, or to obtain Long-term support from a vendor. PHP 7 still holds (based on Packagist.org and WordPress.org data) the major usage share, so this is alarming.

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 Implemented: Improve unserialize() error handling

    RFC by Tim Dรผsterhus, also mentioned in PHP Core Roundup Issue #7, is now implemented in PHP 8.3. This includes improving error handling of the unserialize() function by increasing the error level from E_NOTICE to E_WARNING.

    More information on PHP.Watch: unserialize(): Upgrade E_NOTICE errors to E_WARNING.

  • RFC Declined: Destructuring Coalesce

    Bob Weinand proposed to allow coalescing in array destructing with [$a ?? $b] = $array;, where $a is assigned $b if the key in the array is null or missing. This RFC vote did not reach the required โ…” majority, and was declined.

  • RFC Under Discussion: More Appropriate Date/Time Exceptions ๐Ÿ’œ

    RFC by Derick Rethans, proposes 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.

    Vincent Langlet also started a related mailing list discussion about a week prior to this RFC.

  • RFC Under Discussion: Readonly amendments ๐Ÿ’œ

    RFC by Nicolas Grekas and Mรกtรฉ Kocsis, attempts to address 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):

    readonly class A {}
    class B extends A {} // Currently this produces a Fatal error
    


    ... and to allow reinitializing readonly properties during cloning (within the __clone() magic method):

    class Foo {
        public function __construct(
            public readonly DateTime $bar,
            public readonly DateTime $baz
        ) {}
    
        public function __clone()
        {
            $this->bar = clone $this->bar; // Works
            $this->cloneBaz();
        }
    
        public function cloneBaz()
        {
            $this->baz = clone $this->baz; // Also works
        }
    }
    
    $foo = new Foo(new DateTime(), new DateTime());
    $foo2 = clone $foo;
    
    // No error, Foo::$bar and Foo::$baz are cloned deeply
    


  • RFC Accepted: Randomizer Additions

    RFC by Joshua Rรผsweg and Tim Dรผsterhus, proposes 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 proposes to add two new methods: getBytesFromString, to generate a random string containing specific characters, and getFloat/nextFloat, to generate a random floating point value. The vote was accepted, and is pending implementation.

  • RFC Under Discussion: Arbitrary static variable initializers ๐Ÿ’œ

    RFC by Ilija Tovilo, proposing a series of changes and improvements to static variables in PHP.

    The RFC suggests static variable initializers to contain arbitrary expressions. Currently, static variables can only be initialized with constant expressions:

    function foo() {
        static $p = 16; // Allowed
        static $p = getValue(); // Not allowed, proposed to allow
    }
    


    Further, it also proposes to disallow redeclaring static variables (in the scope of the same function) at compile-time with a fatal error, along with some changes in the Reflection API to account for the changes.

Notable Mailing List Discussions

Merged PRs and Commits

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.

  • Fix stub type info for posix_getrlimit in c3b9b0f9a7 by Ilija Tovilo ๐Ÿ’œ
  • Fix pre-PHP 8.2 compatibility for php_mt_rand_range() with MT_RAND_PHP in GH-9839 by Tim Dรผsterhus
  • Fix GH-9754: SaltStack hangs when running php-fpm 8.1.11 in 1c5844aa3e by Jakub Zelenka ๐Ÿ’œ
  • Do not display the value of UNKNOWN constants in the manual in GH-9843 by Mรกtรฉ Kocsis ๐Ÿ’œ
  • Match FPM status pool's expose_php with parent in e4a1b80a5f by Dominic H
  • Fix GH-9770: Add small timeout in status-listen test in 8229649045 by Jakub Zelenka ๐Ÿ’œ
  • Fix memory leak in 482ae71fda by Dmitry Stogov
  • socket add socket_atmark support in 4c4e72f149 by David CARLIER
  • Use zend_call_known_function() in ext-pgsql instead of building FCI/FCC in 4f8d10791b by Gina Peter Banyard ๐Ÿ’œ
  • Use zend_call_known_function() in ext-mysqli instead of building FCI/FCC in c0f2727e55 by Gina Peter Banyard ๐Ÿ’œ
  • labeler.yml: set top-level read-only permissions in GH-9862 by Pedro Nacht
  • Timelib: Updated to version 2022.6 (2022f) in 2b5bed904e by Derick Rethans ๐Ÿ’œ
  • Donโ€™t reset func in zend_closure_internal_handler in 8dabbda8bc by Florian Sowade
  • Tidy up buffer preparation in mysqlnd in GH-9834 by Kamil Tekiela
  • Fix GH-9829: Bug in refactoring Windows shmat() function in GH-9873 by Christoph M. Becker
  • Fix potential NULL pointer dereference Windows shm*() functions in GH-9872 by Christoph M. Becker
  • Fix observing inherited internal functions in b30448f48f by Bob Weinand
  • Store a reference to closures in the FCC in 7c45b95894 by Gina Peter Banyard ๐Ÿ’œ
  • Add various APIs to handle FCC structures in de4cfff5f6 by Gina Peter Banyard ๐Ÿ’œ
  • Refactor SPL Callback filter to only use FCC in 8d5d3fd035 by Gina Peter Banyard ๐Ÿ’œ
  • Only use FCC for SQLite3 user defined functions/collations/authorizer in 29bb426933, 37aea43eed, and d105958603 by Gina Peter Banyard ๐Ÿ’œ
  • Only use FCC for libxml entity loader callback in fb114bf45b by Gina Peter Banyard ๐Ÿ’œ
  • Fix hardcoded paths in test in 4935e10fc8 by Bob Weinand
  • Delay releasing closures until after observer end in 8e49d7f32f by Bob Weinand
  • Properly deal with internal attributes used on promoted properties in GH-9661 by Martin Schrรถder
  • Fix fake closure leaking when called from internal func in GH-9884 by Ilija Tovilo ๐Ÿ’œ
  • Migrate i386 to GitHub actions in GH-9856 by Ilija Tovilo ๐Ÿ’œ
  • Fix duplicate SKIPIF section in d2c663441d by Ilija Tovilo ๐Ÿ’œ
  • Fix ext section in bca1e1f557 by Ilija Tovilo ๐Ÿ’œ
  • Disable CLI server pdeathsig test on 32-bit GitHub actions in 1fb40b501d by Ilija Tovilo ๐Ÿ’œ
  • Fix generator memory leaks when interrupted during argument evaluation in GH-9756 by Arnaud Le Blanc ๐Ÿ’œ
  • Fix memory leak in f31f464cec by Dmitry Stogov
  • Don't check "fake" closures (fix assertion) in 05b63b1593 by Dmitry Stogov
  • Fiber: add shadow stack support in GH-9283 by Chen, Hu
  • Don't skip test on Windows due to missing ext/posix in GH-9886 by Christoph M. Becker
  • Fix cross-compilation for copy_file_range in 5d7b64be1d by Bob Weinand
  • Move observer_declared_function_notify until after pass_two() in 6bd8f40291 by Bob Weinand
  • Fix GH-9905: constant() behaves inconsistent when class is undefined in GH-9907 by Christoph M. Becker
  • Do not report MINIT stage internal class aliases in extensions in 182314c317 by Bob Weinand
  • Fix opcache preload with observers enabled in 4052bbf0e3 by Bob Weinand
  • Fix crash reading module_entry after DL_UNLOAD() when module already loaded in 0bfdd5691c by Bob Weinand
  • Make the usage of the role attribute more clear in GH-9901 by Mรกtรฉ Kocsis ๐Ÿ’œ
  • No more need to cater to mime_magic extension in 5aa13183ae by Christoph M. Becker
  • Disable opcache file_cache for observer preloading test in 09f071e63b by Ilija Tovilo ๐Ÿ’œ
  • Remove unused PHP 8.1 BC layer in JIT in GH-9937 by Ilija Tovilo ๐Ÿ’œ
  • Skip tests if extension or SAPI is not included. in GH-9939 by dwo0
  • Fix GH-9923: Add the SIGINFO constant in pcntl for system supporting it in e0e347b4a8 by David Carlier
  • Fix GH-9298: remove all registered signal handlers in pcntl RSHUTDOWN in 5ecbb1b39d by Erki Aring
  • Fix GH-9535 (unintended behavior change for mb_strcut in PHP 8.1) in fa0401b0b5 by NathanFreeman
  • Introduce TEST_FPM_EXTENSION_DIR for FPM tests with shared extensions in db2d32f476 by Jakub Zelenka ๐Ÿ’œ
  • Fix memory leak in a8bd342397 by Dmitry Stogov
  • Fix regression test for GH-9535 on PHP-8.2+ in d3933e0b6c by Alex Dowad
  • Fix GH-9890: OpenSSL legacy providers not available on Windows in GH-9894 by Christoph M. Becker
  • Fix GH-9932: Discards further characters for session name in GH-9940 by David Carlier
  • Escape the role attribute of namespaced classes in GH-9952 by Mรกtรฉ Kocsis ๐Ÿ’œ
  • Cache UTF-8-validity status of strings in GC flags in d0d834429f by Alex Dowad
  • Promote unserialize() notices to warning in GH-9629 by Tim Dรผsterhus
  • Remove code for OS2 in 726d595ec7 by Gina Peter Banyard ๐Ÿ’œ
  • Use zend_result return type instead of innacurate ones in dbf54e1a8b by Gina Peter Banyard ๐Ÿ’œ
  • Change conditional check in disk_free_space() test in bab9e349cb by Gina Peter Banyard ๐Ÿ’œ
  • Add WordPress to community build in GH-9942 by Ilija Tovilo ๐Ÿ’œ
  • Fix caching of default params with side-effects in GH-9935 by Ilija Tovilo ๐Ÿ’œ
  • Fix cross-compilation for shadow_stack_exists in 05f4b84940 by Dmitry Stogov
  • Fix GH-9650: Can't initialize heap: [0x000001e7] in GH-9721 by Michael Voล™รญลกek
  • Improvements in modifier parsing in GH-9926 by Ilija Tovilo ๐Ÿ’œ
  • Use fast text conversion filters to implement mb_convert_variables in b1954f5fd6 by Alex Dowad
  • Avoid undefined behavior in Windows ftok(3) emulation in GH-9958 by Christoph M. Becker
  • Use __atomic_test_and_set() instead of __sync_test_and_set() for lsapi in GH-7997 by Andy Postnikov
  • opcache fixing w/x pages creation on freebsd 13.1 and above in GH-9896 by David CARLIER
  • Use __atomic_xxxx() instead of __sync_xxxx() for lsapi in 4bdfce6c1a by George Wang
  • For UTF-7, flag unnecessary extra trailing byte in Base64 section as error in a618682373 by Alex Dowad
  • Fix a memory leak in tracig JIT when the same closure is called through Closure::call() and natively in 45cb3f917a by Dmitry Stogov
  • Fix GH-9883: SplFileObject::__toString() reads next line in GH-9912 by Gina Peter Banyard ๐Ÿ’œ
  • Fix performance degradation introduced in c2547ab7 in GH-9876 by Gina Peter Banyard ๐Ÿ’œ
  • Fix mangled kana output for JIS encoding in 8f84192403 by Alex Dowad
  • Handle trampolines correctly in new FCC API + usages in GH-9877 by Gina Peter Banyard ๐Ÿ’œ
  • php-fpm: fix Solaris port events.mechanism in GH-9959 by Petr Sumbera
  • Fix bug #68207: Setting fastcgi.error_header can result in a WARNING in 5a4520bc2b by Jakub Zelenka ๐Ÿ’œ
  • Fix bug #80669: FPM numeric user fails to set groups in 94702c56e0 by Jakub Zelenka ๐Ÿ’œ
  • Fix GH-8517: FPM child pointer can be potentially uninitialized in c9c1934ff0 by Jakub Zelenka ๐Ÿ’œ
  • Add a note to php.ini-* regarding the required order for GH-8620 in 9416186ff1 by Jakub Zelenka ๐Ÿ’œ
  • Fix GH-9997: OpenSSL engine clean up segfault in 3d90a24e93 by Jakub Zelenka ๐Ÿ’œ
  • Fix GH-9064: PHP fails to build if openssl was built with no-ec in ce57221376 by Jakub Zelenka ๐Ÿ’œ
  • Do not resolve constants on non-linked class during preloading in GH-9975 by Arnaud Le Blanc ๐Ÿ’œ
  • Fix GH-10000: Test failures when OpenSSL compiled with no-dsa in 500b28ad04 by Jakub Zelenka ๐Ÿ’œ
  • Simplify decoding filter for UTF-8 in 0109aa62ec by Alex Dowad
  • Add a proper error message for ffi load in GH-9913 by Thomas PIRAS
  • Remove unnecessary usage of CONST_CS in GH-9685 by Jorg Adam Sowa

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.

๐Ÿ’œ๏ธ ๐Ÿ˜

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