E-Commerce Platforms

Resolving the "Array and String Offset Access Syntax with Curly Braces" Error in WooCommerce

By the Domain India teamPublished 8 min read
Knowledge base article
Contents (7 sections)

If your WordPress or WooCommerce site shows "Fatal error: Array and string offset access syntax with curly braces is no longer supported", the site is running PHP 8 and one plugin or theme still contains code written for PHP 7 or older. This guide explains what the error means, how to get the site back quickly, and how to fix it properly.

Key takeaways

PHP 8.0 removed the old $string{0} way of reading a character or array item; code must use $string[0]. The error names the file and line, so you know which plugin or theme is at fault. Update that plugin or theme first. If no update exists, replace it, or change the braces to square brackets yourself. Switching the site to PHP 7.4 only hides the problem, on a version that has had no security fixes since 2022.

1. What the error means

Older PHP allowed two ways to read one character of a string or one item of an array:

php
$first = $name{0};   // old curly-brace syntax
$first = $name[0];   // square-bracket syntax, the only one PHP 8 accepts

PHP 7.4 marked the curly-brace form as deprecated and printed a warning. PHP 8.0 removed it completely. Now PHP refuses to compile any file that contains it, so the whole page stops with a fatal error:

text
Fatal error: Array and string offset access syntax with curly braces is no longer supported
in /home/youruser/public_html/wp-content/plugins/some-plugin/includes/file.php on line 42

The path tells you where the problem is:

  • wp-content/plugins/plugin-name/: the plugin in that folder;
  • wp-content/themes/theme-name/: the theme in that folder;
  • wp-includes/ or wp-admin/: WordPress core itself is very old and needs updating.

WooCommerce fixed this years ago. If the path points into plugins/woocommerce/, your copy of WooCommerce is badly out of date.

2. Why it appears "suddenly"

You usually see this error straight after one of these:

  • the site's PHP version was changed to 8.x in the control panel;
  • an old site was moved to a new host that defaults to PHP 8;
  • an abandoned plugin was reinstalled from an old backup or a zip file.

The code was always outdated. PHP 8 simply stopped tolerating it.

3. Get the site back online

  1. Check your email.
    WordPress sends the site admin an email titled "Your Site is Experiencing a Technical Issue" with a recovery-mode link. That link lets you log in to the dashboard with the faulty plugin paused.
  2. Or disable the plugin by hand.
    Open your control panel's File Manager, go to public_html/wp-content/plugins/ and rename the folder named in the error, for example some-plugin to some-plugin.off. WordPress deactivates a plugin whose folder has gone.
  3. For a theme,
    rename the theme's folder in wp-content/themes/. WordPress falls back to another installed theme, so keep a default theme such as Twenty Twenty-Five installed.
  4. Reload the site
    and log in to the dashboard.

If you use cPanel, remember that a cache sits in front of the web server and can keep serving an old page for a while. Add ?t=1 to the address to see the live result.

4. Fix it properly

Work through these in order and stop at the first one that works.

Update
In Dashboard › Updates, update WordPress, every plugin and the theme. Most plugins removed this syntax long ago.
Replace
If the plugin has had no update for years, it is abandoned. Find a maintained alternative, then delete the old one.
Patch
As a last resort, change the braces to square brackets in the file and line the error names. Keep a copy of the original file.

Patching the code yourself

Open the file named in the error, go to the line number, and change the curly braces after the variable to square brackets:

php
// Before (fails on PHP 8)
$initial = $value{0};
$last    = $parts{count($parts) - 1};

// After
$initial = $value[0];
$last    = $parts[count($parts) - 1];

Only change braces that come straight after a variable. Leave {$var} inside double-quoted strings, and the braces of if, function and foreach blocks, alone.

A file often has more than one case. If SSH is enabled on your account, this lists every likely match in your plugins and themes:

bash
grep -rnE '\$[A-Za-z_][A-Za-z0-9_]*\{[$0-9]' --include='*.php' ~/public_html/wp-content/

