<![CDATA[ Upgrade from 2.6.5 to 2.7.0: Parse error: syntax error, unexpected '[' - MODX Community Forums]]> https://forums.modx.com/thread/?thread=104782 <![CDATA[Upgrade from 2.6.5 to 2.7.0: Parse error: syntax error, unexpected '[']]> https://forums.modx.com/thread/104782/upgrade-from-2-6-5-to-2-7-0-parse-error-syntax-error-unexpected-039-039#dis-post-563489
I wanted to upgrade my current version 2.6.5 to 2.7.0 on a shared hosting service, and did it the way I always do it. Download the ZIP and repackage it to get rid of the first directory level (so that the main directory content of the ZIP is core, manager, setup, etc. and not modx-2.7.0-pl/core, modx-2.7.0-pl/manager, etc.).

I then uploaded the new ZIP to the webserver, extracted it there and called the setup. At the point where you normally see the summary page before the upgrade really starts, I got this error message:

Parse error: syntax error, unexpected '[' in /usr/www/users/mysite/core/model/modx/modx.class.php on line 283


I checked that file and found this section:

    /**
     * Keeps an in-memory representation of what deprecated functions have been logged
     * for this request, to avoid spamming the log too often. See the `deprecated` method.
     *
     * @var array
     */
    private $loggedDeprecatedFunctions = [];


It seemed correct to me, but when I changed the "[]" to "array()" (which should be the same difference), the setup went through without a hitch. And the new installation is running smoothly now.

But I'd like to know: What has happened there? Did I do something wrong to have caused this? Have I shot myself in the foot somehow by changing the modx.class.php in the described manor? Or am I good to go?]]>
outofcoffee Jan 09, 2019, 11:17 AM https://forums.modx.com/thread/104782/upgrade-from-2-6-5-to-2-7-0-parse-error-syntax-error-unexpected-039-039#dis-post-563489
<![CDATA[Re: Upgrade from 2.6.5 to 2.7.0: Parse error: syntax error, unexpected '[']]> https://forums.modx.com/thread/104782/upgrade-from-2-6-5-to-2-7-0-parse-error-syntax-error-unexpected-039-039#dis-post-563518
]]>
BobRay Jan 10, 2019, 10:09 PM https://forums.modx.com/thread/104782/upgrade-from-2-6-5-to-2-7-0-parse-error-syntax-error-unexpected-039-039#dis-post-563518
<![CDATA[Re: Upgrade from 2.6.5 to 2.7.0: Parse error: syntax error, unexpected '[']]> https://forums.modx.com/thread/104782/upgrade-from-2-6-5-to-2-7-0-parse-error-syntax-error-unexpected-039-039#dis-post-563505
There was an option in their web frontend to select which PHP gets used. I changed it to 7.2 (newest available), just to be sure (security and all that). Hopefully, that should prevent any problems with "[]" and its ilk on future updates.]]>
outofcoffee Jan 09, 2019, 10:57 PM https://forums.modx.com/thread/104782/upgrade-from-2-6-5-to-2-7-0-parse-error-syntax-error-unexpected-039-039#dis-post-563505
<![CDATA[Re: Upgrade from 2.6.5 to 2.7.0: Parse error: syntax error, unexpected '[' (Best Answer)]]> https://forums.modx.com/thread/104782/upgrade-from-2-6-5-to-2-7-0-parse-error-syntax-error-unexpected-039-039#dis-post-563499
I don't know why people are switching to the new syntax. AFAIK, the old syntax is not deprecated (and may not ever be), the new syntax is not any faster or more efficient -- and, as in your case, it breaks things for people with older versions of PHP.]]>
BobRay Jan 09, 2019, 08:21 PM https://forums.modx.com/thread/104782/upgrade-from-2-6-5-to-2-7-0-parse-error-syntax-error-unexpected-039-039#dis-post-563499