Welcome to the fifth edition of PHP Core Roundup, a series of posts that round up updates and news on the latest improvements, discussions, bug fixes, and new features 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, administration member of the PHP Foundation, also writes a monthly series about updates on the PHP Foundation, which are available under The PHP Foundation Update tag on the blog.
Elena Rubashevska from Open Collective interviewed Roman about the PHP Foundation, why and how it came to be, and his thoughts on the future of PHP, which you can read at PHP Foundation: Alive and Kicking.
PHP 8.2 reached its feature-freeze, and release managers have branched the PHP-8.2 branch on Aug 30th.
Now that PHP 8.2 is branched out, the master
branch will be the development branch for PHP 8.3. Bug fixes and other improvements will be cherry-picked for PHP 8.2 (and older branches) as appropriate, but new features that are made to the master branch will not be merged to the PHP 8.2 branch.
Tools that build PHP based on the Git branches will also see the new branch, and the builds from the master
branch will be named “PHP 8.3” for the first time.
We already have PHP 8.2 beta releases, and the first PHP 8.2 Release Candidate (PHP 8.2.0-RC1) will be released on Sept 1st.
Although the PHP 8.2 feature-freeze is passed, there are few changes that Jakub Zelenka proposed merging, and a few more by other contributors that are now merged to PHP 8.2. All of the changes are contained (in that, they don’t drastically change other parts of PHP apart from that proposed change), and do not include any syntax changes.
libxml_get_external_entity_loader()
in PR #7977 by Tim Starlingopenssl_cipher_key_length
function in PR #9368 by Jakub Zelenka@strict-properties
can be bypassed using unserialization by Tim Düsterhus, Máté Kocsis, and Tyson AndreChanges 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 web site 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 of the changes made by the people behind PHP. Things marked with 💜 are done by the PHP Foundation team.
Derick 💜 has gone through all the date/time notes in the manual and integrated them where possible into said manual. There were literally hundreds of notes, resulting in the following changes: #1 #2 #3
Following are the RFCs and major pull-requests discussed, voted, and implemented since our last update.
RFC Under Discussion: Asymmetric Visibility
RFC by Ilija Tovilo 💜 and Larry Garfield propose (who also brought Enums to PHP in PHP 8.2) started a discussion on adding a new syntax to granularly declare visibility conditions (such as public, protected, or private) for class property set operations (such as assigning a value to a class property), while the get operations (reading the class properties) are not restricted.
This RFC provides a new syntax for declaring the “set” operation visibility of an object property. Specifically:
class Foo
{
public private(set) string $bar;
}
This code declares a property $bar
that may be read from public
scope but may only be modified from private
scope. It may also be declared protected(set)
to allow the property to be set from any protected scope (that is, child classes).
There is an ongoing lengthy discussion about this RFC, and Brent Roose has written a blog post about his take on this RFC too.
RFC Under Discussion: json_validate
Juan Carlos Morales, on his first RFC, proposes to add a new json_validate()
function that returns if the given string of JSON is a valid JSON. PHP’s json_decode()
function can emit errors or throw exceptions on strings with invalid JSON, but the proposed json_validate function will be faster and more memory efficient because it does not attempt to build the data structures in memory, but merely validate the given string.
Juan first emailed the PHP-DEV mailing list last month, trying to gather feedback. By that time, his proposed name was is_json
. You can also read and participate in the discussions on the mailing list.
RFC Under Discussion: StreamWrapper
Support for glob()
In this RFC Timmy Almroth proposes to add support for stream wrappers in the glob()
function.
glob()
is a function in PHP to list and filter files and/or folders using a globbing pattern. The current implementation of glob()
is a thin wrapper for POSIX glob(3). While all the Filesystem Functions in PHP support StreamWrappers, glob()
does not.
This RFC proposes to add consistently for stream wrappers in glob() function. With stream wrappers supported, glob() function will be able to use any supported and registered stream wrapper in PHP, similar to how other file system functions: \
glob('vfs://*.ext')
RFC Implemented: Constants in Traits
Shinji Igarashi and Stephen Reay's RFC to allow defining constants in traits is now implemented in PHP 8.2.
Constants defined in traits use the same syntax as class constants, and work similarly to class constants when the traits are used in classes. However, direct access to trait constants (without going through the classes that use the trait), and using traits in classes that both have the same constant names is not allowed.
All of the following constant declarations will work in PHP 8.2, but not allowed in older PHP versions:
trait FooBar {
const FOO = 'foo';
private const BAR = 'bar';
final const BAZ = 'baz';
final protected const QUX = 'qux';
}
New Pull Request: Allow writing to readonly properties during cloning
Nicolas Grekas has an open pull-request currently being discussed to allow setting or unsetting a property once when an object is being cloned (in the __clone()
magic method).
There is a lengthy discussion in the PR itself, and a Twitter thread started by Nicolas:
Here is a proposal, for #PHP 8.3? https://t.co/bjvBXBhkzF pic.twitter.com/d46FckQDc0
— Nicolas Grekas 💙💛 (@nicolasgrekas) August 23, 2022
This might lead to an RFC in the coming weeks and it might as well be the first RFC for PHP 8.3!
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.
ext/sqlite3
in GH-9181ext/gd
in GH-9180ext/pcntl
in GH-9075ext/tokenizer
in GH-9148ext/sodium
in GH-9225ext/spl
in GH-9226ext/intl
constants in stubs, in series GH-9205, GH-9219, GH-9233, GH-9234, GH-9267, GH-9268, GH-9269, GH-9275, GH-9276, GH-9280, GH-9281, GH-9282, GH-9385, and GH-9387ext/zip
in GH-9146ext/sockets
in GH-9349ext/curl
in GH-9384ext/tidy
in GH-9383phpdbg
in GH-9392ext/standard
in series GH-9404, GH-9426, and GH-9427ext/oci8
in GH-9419DateTime::getLastErrors()
not returning false when no errors/warnings in 932586c4261a9ee818e
, c249f3bc56
, and 5c951013
ext/random
improvements by Tim Düsterhus
php_random_bytes()
in GH-9169ext/random
in GH-9206ext/random
unserialize errors with ext/date
in GH-9185ext/random
in GH-9211Randomizer::__construct()
in GH-9222random.stub.php
in GH-9235ext/random
Exception hierarchy in GH-9220ZEND_LONG_MAX
in GH-9197Xoshiro256**
in GH-9250RuntimeException
in Randomizer::nextInt()
by RandomException
in GH-9305ext/random
's engine tests in GH-9321rand_rangeXX()
variant only based on the requested range in GH-9418Randomizer::getInt()
without argument to Randomizer::nextInt()
in GH-9057 by zeriyoshiPcgOneseq128XslRr64::jump()
: Throw ValueError
for negative $advance
in GH-9213 by Anton SmirnovPcgOneseq128XslRr64::jump()
: Throw ValueError
for negative $advance
in GH-9213 by Anton Smirnovmb_strlen
to mbstring.c
in 94fde1566fmb_strimwidth
in 7299096095mbfilter_cp5022x.c
in 78ee18413fmb_strimwidth
inserts error markers in invalid input string (for backwards compatibility) in 5370f344d2_php_mb_encoding_handler_ex
with multiple possible input encodings in 93207535fafile.current_zval
in GH-8934 by Gina Peter Banyard 💜fetch_type
from int
to uint32_t
in GH-9152 by Gina Peter Banyard 💜hebrev()
in 6ff662b2e6 by Nikita Popovsha1()
in 04f5da4b77 by Nikita Popovlibmysqlclient
version used in CI in fc394b476b by Nikita PopovTestInterface::DUMMY
constant in stub in 668dbaf6ab by Máté Kocsis 💜opcache.preload_user=root
to run-tests.php
if root in 1c9a49e3f1 by Bob Weinandzend_test
in ac31e2e611 by Bob Weinandclose-stale-feature-requests.yml
in 7804cffe04 by Ilija Tovilo 💜ZEND_RC_DEBUG
build in zend_test observer tests in b3b21ed558 by Bob Weinandphpdbg
few fixes, mostly printf-like format issues due to C str -> zend_string mismatches. annotate the allocator wrapper in 449edd815b by David CarlierTransliterator::$id
as readonly
to unlock subclassing it in GH-9167 by Nicolas Grekaszend_class_entry
in 2758ff2a77 by Dmitry Stogovis_line_empty()
function instead of the old one in GH-9217 by Gina Peter Banyard 💜map_ptr
before copying class table in GH-9188 by Arnaud Le Blanc 💜glob()
basedir
check is inconsistent in e5ab9f45d5 by Jakub Zelenka 💜?->
on magic consts in const expressions in 7b43d819c8 by Ilija Tovilo 💜zend_always_inline
functions in GH-8288 by Gina Peter Banyard 💜ZEND_DVAL_TO_LVAL_CAST_OK
in GH-9215 by Go Kudomacos-10.15
-> macos-11
in GH-9087 by Go Kudo__declspec
allocator for windows in GH-9253 by David CARLIERmb_strimwidth
RC info in GH-9254 by Ilija Tovilo 💜array_multisort
+ array_shift
in GH-9247 by Christoph M. Beckerstream_socket_accept
result may have incorrect metadata in d9ff5e079f by Jakub Zelenka 💜mb_strimwidth()
in GH-9273 by Christoph M. Becker"{$g{'h'}}"
emit fatal error and no incorrect deprecation notice in 8.2 in GH-9264 by Tyson Andrepcntl
- adjust tests set/get priority check env vars and root user in 663b037c7b by jcm--[no-]progress
option to run-tests.php
in GH-9255 by Ilija Tovilo 💜ksort
behaves incorrectly on arrays with mixed keys in GH-9293 by Denis Vaksmanrun-tests.php
--no-progress flag for non-parallel testing in c809a213f2 by Ilija Tovilo 💜DOMDocument->replaceChild
on doctype causes double free in GH-9201 by NathanFreemanreadonly
classes in 0897266219 by Máté Kocsis 💜curl/sync_constants.php
in GH-9391 by Máté Kocsis 💜pdo_oci
tests for PHP 8.0 in 305892580e by Michael VoříšekNUL
bytes in GH-9375 by Gina Peter Banyard 💜bool
instead of int
in session struct in e8e015777e by Gina Peter Banyard 💜OnUpdateLazyWrite
validator in e9749a3c1e by Gina Peter Banyard 💜OnUpdateTransSid
validator in ad3ee47c6d by Gina Peter Banyard 💜SameSite
session cookie prop should behave like other INI settings in 66aed3a86f by Gina Peter Banyard 💜IS_NULL
/IS_FALSE
/IS_TRUE
in 567213c32a by Dmitry Stogovpdo_oci
tests for PHP 8.1 in GH-9051 by Michael Voříšekoci8
& pdo_oci
in CI in GH-8348 by Michael VoříšekxmlRelaxNGCleanupTypes()
is deprecated as of libxml2
2.10.0 in GH-9417 by Christoph M. Beckeroci8/pdo_oci
random test failures when run in parallel in GH-9424 by Michael Voříšek@strict-prototypes
warning in 3264f2367d by Ilija Tovilo 💜pdo_dblib
ext test conflicts when run in parallel in GH-9430 by Michael VoříšekCONST_CS
when registering constants in GH-9439 by Máté Kocsis 💜and
local_pkdo not respect
open_basedir` restriction in 505e8d2a04 by Jakub Zelenka 💜openssl_cipher_key_length
function in 35e2a25d83 by Jakub Zelenka 💜libxml_get_external_entity_loader()
in 11796229f2 by Tim Starlinglibxml2
2.10.0 symbols in GH-9358 by Christoph M. BeckerHEAD
request on a static resource in 4f509058a9 by Vedran MiletićDELETE/PUT/PATCH
request on a static resource in 7065a222b7 by Vedran Miletićext/opcache/tests/jit/inc_obj_004.phpt
failure introduced by fd74ee7e in ce42dcf483 by Dmitry Stogovksort
behaves incorrectly on arrays with mixed keys" in 725cb4e8ad by Christoph M. Beckergen_stub
to avoid compile errors on duplicate function names in GH-9406 by Andreas Braunzend/test
aliases in ef21bbe66c by Máté Kocsis 💜ext/zend_test
alias functions in 8d78dce902 by Máté Kocsis 💜var_export
/debug_zval_dump
check for infinite recursion on the object in GH-9448 by Tyson Andreksort
behaves incorrectly on arrays with mixed keys" in 1862152145 by Ben RamseyAt 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.