<![CDATA[ Editing a particular resource returns a 500 HTTP error - My Forums]]> https://forums.modx.com/thread/?thread=88492 <![CDATA[Re: Editing a particular resource returns a 500 HTTP error]]> https://forums.modx.com/thread/88492/editing-a-particular-resource-returns-a-500-http-error?page=2#dis-post-561223 Quote from: sottwell at Jan 09, 2014, 02:32 PM
I once got into this same situation. I had deleted a TV that I wasn't using any more, and every resource using the template that TV had been attached to was causing a 500 server error, whether I had edited the TV for the resource or not. I finally ended up duplicating the template and moving all of the resources to that new template. We never were able to figure out what the problem was. Nothing in the database, nothing in the cache had any sign of the TV or any connection to it, no error reports could be found.

Afterwards, it occurred to me that it may have been a corrupted index in a database table, but by that time checking tables for needing repair didn't show anything wrong.

So I would suggest first manually empty the cache (core/cache/), then check your database for tables that need repair. Also make sure that your browser's cache and cookies for the domain are cleared.

Big THANK YOU Susan for this. I had the following issue: I could no longer edit Resources in a Context. I could QuickUpdate them, save and view them on the front end, but until I read this I couldn't figure it out. AFter adding about 100 Resources to the one particular Context, I took a break to houseclean. I removed TagLister and Smarttag Extras but not the TV that the Input Option was set to smarttag. First I opened the Template and removed the TV. Then I deleted the TV. I Flushed the Cache via Manager, logged out of the Manager, and manually removed the cache folders from the core/cache/ directory. Emptied my browser cache, logged back into the Manager, refreshed the browser a few times and voila! I'm now back in the saddle.

Moral: this post - from 4 years and 7 months ago!! - saved my bacon and sanity. Wow!

Side note: I haven't worked on a MODX site in almost 2 years and once again I appreciate how incredibly consistent the MODX platform is!
Peter B
MODXCloud 2.6.5, PHP 7.1]]>
ultrasef Aug 29, 2018, 04:22 PM https://forums.modx.com/thread/88492/editing-a-particular-resource-returns-a-500-http-error?page=2#dis-post-561223
<![CDATA[Re: Editing a particular resource returns a 500 HTTP error]]> https://forums.modx.com/thread/88492/editing-a-particular-resource-returns-a-500-http-error?page=2#dis-post-487708
Thanks Bob yes that's what I mean by referential integrity - perhaps a term from the days of COBOL and Duran Duran! mod_security only scans data coming in and isn't on my dev server, but great call thanks - I have wasted spent many days missing that. There's nothing in the MODx log, but Mark thank you your answer reminded me I've replicated this on my dev server so have access to server logs. Duh!!

But before I go into symptoms I have found the fix, thanks to your questions putting a bit more structure into my increasingly desperate diagnosis. Trying to be careful, and distracted by the error's dependence on a text or image TV too, I'd missed fixing some of the dropdown TVs..

This SQL fixes the problem, however for anyone copying the SQL do test the result - I've tried to make it broadly compatible but it assumes choices about how the new drop-down works which may not match your requirements:

update qstrv_site_tmplvars 
set type='listbox', 
properties='a:0:{}', 
input_properties=
'a:7:{s:10:"allowBlank";s:4:"true";s:9:"listWidth";s:0:"";s:5:"title";s:0:"";s:9:"typeAhead";s:5:"false";s:14:"typeAheadDelay";s:3:"250";s:14:"forceSelection";s:4:"true";s:13:"listEmptyText";s:0:"";}', 
output_properties='a:0:{}'
where type='dropdown';


This seems to be the most compatible equivalent in Revo (a restricted ExtJS select) to Evo's dropdown (a HTML select) but I'd welcome correction.

I did not need to duplicate the template or any TVs or anything else - just run this SQL to correct all dropdowns, which were presumably copied across by Provisioner. I believe this suggests a fix to Provisioner is in order. A very nice-to-have (imho, given it is software designed to accept plug-ins/extras) would be validation within MODx of those options that are stored in the database as text but could/should be foreign keys, such as modx_site_tmplvars.type.

The log shows:

[Sun Jan 19 08:28:46 2014] [error] [client 192.168.56.1] PHP Fatal error:  Cannot redeclare class modTemplateVarInputRenderText in /media/pathto/core/model/modx/processors/element/tv/renders/mgr/input/text.class.php on line 10, referer: http://example.com/manager/?a=30&id=640


So this is being run twice:

<?php
/**
 * @package modx
 * @subpackage processors.element.tv.renders.mgr.input
 */
class modTemplateVarInputRenderText extends modTemplateVarInputRender {
    public function getTemplate() {
        return 'element/tv/renders/input/textbox.tpl';
    }
}
return 'modTemplateVarInputRenderText';


Hence the unpredictable combination of two TVs rather than any predictable one or more. The type of the other TV is text, but last night I appeared to resolve the issue, so restored the database and started trying to find a sequence of steps, and another two TVs of different types (dropdown and image) appeared to trigger the error.]]>
technicaltitch Jan 19, 2014, 04:17 AM https://forums.modx.com/thread/88492/editing-a-particular-resource-returns-a-500-http-error?page=2#dis-post-487708
<![CDATA[Re: Editing a particular resource returns a 500 HTTP error]]> https://forums.modx.com/thread/88492/editing-a-particular-resource-returns-a-500-http-error?page=2#dis-post-487684
ini_set('display_errors', 1);
error_reporting(E_ALL);


Ideally it will then show an error and a line number.

