Whats New? PHP 8 greatly improves WordPress but don’t upgrade yet!

PHP 8 is buzzing-in fast in the news and is expected to be released in December 2020 and it comes with a promise of some powerful features and great language improvements, warnings, and error notifications.

It is the programming language that powers WordPress sites, this PHP’s latest version offers new features and improvements that developers will find useful and promise to greatly enhance the security and performance of websites.

Although most RFCs have already been approved and implemented, PHP 8 is still under development and will be for two or more years after launch. so it’s time for us to dive into some of the most exciting additions that should make PHP faster and more reliable.

As we always advise our readers, for any new development and new versions of WordPress, plugins, or themes it is not advisable to upgrade right away. It is important to let all the developers upgrade their products before Updatign your website or systems. PHP 8 is a massive change from previous versions therefore most developers will be scrambling to make their plugins, themes compatible, so it is important that you wait before making a switch, otherwise you may end up breaking your site.

Should I upgrade my website right away?

Answer: Big No! The upcoming major version of WordPress 5.6, will be the “beta compatible with PHP 8” according to the November 18 WordPress dev chat. Here WordPress functionality will work, you might get some unexpected bugs, even without the presence of additional plugins or themes. WordPress is asking for additional testing with PHP 8 to find and fix as many remaining bugs as possible.

So let us review some of the new stuff coming to WordPress from PHP 8.

PHP JIT (Just in Time Compiler)

The most acclaimed feature coming with PHP 8 is the Just-in-time (JIT) compiler. What is JIT all about?

The RFC proposal describes JIT as follows:

“PHP JIT is implemented as an almost independent part of OPcache. It may be enabled/disabled at PHP compile time and at run-time. When enabled, native code of PHP files is stored in an additional region of the OPcache shared memory and op_array→opcodes[].handler(s) keep pointers to the entry points of JIT-ed code.”

JIT thus keeps track of code that’s frequently used and attempts to optimize the machine code translation so that it can be reused. This can result in a massive performance improvement for specific functionality.

PHP 8 uses much stricter typing than previous versions

PHP 8 has introduced much stricter typing than previous versions. Many built-in functions are now pickier about the input they accept, and PHP 8 itself is more stringent about how input is passed to functions. Issues that previously resulted in notices now result in warnings, and issues that previously resulted in warnings now result in errors.

In other words, PHP 8 is not as lenient as previous versions. It will not try quite as hard to make code work no matter what.

Some functions and features that were deprecated in PHP 7.x have been completely removed. These include:

  • The $php_errormsg variable
  • The create_function() function
  • The mbstring.func_overload ini directive
  • The real type
  • The allow_url_include ini directive
  • The restore_include_path() function
  • The each() function

While most of these are no longer widely used,  create_function is still used in over 5,500 WordPress plugins, including extremely popular plugins. Some still use of these deprecated functions may be intended for backwards compatibility with older versions of PHP. Many plugins, however, will need extensive refactoring as PHP 8 becomes more utilized.

For more in-depth information about what’s changed and what is coming with PHP 8, Yoast and Kinsta have done great blog posts on compatibility and new stuff intended for developers looking to ensure their software is compatible.

Wonderful!, just before you go: Please subscribe to our website for the latest tips, ideas, and recommendations to make your WordPress site wonderful.

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 152 other subscribers

%d bloggers like this: