Problems when Upgrading PHP version from 7.0 to 7.4

I was updating a couple of my extras today and when it came to TinyMCE Rich Text Editor and VersionX, they required me to upgrade to PHP 7.4 (from 7.0). When I did this, my site went down with an HTTP 500 Error. So I had to reset back to 7.0 and revert both extras to their previous versions.

Firstly, what could be causing a 500 error when updating my PHP version? What should I look for to determine the issue?

Secondly, is this an issue directly with the extras? Or could this be a larger issue?

Thanks!

Environment

  • MODX v.2.7.3
  • PHP 7.0
  • Chrome 78.0.3904.87

The 500 error is from when something between the website and domain aren’t quite right.

From my personal notes: “Internal Server Error 500 - to fix this, make sure that your A records are pointed to where they need to be, and that you went into the back end of ModXCloud and underneath Domains added the correct domain names”

Although I suspect your problem may be different. I’d suggest updating the PHP, clear website cache, and then maybe just uninstall/reinstall the extras completely

Server/PHP error logs. Those may be error_log files in the site root, in a logs directory in the server home directory, or available from a server control panel. Which one applies is dependent on the server.

VersionX only requires 7.1+ for the record; higher is recommended as 7.1 is also pretty old already, but not required.

The requrements for TinyMCE RTE could be lowered. At the moment they are set to 7.1. This version had the EOL in 2019.

Here’s what my php error logs showed:

PHP Fatal error: Uncaught Error: [ ] operator not supported for strings in /home/…/public_html/path/to/cache/includes/elements/modsnippet/83.include.cache.php:17
Stack trace:

#0 /home/user/public_html/path/to/model/modx/modscript.class.php(76): include()

#1 /home/user/public_html/path/to/model/modx/modx.class.php(1859): modScript->process(NULL)

#2 /home/user/public_html/path/to/model/modx/filters/modoutputfilter.class.php(676): modX->runSnippet(‘getInsightEmplo…’, Array)

#3 /home/user/public_html/path/to/model/modx/modparser.class.php(942): modOutputFilter->filter(Object(pdoTag))

#4 /home/user/public_html/path/to/components/pdotools/model/pdotools/pdoparser.class.php(305): modTag->filterOutput()

#5 /home/user/public_html/path/to/components/pdotools/model/pdotools/pdoparser.class.php(261): pdoTag->process()

#6 /home/user/public_html/path/to/model/modx/modparser.class.php(251): pdoParser->processTag(Object(pdoTag), false)

#7 /home/user/public_html/path/to/components/pdotools/model/pdotools/pdoparser.class.php(64): modParser->processElementTags('[[pdo in /home/user/public_html/path/to/cache/includes/elements/modsnippet/83.include.cache.php on line 17

I’m not sure what some of these are. But for starters, are the ones in parentheses (i.e. 76, 1859, etc.) resource id numbers?

These are the line numbers where the error occurred.

There seems to be an error in your snippet with the ID 83 (on line 17).

It may be a few lines off from 17 as the cache may add some extra lines to the top of the file that are not present in the snippet, but yeah, that error is definitely caused in snippet 83 (getInsightEmplo...). Not quite sure how that ties in with VersionX/TinyMCE though…

What you’re looking for in that snippet is code adding values to a variable with the $var[] = ... syntax, while $var was earlier defined as a string. That’s invalid behavior as of 7.4; some more examples and explanation here.

If I recall correctly, PHP 7.1-7.3 only log a warning for that behaviour so you could opt to upgrade to 7.2 or 7.3 instead. Eventually you’ll still need to get that snippet fixed, though.