Modx Parse error: syntax error, unexpected '{' in /home/mydomain/domains/mydomain.nl/public_html/core/config/config.inc.php on line 13

Summary

I’m trying to update modx from 2.7.1 to a newer version (tried 2.7.2 and higher) using the Upgrade Modx extra. But I keep getting the same error page on installation. All seems to be fine and showing green checks on installation but after I hit “Install” I get this error: modx Parse error: syntax error, unexpected ‘{’ in /home/mydomain/domains/mydomain.nl/public_html/core/config/config.inc.php on line 13

Step to reproduce

Choose newer version in Upgrade Modx extra, Begin Upgrade, go through all the steps and hit Install.

Observed behavior

I get a white screen with this error: modx Parse error: syntax error, unexpected ‘{’ in /home/mydomain/domains/mydomain.nl/public_html/core/config/config.inc.php on line 13

Expected behavior

Installation to be successfull after a few minutes.

Environment

MODX 2.7.1 with the latest version of Upgrade Modx Extra. (All extra’s updated, core → Cache = emptied).

Did you take a look at the file core/config/config.inc.php?
What exactly is on line 13?
Does it work if you replace this file with the same file from the 2.7.1 backup?

Line 13 said: $config_options = {config_options};

I replaced the file with the one from the backup and got a “Site temporarily unavailable”, after refreshing that I got the next error:

Warning : array_merge(): Expected parameter 2 to be an array, null given in /home/mydomain/domains/mydomain.nl/public_html/core/xpdo/xpdo.class.php on line 341

Line 341:
$this->config = array_merge($this->config, $this->getConnection($initOptions)->config);

I think that lines 13 and 14 of the config file should read

$config_options = array (
);

This implies that during installation the placeholder {...} doesn’t get replaced. Is this the only one or are there other occurrences?
Maybe just try replacing it with $config_options = array ();


I don’t know what the problem is.

The current version of UpgradeMODX is already some months old and MODX 2.7.1 almost 4 years. If there was a general problem during upgrading, then surely someone would have noticed it by now.

Also, the extra UpgradeMODX just automates a manual upgrade. Does it work if you try to upgrade MODX manually? Does UpgradeMODX cause the error or the normal upgrade process?

Anecdotally, I believe it’s possible to mess up the config file during upgrade by going back a step in the setup. There should be a github issue from a while back but I don’t think anyone ever figured out why that causes it to break.

UpgradeMODX or manual upgrade doesn’t matter, as in both cases you’re manually going through the setup.

Be sure to manually delete all the files in the core/cache directory between tests. Once things are screwed up, the cached information may keep things from working even though you’ve fixed the problem. I would also put your browser in private or incognito mode to make sure nothing in the browser cache is causing trouble.

I did several times. The error keeps coming back no matter what I try different. So far still no solution.

Anyone any pointers? Tips?

The only think I can suggest is to check that config.inc.php file again. Search it for any { or } characters (there shouldn’t be any).

Paste the config.inc.php file into a good code editor (e.g., PhpStorm) to see if it flags any syntax errors.

Check both the paths and URLs in the file, remembering that paths are absolution paths to directories and URLs are based on internet access from the web root.

Check the config.core.php files in the root, manager, and connectors directories and in the setup/includes directory.