What's the type of the second TV that is causing the issue?]]>
markh Jan 18, 2014, 03:35 PM https://forums.modx.com/thread/88492/editing-a-particular-resource-returns-a-500-http-error?page=2#dis-post-487684
<![CDATA[Re: Editing a particular resource returns a 500 HTTP error]]> https://forums.modx.com/thread/88492/editing-a-particular-resource-returns-a-500-http-error?page=2#dis-post-487667
The fact that a brand new TV still causes the problem suggests that it's not a problem intersect object (though it's not conclusive proof of that).

What's the content of the TV? I'm beginning to suspect mod_security.

Is there anything in the MODX error log?

]]>
BobRay Jan 18, 2014, 01:48 PM https://forums.modx.com/thread/88492/editing-a-particular-resource-returns-a-500-http-error?page=2#dis-post-487667
<![CDATA[Re: Editing a particular resource returns a 500 HTTP error]]> https://forums.modx.com/thread/88492/editing-a-particular-resource-returns-a-500-http-error?page=2#dis-post-487657
(Updating so as not to fill inboxes and continuously bump my issue.)

I've discovered that the problem appears to be related to TWO TVs. If EITHER of them are removed from the template the edit recovers. (I've checked all referential integrity and value types for them both.)

Update: Hold any feedback for a while. The 'type' of one of the values is 'dropdown', which is not supported in MODx 2.2.10. Perhaps a consequence of upgrading a site from Evo to Revo using Provisioner. Odd it worked for a while then stopped - perhaps when someone edited something. However I fixed this and replaced the template and other problematic TV am still getting the 500 HTTP error.

This is getting really really frustrating. Been working on this for a few days, can't remotely charge the client for the amount of time, have records of all the associations I've been testing, and there's just no pattern. I'll find just one TV switches on and off the problem, then I discover another that seems to disable the first, then those will stop making any difference at all and a totally different TV starts triggering or fixing the problem. Anyone any ideas from the other side, ie, what could possibly cause a 500 error? Presumably it is a memory issue due to a multiplicative record join, or something?
]]>
technicaltitch Jan 18, 2014, 06:02 AM https://forums.modx.com/thread/88492/editing-a-particular-resource-returns-a-500-http-error?page=2#dis-post-487657
<![CDATA[Re: Editing a particular resource returns a 500 HTTP error]]> https://forums.modx.com/thread/88492/editing-a-particular-resource-returns-a-500-http-error?page=2#dis-post-487656 technicaltitch Jan 18, 2014, 05:23 AM https://forums.modx.com/thread/88492/editing-a-particular-resource-returns-a-500-http-error?page=2#dis-post-487656 <![CDATA[Re: Editing a particular resource returns a 500 HTTP error]]> https://forums.modx.com/thread/88492/editing-a-particular-resource-returns-a-500-http-error?page=2#dis-post-487614

It could be an invalid modTemplateVarResource or modTemplateVarTemplate object.

SiteCheck would tell you which one and offer to fix it: http://bobsguides.com/sitecheck-tutorial.html]]>
BobRay Jan 17, 2014, 02:53 PM https://forums.modx.com/thread/88492/editing-a-particular-resource-returns-a-500-http-error?page=2#dis-post-487614
<![CDATA[Re: Editing a particular resource returns a 500 HTTP error]]> https://forums.modx.com/thread/88492/editing-a-particular-resource-returns-a-500-http-error#dis-post-487611
I ran:
repair table qstrv_site_content;
repair table qstrv_site_tmplvar_contentvalues;
repair table qstrv_site_tmplvar_templates;


(and every other table in the database)
I've tried deleting (DELETE FROM..) all the differences I can find in the above three tables (it had been populated for some other templates).
I've duplicated the template, dissociated the TV, saved, re-associated it, and assigned resources to the duplicate template
I've tried associating resources to the template THEN dissociating the TV, saving and re-associating the TV.

But when this TV is on the template or its duplicate, editing any resource on that template throws a 500 HTTP error. When this TV is on another template, no problem. Comparing before and after databases, these TV values were set previously on these resources on the original template without any problem. There are no duplicates for a given contentid. The TV is associated with the same templates as before. All that has changed is some values have been entered for resources on different templates. (Deleting these tmplvar_value rows doesn't help. Deleting the site_content rows doesn't either - through the MODx manager or in the database.)

qstrv_site_tmplvars.properties, input_properties and output_properties are NULL. qstrv_site_tmplvars.display is empty. I've tried populating them, doesn't help. qstrv_site_tmplvars.editor_type and static are zero.


Please could someone give me some inkling as to what could possibly cause editing to throw the 500 error? (Or anything else at all that might give me a shove towards resolution.)

The problem seems to have arisen when the users started populating the TV on templates other than the original one. The TV is associated with other templates but had not previously been populated.]]>
technicaltitch Jan 17, 2014, 01:37 PM https://forums.modx.com/thread/88492/editing-a-particular-resource-returns-a-500-http-error#dis-post-487611
<![CDATA[Re: Editing a particular resource returns a 500 HTTP error]]> https://forums.modx.com/thread/88492/editing-a-particular-resource-returns-a-500-http-error#dis-post-487261 technicaltitch Jan 14, 2014, 03:06 AM https://forums.modx.com/thread/88492/editing-a-particular-resource-returns-a-500-http-error#dis-post-487261 <![CDATA[Re: Editing a particular resource returns a 500 HTTP error]]> https://forums.modx.com/thread/88492/editing-a-particular-resource-returns-a-500-http-error#dis-post-487260
Ideas on diagnosis at least as welcome as potential solutions thanks.]]>
technicaltitch Jan 14, 2014, 03:04 AM https://forums.modx.com/thread/88492/editing-a-particular-resource-returns-a-500-http-error#dis-post-487260