ElementHelper icon indicating copy to clipboard operation
ElementHelper copied to clipboard

White screens of death after removing a template file

Open hugopeek opened this issue 11 years ago • 4 comments

I found the following error in my php error log:

PHP Fatal error: Call to a member function remove() on a non-object in /Users/XXXX/Localhost/XXXXXXX/core/cache/includes/elements/modplugin/11.include.cache.php on line 157

It caused a blank response on both frontpage and manager side.. Manually clearing the cache didn't work. I had to disable the plugin in phpMyAdmin and manually remove line 157 from the cache file: $element->remove();

After that I enabled the plugin again, cleared the cache and it seems to be working again now..

hugopeek avatar Jan 31 '14 09:01 hugopeek

would something like that:

                                if ($element = $modx->getObject($element_type_name, array($name_field => $old_element_name))) {

                                    $element->remove();

                                    if ($debug)
                                    {
                                        $modx->log(modX::LOG_LEVEL_INFO, '[' . $classname . '] Removed ' . $element_type_name . ' ' . $old_element_name . ' from database');
                                    }
                                }

fix that issue?

exside avatar Feb 04 '14 13:02 exside

Hi hugopeek,

I've not seen this one before, could you post the steps to recreate the error?

roryg avatar Feb 04 '14 13:02 roryg

Hmm, seemed to be a one-time glitch.. I think it was related to deleting an element that had been renamed before, but I didn't encounter this problem again.

hugopeek avatar Apr 30 '14 20:04 hugopeek

I can confirm this issue, it's happened to me a couple times and I've fixed it by manually creating a chunk of the same name from phpmyadmin.

As far as I can tell, it happens when I rename a chunk/template from within modx, then change the static file name manually before EH has had a chance to do it (it's not EH's fault, it's because I've done things outside of the workflow), and it thinks it needs to delete a chunk that no longer exists.

I suppose just a check for if the chunk/template/snippet exists before attempting removal would fix the issue

JayCarney avatar May 01 '14 01:05 JayCarney