...
/Working with Removed Functionality in PHP 8 Extensions
Working with Removed Functionality in PHP 8 Extensions
Learn about the alternatives of removed or deprecated functionalities in PHP 8.
In this lesson, we will have a look at removed functionality in PHP 8 extensions. This information is extremely important in order to avoid writing code that does not work in PHP 8. Further, an awareness of removed functionality helps us prepare existing code for a PHP 8 migration.
The following table summarizes removed functionality in extensions:
Alternatives to Removed Functions from PHP 8 Extensions
Extension | Removed Function | Suggested Replacement |
Exif |
|
|
GD |
| create the image as normal, then use |
GMP |
|
|
Imap |
|
|
LDAP |
|
|
|
| |
OC18 |
| None |
Zlib |
|
|
The preceding table provides a useful list of removed functions. Use this list to check against our existing code prior to a PHP 8 migration.
Let’s now have a look at a potentially serious change to the mbstring
extension.
Discovering mbstring
extension changes
The mbstring
extension has had two major changes that have massive potential for a backwards-compatible code break. The first change is that a significant number of convenience aliases have been removed. The second major change is that support for the mbstring
PHP function overloading capability has been removed. Let’s first have a look at removed aliases.
Handling mbstring
extension removed aliases
At the request of a number of developers, the PHP development team responsible for this extension graciously created a series of aliases, replacing mb_*()
with mb*()
. The exact rationale for granting this request has been lost in time. The burden of supporting such a massive number of aliases, however, wastes a tremendous amount of time every time the extension needs to be updated. Accordingly, the PHP development team voted to remove these aliases from the mbstring
extension in PHP 8.
The ...