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.
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 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.
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.
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.
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.
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.
posix_getrlimit
in c3b9b0f9a7 by Ilija Tovilo 💜php_mt_rand_range()
with MT_RAND_PHP
in GH-9839 by Tim Düsterhusexpose_php
with parent in e4a1b80a5f by Dominic Hsocket_atmark
support in 4c4e72f149 by David CARLIERzend_call_known_function()
in ext-pgsql
instead of building FCI/FCC in 4f8d10791b by Gina Peter Banyard 💜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 Nachtzend_closure_internal_handler
in 8dabbda8bc by Florian Sowadeshm*()
functions in GH-9872 by Christoph M. Beckerpdeathsig
test on 32-bit GitHub actions in 1fb40b501d by Ilija Tovilo 💜ext/posix
in GH-9886 by Christoph M. Beckercopy_file_range
in 5d7b64be1d by Bob Weinandobserver_declared_function_notify
until after pass_two()
in 6bd8f40291 by Bob Weinandconstant()
behaves inconsistent when class is undefined in GH-9907 by Christoph M. Beckermodule_entry
after DL_UNLOAD()
when module already loaded in 0bfdd5691c by Bob Weinandmime_magic
extension in 5aa13183ae by Christoph M. Beckerfile_cache
for observer preloading test in 09f071e63b by Ilija Tovilo 💜SIGINFO
constant in pcntl for system supporting it in e0e347b4a8 by David CarlierTEST_FPM_EXTENSION_DIR
for FPM tests with shared extensions in db2d32f476 by Jakub Zelenka 💜unserialize()
notices to warning in GH-9629 by Tim Düsterhuszend_result
return type instead of innacurate ones in dbf54e1a8b by Gina Peter Banyard 💜disk_free_space()
test in bab9e349cb by Gina Peter Banyard 💜shadow_stack_exists
in 05f4b84940 by Dmitry Stogovftok(3)
emulation in GH-9958 by Christoph M. Becker__atomic_test_and_set()
instead of __sync_test_and_set()
for lsapi in GH-7997 by Andy Postnikov__atomic_xxxx()
instead of __sync_xxxx()
for lsapi in 4bdfce6c1a by George WangClosure::call()
and natively in 45cb3f917a by Dmitry StogovSplFileObject::__toString()
reads next line in GH-9912 by Gina Peter Banyard 💜php.ini-*
regarding the required order for GH-8620 in 9416186ff1 by Jakub Zelenka 💜no-dsa
in 500b28ad04 by Jakub Zelenka 💜CONST_CS
in GH-9685 by Jorg Adam SowaAt 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.