There have been numerous updates and enhancements to the PHP core over the past month, from thought-provoking RFCs to minor yet profound adjustments. Let's dive in and keep up with the most recent PHP developments.
The PHP Foundation is a collective of PHP contributors, veterans, and companies that collaborate to ensure the long-term sustainability of the PHP programming language. The foundation currently supports six contributors focused on PHP's maintenance, debt reduction, and feature development. These contributors work closely with others on coding, documentation, and discussions.
Started over a year ago, the PHP Core Roundup series offers a summary of the latest developments, discussions, and news about PHP Core, contributed by both PHP Foundation members and other participants. This post is the thirteenth in the PHP Core Roundup series.
On June 8, PHP turned 28 years old! For a throwback, see Rasmus Lerdorf’s initial public announcement of PHP.
Here’s to many more years of empowering developers and pushing the boundaries of web technology. Happy Birthday, PHP! 🎉🥳🎂
The upcoming PHP 8.3 version is scheduled to be released on November 23. The newly elected PHP 8.3 release managers made the first QA releases of PHP 8.3 — PHP 8.3.0 Alpha 1 — on June 08, and the second alpha release on June 22.
These alpha versions aren't intended for production environments but are provided for testing and local development.
Compiled Windows binaries are available at windows.php.net/qa, Docker images are available at Docker Hub. For macOS, PHP 8.3.0-dev packages are available via Homebrew from shivammathur/php
tap.
If you want to compile the source code yourself, you can find it on php/php-src repository on GitHub.
July 18 marks the feature-freeze for PHP 8.3. It means that all major changes to the language must be discussed and voted on prior to this date in order to make it to PHP 8.3.
The PHP development team released three new versions in June 2023:
PHP 8.2.7, PHP 8.1.20, PHP 8.0.29
All three include a security fix: GHSA-76gg-c692-v2mw. The random byte generation function used in the SOAP HTTP Digest authentication code was not checked for failure. This could result in a stack information leak.
PHP 8.2.7 and PHP 8.1.20 additionally include several bug fixes and improvements, notably in areas such as Core, Date, Exif, FPM, Hash, LibXML, MBString, Opcache, PCNTL, PGSQL, Phar, Soap, SPL, Standard, and Streams.
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 on, and implemented since our last update.
PHP 8.3 will have a new attribute #[\Override]
. If this attribute is added to a method, the engine will validate that a method with the same name exists in a parent class or any of the implemented interfaces. If no such method exists, a compile time error will be emitted.
The similar concepts exist in Java, TypeScript, C++, C#, Swift, Kotlin, and other languages.
In the forthcoming PHP 8.3 release, the range()
function will have improved behavior. It will now issue warnings or throw exceptions if it receives incompatible or unusable arguments.
PHP 8.3 will include a new function that works similarly to the existing str_pad()
function, but with support for multibyte strings. This is a welcome addition for developers working with multibyte strings, as it will make it easier to manipulate and format these strings in PHP.
The aim is to clean up some of the older, less consistent parts of PHP to make the language more reliable and predictable. The following list provides a short overview of the functionality targeted for deprecation:
$widths
to mb_strimwidth()
NumberFormatter::TYPE_CURRENCY
constantcrypt()
related constantsMT_RAND_PHP
This RFC proposes to deprecate a number of functions that have overloaded signatures, meaning they behave differently based on the number or type of arguments passed to them. The goal is to make PHP's function signatures more consistent and predictable.
This RFC proposes to allow closures to be aliased to a variable that can be used within the closure:
<?php
$fibonacci = function (int $n) as $fn {
if ($n === 0) return 0;
if ($n === 1) return 1;
return $fn($n-1) + $fn($n-2);
};
echo $fibonacci(5);
Following are some changes that did not go through an RFC process because they are either planned, bug fixes, or progressive enhancements.
Commits are grouped by author in random order.
-Wenum-int-mismatch
] compiler warnings in GH-11352ext/standard/array.c
: Optimize min/max functions for int/float in GH-11194http_fopen_wrapper
: fix [-Wanalyzer-deref-before-check
] in 810507ab1b-Wanalyzer-deref-before-check
] in 13ad8ef40bzend_constant
exist in ce724d186dzend_string
pointer to check for equality instead of C strings in GH-11370TypeError
on illegal offset access in GH-10544php_array_walk()
function in a02f7f24c6zend_str
instead of C string in GH-11381ext/imap
: Refactor + Update to modern property write API in GH-11415php_imap_list_add_object()
function in ext/imapphp_imap_hash_add_object()
in ext/imaprfc822_write_address()
in ext/imapheader_injection()
in ext/imapimap_fetch_overview()
in ext/imaptrue
in ext/imapzendi_try_get_long()
function via a public API in Zendrange()
function in RFCzval_ptr_dtor_nogc()
for callable in ext/xslt
in GH-11356spl_dllist_object
in 5fae4b5031sxe_get_element_by_name()
in c6bffff96bxmlStrEqual()
instead of !xmlStrCmp()
in 47c277bde5DOMNodeList::item()
and DOMNamedNodeMap::item()
to fast ZPP in GH-11361DOMDocumentFragment
does not reconcile namespaces in GH-11362DOMChildNode::replaceWith()
bug when replacing a node with itself in GH-11363getElementById
in GH-11369uint32_t
for the number of nodes in GH-11371libxml2
hack if the version does not suffer from the bug in GH-11379init_fcall_003.phpt
without opcache in GH-11378php_libxml_unregister_node()
in GH-11398DOMDocument::savexml
and friends ommit xmlns=""
declaration for null namespace, creating incorrect xml representation of the DOM in GH-11428mb_str_pad()
in GH-11284--enable-mbstring
enabled in GH-11516proc_open
in GH-11509dom_child_replace_with()
in PHP SourceDOMAttr::$value
and DOMAttr::$nodeValue
expansion in PHP SourceWUNTRACED
in GH-11526ext/pgsql
: php_pgsql_convert
converts E_NOTICE
to TypeError
/ValueError
exceptions in 16a63d7b07ext/pgsql
: adding pg_set_error_context_visibility in dd8514a0bdext/pdo_pgsql
: connection status update to distinguish from truly bad quality connections in ec3daea1d6ext/pgsql
imagerotate
removes ignore_transparent
argument in ext/gd
DOMAttr::$value
without expanding entities in 50fdad8325dom_remove_all_children()
in 74910b1403xmlNodeSetContent()
in ee68c22128DOMAttr::$nodeValue
in 076ddf2b05DOMAttr
value and nodeValue properties in 0cc028c374DOMAttr_entity_expansion.phpt
in ab77485890-n
option to php-fpm
in GH-11373EG(current_execute_data)
after return from generator in GH-11380session.sid_length
have proper value for test in 0561783903PQsetErrorContextVisibility
availability (libpq >= 9.6)
in 21aaf3321fgc_status()
in GH-11393mbstring count_demerits
in reverse order in GH-11493REQUEST_URI
in f160eff441SKIP_(SLOW|ONLINE)_TESTS
in GH-11479zend_gc.h
in 973e9b2eecfile()
flags error-check in GH-11483
We are incredibly grateful for the commitment and dedication of all contributors. Stay tuned for next month's roundup as we continue to make PHP better together.
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 or via GitHub Sponsors.
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.