HTTP ERROR 500 when accessing Modx Manager after applying FormIT Anti-Spam tutorial

Hey everyone, thank you very much for the numerous messages regarding the issue.

I revisited it today and Im now able to access the manager again. Previously, I had disabled all plugins in the DB, cleared the cache, but nothing had changed. Finally, an error log appeared in the cache today, although it didn’t really have anything to do with the problem. After that, I cleared the cache again, and now I can access the manager again.

About 2 weeks ago, I updated my instance and PHP version to the latest version. However, I don’t think that was the cause of the problem…the issue occurred much later than the update.

Thanks again, everyone!

Hey !
I am still in the process of updating some websites to the latest PHP version. Now I am having an issue with a website that is giving me an HTTP 500 error. Only the frontend is affected, the manager is still accessible.

MODX version: 3.0.3
PHP version: 8.2.0

There are several plugins installed. I have tried multiple troubleshooting solutions from the last time, but unfortunately, nothing is working.

The error logs only show the following: “[2023-04-04 09:01:59] (ERROR @ /html/modx/core/cache/includes/elements/modx/revolution/modplugin/16.include.cache.php : 42) PHP warning: Use of undefined constant emailaddress - assumed ‘emailaddress’ (this will throw an Error in a future version of PHP)”

Can you post the code of the plugin with the ID 16 showing the emailaddress line (near line 42)?

Is the plugin part of a MODX extra or one of your own?

Hey Bobray,
It seems that the plugin is a Modx plugin, “Anti-Spam Email”. I think that the plugin is not compatible with the PHP version. Here is the code:

`<?php
/**

  • NAME: Anti-Spam Email
  • DESC: Automatically encodes all email addresses in your site to unicode, it is believed that this will stop spam-bots being able to find your email address, but is not guaranteed.
    **/

/**

  • @author Ivan Vanderbyl
  • @version 1.2
  • Based on Email Link Obfuscator 1.0.2 by cyberk.
    **/

function replaceEntities($str) {
$str=html_entity_decode($str);
for ($i = 0 ; $i < strlen($str) ; $i++) {
$strreplaced = $strreplaced . “&#” . ord($str{$i}) . “;”;
}
return $strreplaced;
}

function emailaddress($matches) {
$strMailtoTag = replaceEntities(“mailto:”);
$strNewAddress = replaceEntities($matches[1]);
$strText = replaceEntities($matches[2]);
$arrEmail = explode(“@”,$strNewAddress);
$strTag= “<a href="” . $strMailtoTag . $strNewAddress /$arrEmail[0] . “@” . $arrEmail[1]/ .“">” . $strText .“”;
return $strTag;
}

$modx->documentOutput=preg_replace_callback(“#<a[^>]mailto:([^'" ])['" ]>([^<]*)#i”, emailaddress, $modx->documentOutput);`

Try replacing the line

$modx->documentOutput=preg_replace_callback("#<a[^>]*mailto:([^'\" ]*)['\" ]>([^<]*)</a>#i", emailaddress, $modx->documentOutput);

with

$modx->documentOutput=preg_replace_callback("#<a[^>]*mailto:([^'\" ]*)['\" ]>([^<]*)</a>#i", 'emailaddress', $modx->documentOutput);

This should prevent the warning.

But this is just a simple warning and not the cause of a HTTP 500 error!

Thank you. However, the HTTP error persists. I’m wondering why the error is occurring now, after updating the MODX and PHP version. I haven’t made any changes to the code itself.

Ok, I tested the plugin with PHP 8.2 and the error message is

Fatal error: Array and string offset access syntax with curly braces is no longer supported

So try replacing

$strreplaced = $strreplaced . "&#" . ord($str{$i}) . ";";

with

$strreplaced = $strreplaced . "&#" . ord($str[$i]) . ";";

or maybe use a different extra like emo or ObfuscateEmail-Revo.


Honestly, I think this plugin doesn’t do anything, as $modx->documentOutput is always null when I test it.
Do the email-addresses on your page even get converted?

