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.
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.
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.
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.
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 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 Gina 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 Gina 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 Gina 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 Gina 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.
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.
zend_fcc_equals()
with trampolines (#10012) in c4a0fc62a2 by Gina Peter Banyard 💜ex->opline
is NULL (#10003) in adc23828b4 by Arnaud Le Blanc 💜ext/mysqli
tests "using password" optional in error messages in GH-10035 by Daniel Blackimap_stream
in GH-10053 by Christoph M. BeckerPHP_STREAM_TO_ZVAL
to PHP_STREAM_FROM_ZVAL
(#10065) in 11b612af6d by Nielsext/mysqli
tests "using password" optional in error messages (part 2) in GH-10064 by Daniel Blackstandard/basic_functions.c
remove x bit on this file (#10069) in faef55d638 by David CARLIERWindows-1252
text encoding in a1a69c3734 by Alex DowadRandomizer::getBytesFromString()
method in GH-9664 by Joshua Rüswegintl
extension: msgfmt_set_pattern
add pattern format error informations in 6422cf6f1a by David Carlierphp_ini.c
in GH-4512 by Elan Ruusamäemb_strpos
, mb_stripos
, mb_substr
, etc in 0c0774f5b4 by Alex Dowadmbfilter_sjis.c
in 4072a76e3f by Alex Dowadmbfilter_sjis.c
in 4ebfddfad4 by Alex DowadSJIS-Mobile#DOCOMO
decoder for speed in 43cdfa3190 by Alex DowadSJIS-Mobile#KDDI
decoder for speed in 6bf0c44f48 by Alex DowadSJIS-Mobile#SOFTBANK
decoder for speed in e36c600a31 by Alex Dowadintl
extension, follow up on #10006 for numfmt_set_pattern in GH-10073 by David Carliershmget()
wrt. IPC_PRIVATE
in GH-9946 by Tyson Andreshmget()
with IPC_CREAT must not create 0 size SHM in 4631e9de2b by Christoph M. Beckerimap_is_open()
function to check that a connection object is still valid in 52a891aeaa by Gina Peter Banyard 💜Randomizer::nextFloat()
and Randomizer::getFloat()
in GH-9679 by Tim Düsterhusmb_substr_count
using fast text conversion filters in b9cd1cdb4f by Alex DowadLDAP\Connection::__construct()
refers to ldap_create()
in GH-10115 by Christoph M. Beckerphpdbg_trim
(#10122) in e288438373 by Nielsmb_stripos
(when not using UTF-8) in 744ca16e73 by Alex Dowadmb_str{i,}pos
does not match illegal byte sequences against occurrences of mb_substitute_char
in GH-9613 by Alex DowadPDO::quote()
may return unquoted string in 921b6813da by Christoph M. Beckermbstring
: Do not stop when mbstring test failed in e0e587cdb8 by Yuya Hamada$ENV
is set in bfa56cf62b by Remi Colletext/opcache/jit/zend_jit
: fix inverted bailout value in zend_runtime_jit()
(#10144) in d3a6eedf4a by Max Kellermannphar_object.c
(#10150) in 7b2c3c11b2 by Nielsping_auto_globals_mask
to prevent undefined behaviour in GH-10121 by Niels Dossche_zend_ast_decl->lex_pos
(#10046) in 23fe58c3a8 by NielsTCP_QUICKACK
constant in GH-10145 by David Carlierauto_globals_jit=0
with preloading on in bbad29b9c1 by Niels Dosschephpdbg_load_module_or_extension
in GH-10157 by Niels Dosscheexecute_ex
in b489e0f2b8 by Derick Rethans 💜fastcgi.error_header
in a3891d9d1a by Jakub Zelenka 💜ext/opcache/jit
: handle zend_jit_find_trace()
failures in b26b758952 by Max Kellermannint|float
union type instead of numeric
(#10162) in 4cee2c0127 by Gina Peter Banyard 💜ext/opcache/jit/zend_jit_trace
: add missing lock for EXIT_INVALIDATE
in e217138b40 by Max Kellermannh
and k
flags to be combined for mb_convert_kana
in GH-10174 by Alex Dowadext/zend_test
(#10183) in 3e48e52d93 by Tim Düsterhusmb_detect_encoding
's recognition of Turkish text in f40c3fca88 by Alex Dowadposix_ttyname()
in GH-10190 by Gina Peter Banyard 💜variation5-win32(-mb).phpt
wrt. parallel test execution in GH-10189 by Christoph M. Becker!(((__ht)->u.flags & (1<<2)) != 0)
failed in GH-10209 by Niels Dossche!(((__ht)->u.flags & (1<<2)) != 0)
failed in GH-10209 by Niels Dosscheext/opcache/zend_shared_alloc
: add assertions on "locked" flag in e1a25ff2ed by Max Kellermannext/opcache/zend_shared_alloc
: change "locked" check to assertion in 10d43c40dd by Max Kellermannposix_getgr(gid|nam)_basic.phpt
fail in d5f0362e59 by Niels Dosschemb_output_handler
using fast text conversion filters in a9a672048b by Alex Dowadmb_str_split
using fast text conversion filters in 88c99afdac by Alex Dowadphp_mb_zend_encoding_converter
using fast text conversion filters in 953864661a by Alex Dowadmb_detect_encoding
using fast text conversion filters in 0e7160b836 by Alex Dowadsmart_str
in mb_http_input
rather than mbfl_memory_device
in 3b5072f6f6 by Alex DowadZend/zend_ini_scanner
: zend_ini_scanner_get_filename()
returns const string in 5e9b335e24 by Max KellermannZend/zend_ini_scanner
: parse const strings in 2d662f325d by Max Kellermannmain/SAPI
: make "ini_entries" a const string in d53ad4b566 by Max KellermannZend/zend_operators
: make several pointers const in a8eb399ca3 by Max KellermannZend/zend_API
: make several pointers const in f5149535e8 by Max KellermannZend/zend_smart_str
: make several pointers const in 00a918f0cc by Max KellermannZend/zend_execute
: make several pointers const in 0caef56ed6 by Max KellermannZend/zend_object_handlers
: make several pointers const in d48c5372ab by Max KellermannZend/Optimizer/zend_inference
: make several pointers const in efd5ecb0f2 by Max KellermannZend/Optimizer/zend_ssa
: make pointer const in 5ea9a7e219 by Max Kellermannuhc2_ucs_table
for UHC/EUC-KR/ISO-2022-KR conversion in 74319de2f9 by Alex Dowadposix_isatty()
/posix_ttyname()
in 54767b1047 by Gina Peter Banyard 💜posix_(isatty|ttyname)
in 31e7d6ef05 by Gina Peter Banyard 💜0x80
,0xFD-FF
in SJIS multi-byte character length table in d104481af8 by Alex DowadEXTENSIONS
section to test file gh10200 in de633c31dd by Gina Peter Banyard 💜mblen_table
for different SJIS variants in 3152b7b26f by Alex Dowadposix_pathconf
in GH-10238 by David Carlierrandom_fd
(#10247) in 32f503e4e3 by Tim Düsterhusmb_get_strlen
(it's actually a slow path) in cca4ca6d3d by Alex Dowadmb_str_split
/mb_substr
on MacJapanese encoding in d8b5b9fa55 by Alex Dowad(flag & (1<<3)) == 0
failed in GH-10254 by Niels Dosschegh10251.phpt
in 6faeb9571d by Christoph M. Beckermb_strlen
for known-valid UTF-8 strings in b4cbaabd9b by Alex Dowadext/opcache/jit/zend_jit_trace
: fix memory leak in _compile_root_trace()
(#10146) in bcc5d268f6 by Max Kellermannext/intl
tests for ICU 72.1 in a9e7b90cc2 by Christoph M. BeckerRandomizer::getFloat()
: Fix check for empty open intervals (#10185) in 13b82eef84 by Tim Düsterhusposix_pathconf
throwing ValueError
on empty path in 61cf7d49ab by David Carlierfree(NULL)
being safe for random status freeing (#10246) in e7c0f4e816 by Tim Düsterhusext/opcache
: C++ compatibility in b47bfd698d by Max Kellermannext/opcache/zend_shared_alloc
: rename _register_xlat_entry() params in 24b311bdd7 by Max Kellermannopcache_compile_file()
in GH-10266 by Thomas Gerbet:{
at object start (#10214) in f2e8c5da90 by Tim Düsterhusset-output
command in nightly_matrix.php
(#10302) in 71bdcce9f8 by Tim Düsterhusposix_fpathconf
in 55d19eee49 by David Carlierphp_safe_bcmp
(#10306) in fd7214436a by Tim Düsterhusext/opcache
: use C11 atomics for "restart_in" (#10276) in 061fcdb0a5 by Max Kellermannbuild/php.m4
: remove test for integer types (#10304) in 7473b86f10 by Max Kellermannzend_hash_check_size
: allow nSize <= HT_MAX_SIZE (#10244) in 2b1907786c by Arnaud Le Blanc 💜run-tests.php
hanging when a worker process dies without notice in GH-9931 by Arnaud Le Blanc 💜HAVE_
macro (#10310) in a493da7b9d by Arnaud Le Blanc 💜www.conf
in 7d98e3e40c by Jakub Zelenka 💜search_str
is always true here (#10322) in e951202a69 by NielsxmlTextWriterEndElement
in GH-10324 by Niels Dosschephar_object.c
in GH-10328 by Niels Dosschehttp_build_query()
tests to the HTTP test folder in c177ea91d4 by Gina Peter Banyard 💜http_build_query()
in ec7c7a7550 by Gina Peter Banyard 💜http_build_query()
in 7d33a30b40 by Gina Peter Banyard 💜zend_string*
value for an INI setting in 098a43dbd0 by Gina Peter Banyard 💜arg_sep
in php_url_encode_hash_ex()
in 76eaff080a by Gina Peter Banyard 💜zend_string*
instead of char*
and size_t
pair for key_prefix
in c9b8d1bfaa by Gina Peter Banyard 💜key_suffix
parameter in php_url_encode_hash_ex()
in 540e5104df by Gina Peter Banyard 💜UPGRADING.INTERNALS
with the changes made to php_url_encode_hash_ex()
in 334ecbed5e by Gina Peter Banyard 💜main()
from mysqli warning (#10321) in 38dfd20526 by Kamil TekielaMYSQL_ATTR_USE_BUFFERED_QUERY
is a bool attribute (#10320) in da550e7762 by Kamil Tekielazend_object_handlers.h
(#10330) in 6556601b45 by Gina Peter Banyard 💜mysqlnd_shutdown()
(#10355) in 0e5128c256 by Kamil Tekiela__toString
in XXH3's initialization in GH-10352 by Niels Dosschephp_stream_tell()
call in GH-10365 by Niels Dosschepcre_get_compiled_regex_ex()
(#10354) in fa1e3f9798 by Kamil Tekielamb_fast_check_utf8
) for seeing if 16 bytes are all ASCII characters in d58f70455b by Alex Dowadmb_fast_check_utf8
) for overlong code units and invalid codepoint values in 8902e47f3d by Alex DowadZEND_YIELD
in GH-10332 by Niels Dosschephp_pdo_mysql_sqlstate.h
in GH-10363 by Marcos Marcolinzend_gc.c
in GH-10371 by Niels Dosscheext/opcache
: use C11 atomics for "restart_in" (#10276)" (#10339) in bff7a56d00 by Max Kellermann!(zval_get_type(&(*(property))) == 10)
failed in 0801c567dc by Niels Dosschestripslashes()
only dependent on SSE2 configuration. (#10408) in 2b55dee4dc by Niels Dosscheautoconf
>= 2.70 (#10383) in bf5fdbd3a8 by Peter KokotPS_EXTRA_RAND_BYTES
(#10394) in d9c2cf7e3d by Tim DüsterhusFILE
section in test bug80747.phpt
in 974dba3b80 by Niels DosscheHAVE_DEV_URANDOM
in 2b395f7b6e by Tim Düsterhus/dev/urandom
from Zend/Zend.m4
in a408781ab4 by Tim Düsterhusarc4random_buf()
on glibc (#10390) in 57b362b7a9 by Tim Düsterhusphp_random_bytes_throw
in php_password_make_salt
(#10393) in c59e0750af by Tim Düsterhusposix_pathconf
api in GH-10350 by David Carlierarc4random_buf
for glibc, merge mistake in 2740920a39 by David Carliercs_8559_5
in map_from_unicode()
in GH-10399 by Niels Dosschezend_internal_call_should_throw()
in GH-10417 by Niels Dosschemb_check_encoding
for UTF-8 only in 63c50cc87e by Alex Dowadzend_fiber_object_gc()
(#10386) in 9830204213 by Arnaud Le Blanc 💜zend_shared_alloc_unlock()
(#10405) in dc6fbec037 by Niels DosscheAt 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.