Using Laravel, I created an app to summarize and chat with YouTube videos. Check it out!
Benjamin Crozat
PHP

An early look at PHP 9.0's new features and changes

Benjamin Crozat
Modified on Jan 1, 2024 2 comments Edit on GitHub
An early look at PHP 9.0's new features and changes

Introduction

PHP is an open-source project. Knowing what new features and changes are planned for the next version only takes a minute of research. For instance, this page lists all the accepted RFCs for different versions of PHP.

That being said, despite PHP 9.0 being planned, no work have been started yet and we have to dig deeper.

When will PHP 9.0 be released?

For now, the release date of PHP 9.0 hasn’t been announced yet. This version is still far in the future. We could get PHP 8.5 and 8.6 before 9.0 is even considered. Who knows?

How to install and test PHP 9.0?

To this day, no work has been started on PHP 9.0, so you won’t even be able to pull the latest code and compile it yourself.

New features and changes planned for PHP 9.0

PHP 9.0 throws an exception on unserialization errors

This RFC, Improve unserialize() error handling, which has been partially implemented in PHP 8.3, upgrades unserialization errors from E_NOTICE to E_WARNING.

In PHP 9.0, these will be upgraded to an UnserializationFailedException.

This will allow developers to stop using a custom error handler and get a behavior more consistent with other parts of the language.

// PHP 8.3: "Warning: unserialize(): Error at offset 0 of 3 bytes"
// PHP 9.0: "Uncaught UnserializationFailedException: unserialize(): Error at offset 0 of 3 bytes"
unserialize("foo");

Deprecated features from earlier PHP versions will be removed

Features that have been deprecated in PHP 8.1, 8.2, 8.3, and 8.4 (learn more about PHP 8.4) will finally removed in PHP 9.0. This will translate to breaking changes for developers who ignored the warnings. 😅

Here’s a list of RFCs containing all the deprecated features:

Some warnings will become errors in PHP 9.0

In order to make PHP more reliable, warnings for undefined variables and properties will now become errors.

For instance, the following code will not run anymore in PHP 9.0:

// PHP 8.x: "Warning: Undefined variable $foo"
// PHP 9.0: "Fatal error: Uncaught Error: Undefined variable '$foo'"
echo $foo;

Also, from what I understand, these changes with variables and properties will make the maintainers’ lives easier, which is good for everyone!

I let you check out the RFCs for more details:

Wait, there's more!

2 comments

Tormi Talv
Tormi Talv 4mos ago

What would you expect from PHP 9? PHP 8 seems quite mature already. I think they are yet collecting breaking ideas for PHP 9.

Benjamin Crozat
Benjamin Crozat 4mos ago

I'm open to big changes! Some people might not, though. It's really hard to see where it's going for now, unfortunately.

Get help or share something of value with other readers!

Great deals for enterprise developers
  • ZoneWatcher
    Get instant alerts on DNS changes across all major providers, before your customers notice.
    25% off for 12 months using the promo code CROZAT.
    Try ZoneWatcher for free
  • Quickly build highly customizable admin panels for Laravel projects.
    20% off on the pro version using the promo code CROZAT.
    Try Backpack for free
  • Summarize and talk to YouTube videos. Bypass ads, sponsors, chit-chat, and get to the point.
    Try Nobinge →
  • Monitor the health of your apps: downtimes, certificates, broken links, and more.
    20% off the first 3 months using the promo code CROZAT.
    Try Oh Dear for free
  • Keep the customers coming; monitor your Google rankings.
    30% off your first month using the promo code WELCOME30
    Try Wincher for free →
The latest community links
- / -