PHP updates can often create problems with older version of applications and websites. With major PHP updates, there are changes to the programming language. Many old methods are replaced with improved versions.

For instance, PHP 8.0 is the latest major update of the PHP language. It contains many new features and optimizations. Some noteable changes introduced in PHP 8 are named arguments, union types, attributes, constructor property promotion, match expression, nullsafe operator, JIT, and improvements in the type system, error handling, and consistency.

The latest changes in PHP 8.0 include:

  • The real type
  • Magic quotes legacy
  • array_key_exists() with objects
  • FILTER_SANITIZE_MAGIC_QUOTES filter
  • Reflection export() methods
  • mb_strrpos() with encoding as 3rd argument
  • implode() parameter order mix
  • Unbinding $this from non-static closures
  • hebrevc() function
  • convert_cyr_string() function
  • money_format() function
  • ezmlm_hash() function
  • restore_include_path() function
  • allow_url_include ini directive

If you switch to PHP 8 or any other version, your old PHP programs can start giving errors. You can find your error logs getting bigger each day. You must keep your codes updated to function properly with the latest versions of PHP.

When you hire a web developer, your website or application is developed and handed over to you. At the time of project handing over, the codes function properly with the latest PHP version. However, you need to hire a web developer / designer to keep your code updated.

If you don’t hire someone for updates and maintenance of your codes, you will not be able to smoothly migrate to the latest version of the programming language. If you are a business, it is advisable to hire a good B2B web design agency who can keep your websites and codes up-to-date. With an updated website, you gain from the efficiency and improvements offered by updates.

Here’s my first-hand experience with an earlier PHP update.

While checking a WordPress website after log time, I cam across a fatal error which was actually breaking my website. The WordPress blog was showing an error message. I was not even able to access the WordPress admin dashboard.

I am listing the error message here for your reference.

Warning: Illegal string offset ‘remember’ in /home/***/public_html/demo.***.com/wp-includes/user.php on line 41

Warning: Cannot assign an empty string to a string offset in /home/***/public_html/demo.***.com/wp-includes/user.php on line 41

Warning: Illegal string offset ‘user_login’ in /home/***/public_html/demo.***.com/wp-includes/user.php on line 56

Fatal error: Uncaught Error: Cannot create references to/from string offsets in /home/***/public_html/demo.***.com/wp-includes/user.php:56 Stack trace: #0 /home/***/public_html/demo.***.com/wp-login.php(806): wp_signon(”, ”) #1 {main} thrown in /home/***/public_html/demo.***.com/wp-includes/user.php on line 56

Why was this error showing up with the WordPress website?

This website was running on a very old version of WordPress. And, I had recently update the PHP version for all my websites to PHP 7.1 from the previous PHP 5.3.

Though it took me a few moments to connect the dots, I knew the culprit was the old WordPress version trying to work with the new PHP 7.1 version.

PS: Unless you are a web designer or seasoned WordPress developer or agency familiar with WordPress and the scripts, it might be a scary thing to experience. Even I was freaking for a few seconds. There are just too many rogue online entities, hackers and spammers  trying to take control of vulnerable websites.

If you are also facing similar issue (if you have landed via Google, you most likely are), the solution is fairly simple. Update the WordPress website to the latest version. You will have to update the WordPress manually.

How to update WordPress manually?

  1. Dowload the WordPress ZIP archive from WordPress.org.
  2. Upload the ZIP folder in the folder where your WordPress files sit.
  3. Extract and uncompress the ZIP file, which will bring a new “wordpress” folder there.
  4. Browse to the new “wordpress” folder.
  5. Select all the files and folders, except the wp-content folder.
  6. Move the selected file to the main folder where your actual website sits, in this case just above the current folder.
  7. Now, your WordPress website should be functional.
  8. Before you head over, log into your website and clean it up.
  9. Update your themes and plugins, and delete the ones not used.
  10. Stay updated & safe.

Hope this tutorial based on my personal experience is useful to you. I am chronicling it here so that it helps someone who faces a similar problem.