Maybe use this as the last line instead:

$modx->resource->_output = preg_replace_callback("#<a[^>]*mailto:([^'\" ]*)['\" ]>([^<]*)</a>#i", 'emailaddress', $modx->resource->_output);

Are you sure of the name? I couldn’t find “Anti-spam email” at the MODX extras page, or with a Google search.

@bobray It’s this extra:

https://modx.com/extras/package/antispamemailplugin

Thanks, I did a search at the extras site for Anti-spam email, with no quotes. There were 53 results, but I swear it’s not listed. A search for anti-spam email plugin, gives 153 results. I didn’t wade through them all but it’s not anywhere near the top of the list. I did find it with Google after putting quotes around it.

Anyway, the bottom line is that it was released in 2006 (almost 17 years ago) and never updated, so it would be fairly amazing if it worked at all in recent versions of MODX.

So far, everything has worked well - Thank you!.
However, I now have the following problem:
The column for editing a gallery resource with the MoreGallery plugin is not displayed in the backend. In general, I can only edit pages that do not contain a plugin, so those pages are edited perfectly. When I try to edit pages that are used to edit an article or a gallery, the column that usually appears on the left side of the backend remains gray and nothing can be done. Additionally, several errors were found in the error log, including the absence of the “modx_deprecated_method” table, an issue with the database query in the pdotools-Plugin, and an error retrieving data from the cache for resource 32.

Not sure what you mean exactly by “the column on the left side”. The document tree?
Are there errors in the console of the browser’s developer tools?


Without the exact error message it’s hard to say how import these are. Are these mere warnings?
Also, a pdoTools error message shouldn’t affect the MODX manager.

I made a mistake, I meant the right side for editing the parameters of the page/templates. On the right side, I’m unable to open the dropdown for the pages to be edited. This only applies to the pages that are not in gallery view.

Unfortunately, I did not receive an exact error message and the error logs do not show anything of that nature.

What dropdown? I’m still confused. Can you maybe share a screenshot?


When you open the developer tools in the browser:
Are there any error messages in the tab “Console”?
Are there AJAX-requests that fail (or return the wrong result) in the “Network” tab?


Also, if you are sure that it is a problem with the MoreGallery extra, then maybe create an issue in the specific forum:

Okay, here is a screenshot from manager:

If I take a look at the console, there are some errors being displayed. However, there is only one error entry.

Uncaught TypeError: this.proxy is undefined
    ExtJS 2
    Grid https://my-domain.de/manager/assets/modext/modx.jsgrps-min.js?mv=303pl:39
    ContainerCollections https://my-domain.de/assets/components/collections/js/mgr/widgets/category/collections.grid.resources.js:47
    ExtJS 5
    each https://my-domain.de/manager/assets/ext3/adapter/ext/ext-base.js:21
    ExtJS 4
    S https://my-domain.de/manager/assets/ext3/adapter/ext/ext-base.js:21
    S https://my-domain.de/manager/assets/ext3/adapter/ext/ext-base.js:21
    S https://my-domain.de/manager/assets/ext3/adapter/ext/ext-base.js:21
    ExtJS 5
    each https://my-domain.de/manager/assets/ext3/adapter/ext/ext-base.js:21
    ExtJS 5
    S https://my-domain.de/manager/assets/ext3/adapter/ext/ext-base.js:21
    S https://my-domain.de/manager/assets/ext3/adapter/ext/ext-base.js:21
    S https://my-domain.de/manager/assets/ext3/adapter/ext/ext-base.js:21
    S https://my-domain.de/manager/assets/ext3/adapter/ext/ext-base.js:21
    Tabs https://my-domain.de/manager/assets/modext/modx.jsgrps-min.js?mv=303pl:39
    ExtJS 5
    each https://my-domain.de/manager/assets/ext3/adapter/ext/ext-base.js:21
    ExtJS 5
    S https://my-domain.de/manager/assets/ext3/adapter/ext/ext-base.js:21
    S https://my-domain.de/manager/assets/ext3/adapter/ext/ext-base.js:21
    S https://my-domain.de/manager/assets/ext3/adapter/ext/ext-base.js:21
    S https://my-domain.de/manager/assets/ext3/adapter/ext/ext-base.js:21
    FormPanel https://my-domain.de/manager/assets/modext/modx.jsgrps-min.js?mv=303pl:39
    Resource https://my-domain.de/manager/assets/modext/widgets/resource/modx.panel.resource.js?mv=303pl:35
    Category https://my-domain.de/assets/components/collections/js/mgr/widgets/category/collections.panel.category.js:5
    create ExtJS
    load https://my-domain.de/manager/assets/modext/core/modx.js?mv=f8280b5d:86
    _loadComponents https://my-domain.de/manager/assets/modext/modx.jsgrps-min.js?mv=303pl:39
    Component https://my-domain.de/manager/assets/modext/modx.jsgrps-min.js?mv=303pl:39
    UpdateResource https://my-domain.de/manager/assets/modext/sections/resource/update.js?mv=303pl:35
    UpdateCategory https://my-domain.de/assets/components/collections/js/mgr/sections/category/update.js:8
    create ExtJS
    load https://my-domain.de/manager/assets/modext/core/modx.js?mv=f8280b5d:86
    <anonymous> https://my-domain.de/manager/?a=resource/update&id=7:128
    ExtJS 2