Two warnings about patching:

  • An update overwrites your change. That is fine if the update also fixes the bug, but if the plugin is abandoned, replacing it is the lasting fix.
  • The same plugin probably has other PHP 8 problems. Code that still uses this syntax usually also uses functions that PHP 8 removed. The next fatal error may be a different one.

Never edit a parent theme to fix this if you can avoid it. If the fault is in a theme you have customised, move your customisations into a child theme first, then update the parent.

5. Should you switch back to PHP 7.4?

Only as a stopgap for an hour or a day while you update or replace the plugin. PHP 7.4 accepts the curly-brace syntax (with a warning), so the error disappears, but:

  • PHP 7.4 has had no security fixes since November 2022, and PHP 8.0 none since November 2023;
  • current versions of WordPress plugins increasingly require PHP 8;
  • the outdated plugin is still outdated.

The steps for changing the version are in How to change your PHP version. Before you move the site forward again, test it as described in Understanding PHP version compatibility.

Test before you switch versions

Take a backup of your files and database first, update everything, then switch. If the site breaks, switch back in the control panel, read the error log, and fix the plugin that failed before trying again.

6. Running WordPress on Domain India

On our cPanel servers you choose the PHP version per domain, and new accounts start on PHP 8.3 (measured September 2026). DirectAdmin offers PHP 5.6, 7.2, 7.3, 7.4, 8.1, 8.2 and 8.3. phpinfo() is disabled on cPanel, so check the version with a one-line file as the PHP version guide describes. Jailed SSH access is available on every shared hosting plan; it is off by default, so ask support to enable it if you want to run the grep search above.

Shared hosting includes weekly backups with JetBackup 5 on cPanel and DirectAdmin, which you can restore from your panel. Take your own copy before any big change anyway.

For WordPress, cPanel hosting gives the widest PHP choice and includes Softaculous and WP Toolkit. The card shows the live monthly price, excluding 18% GST.

cPanel Starter
₹125/mo + GST
  • 25 GB NVMe SSD Storage
  • 50 GB Monthly Bandwidth
  • 1 Website
  • 10 Email Accounts
See plan details
What does "Array and string offset access syntax with curly braces is no longer supported" mean?

It means the site is running PHP 8.0 or newer and a file contains old code such as $value{0} to read a character or array item. PHP 8 removed that syntax, so the file cannot run. The error message names the file and line, which tells you which plugin or theme needs updating.

Which PHP version removed the curly-brace offset syntax?

PHP 7.4 deprecated it and PHP 8.0 removed it. On PHP 7.4 it produces a deprecation warning; on PHP 8.0 and newer it is a fatal error.

How do I fix it in WordPress or WooCommerce?

Update WordPress, the plugin and the theme named in the error. If no update exists, replace the plugin with a maintained one. As a last resort, change $value{0} to $value[0] on the line the error names, keeping a copy of the original file.

How do I get into wp-admin when the site shows this fatal error?

Use the recovery-mode link WordPress emails to the site admin, or rename the plugin's folder in wp-content/plugins using File Manager. WordPress deactivates a plugin whose folder is missing, and you can log in again.

Is downgrading to PHP 7.4 a good fix?

No. It hides the error but leaves you on a PHP version that has received no security fixes since November 2022. Use it only briefly while you update or replace the outdated plugin.

Will a plugin update undo my manual fix?

Yes, an update replaces the plugin's files. If the update contains the developer's own fix that is fine. If the plugin is no longer maintained, replace it rather than relying on your patch.

Ready to fix it? Read How to change your PHP version and Understanding PHP version compatibility, or open a ticket with the full error message if you are stuck.

Stuck on a PHP 8 error?

Send us the full error message and the address of the page, and we will help you find the plugin or theme at fault.

Open a ticket

Was this article helpful?

Your answer helps us decide what to improve next.

Still need help? Open a support ticket and our team will reply.

Prefer an app? Add this site to your home screen.Get the app
Fix the Curly Braces Offset Error in WordPress (PHP 8)