Every PHP release comes with a list of old features on their way out, and this RFC is that list for PHP 8.5. It's a group effort from Gina Peter Banyard, Christoph M. Becker, Daniel Scherzer, Tim Düsterhus, Theodore Brown and others, with a separate vote for each item. Anything that passed emits a deprecation notice in PHP 8.5 and is scheduled for removal in PHP 9, unless the RFC says otherwise.
Some of what was deprecated
Semicolons after case. This syntax is a leftover from PHP/FI 2. The RFC found zero uses in the top 1,500 Composer packages, and PHP-CS-Fixer can fix it for you.
switch ($value) { case 'foo'; // deprecated, use a colon break; }
Non-standard cast names. Use (int), (bool), (float) and (string) instead of (integer), (boolean), (double) and (binary).
Backticks. The ` operator runs shell commands, but it's easy to miss in code review and hides error handling. Use shell_exec() instead.
__sleep() and __wakeup(). Use __serialize() and __unserialize(), which arrived in PHP 7.4.
null as an array key. Today $array[null] silently means $array[""]. That now emits a notice, and so does passing null to array_key_exists().
Functions that do nothing. curl_close(), curl_share_close(), finfo_close(), xml_parser_free() and imagedestroy() have been no-ops since PHP 8.0 or 8.1, and they're now deprecated.
Other items that passed include:
Reflection*::setAccessible()- The
report_memleaksandregister_argc_argvINI settings, plus removingdisable_classes SplObjectStorage::contains(),attach()anddetach()ord()with strings that aren't one byte long, andchr()with integers outside 0 to 255- The
$http_response_headervariable - PDO's
uri:scheme and driver-specific PDO constants and methods DATE_RFC7231andDateTimeInterface::RFC7231
What it means for existing code
In PHP 8.5, you'll see deprecation notices for these, but your code still runs. None of these features will be removed before PHP 9, which gives you time to move to the replacements.
The vote
There were 46 separate votes, each needing a two-thirds majority. 40 passed and 6 failed. These are the ones that failed:
- Attributes on multiple properties or constants at once (5 to 19)
ReflectionParameter::allowsNull()(9 to 10)- Non-canonical type names in
settype()(8 to 10) - The
FILTER_DEFAULTconstant (12 to 10) - Using the default
$filterinfilter_*()functions (9 to 10) PDO::ERRMODE_WARNING(8 to 12)
Everything that passed shipped in PHP 8.5.