ext-all.js:21:301064
Uncaught TypeError: fp is undefined
    addKeywords https://my-domain.de/assets/components/seopro/js/mgr/seopro.js??v=v1.0.0:88
    initialize https://my-domain.de/assets/components/seopro/js/mgr/seopro.js??v=v1.0.0:13
    <anonymous> https://my-domain.de/assets/components/seopro/js/mgr/seopro.js??v=v1.0.0:249
    ExtJS 2

Maybe try to figure out, which exact extra make the right side of your screen go blank.
(Temporarily) deactivate the plugin of each extra, to find the culpable one.

From the error message likely candidates are:

  • SEO Pro
  • Collections

Okay, so now I’ve deactivated the two plugins… that was definitely the problem. However, I now have a problem where I can no longer install Collections and newly uploaded images cannot be displayed. When I try to install the Collections plugin, the console gives me an error. The error code is too long to upload here.

The view in the Manager now looks a bit strange as well…

I think there is some misunderstanding here:

With plugins I mean the items listed under “Elements” → “Plugins” (“Elemente” → “Plugins”). I don’t mean the extras or packages listed in “Extras” → “Installer” (“Extras” → “Package-Verwaltung”).

With “(temporarily) deactivating a plugin”, I mean setting the checkbox “Deactivate Plugin” (“Plugin deaktivieren”) in the plugin to true, and not uninstalling/removing the complete extra/package.


Can you at least post the main part of the error. Without any information it’s not possible to give any advice at all.


Did you try clearing all the caches (including the browser cache)?

The console message is 144kb large, and since I’m not sure what is relevant, I’ve added a few lines here for now: xPDOCacheManager->copyFile(): Could not copy file /homepages/4/d832769692/htdocs/MOOdxX/modx/core/packages/collections-4.0.0-beta1/MODX/Revolution/modNamespace/e6930cb3cb99339cf7221722b9d59de8/0/collections/schema/collections.mysql.schema.xml to /homepages/4/d832769692/htdocs/MOOdxX/modx/core/components/collections/schema/collections.mysql.schema.xml Could not copy file /homepages/4/d832769692/htdocs/MOOdxX/modx/core/packages/collections-4.0.0-beta1/MODX/Revolution/modNamespace/e6930cb3cb99339cf7221722b9d59de8/0/collections/schema/collections.mysql.schema.xml to /homepages/4/d832769692/htdocs/MOOdxX/modx/core/components/collections/schema/collections.mysql.schema.xml; could not create directory.

I’ll take a closer look again. The cache has been cleared.

Maybe a problem with permissions in the core/components folder?
How did you uninstall the extra? Normally via “Extras” → “Installer”?