WordPress - 500 - Internal server error

This problem was discovered while investigating another (related) error in the media upload section. Basically, the attachment management code was providing edit links to users who did not have permission to use those links. As a result, when the links were clicked a 500 - Internal server error was produced with a description of the problem.

Unfortunately, Internet Explorer 6 discards the description and simply provides a generic (worthless) message. This page provides details and a simple fix.


500 - Internal server error

This was the failing URL This is the code that checks if the user has permission (from media.php). Notice that it provides useful information. Unfortunately, in Internet Explorer 6, this produces

and nothing else of value. (Some products seem to always choose "user hostile" when an option is provided.) There are many pages pretending to address this problem. Basically, they say something about IE requiring at least 512 bytes to show the error. (I proved beyond any doubt that that is not the problem in this case.)

Unfortunately, Internet Explorer 6 decides that no useful information is associated with the 500 error and, therefore, only a generic (translate that to mean worthless) message is displayed.


Solution

This is the problem code in wp_die() located in functions.php

(Hey, that's what the spec says it should do!)

Well, people can point fingers all day ... but if the number one browser decides not to follow spec (which is what some people claim), then it is up to the application (read that WordPress) developers to implement something that works reasonably well. (The current performance is pretty lame!) I simply added this after the code above.

This is not a perfect (or even reasonably correct) solution - but it works for me and is better than nothing. The problem is that it does not help when the message is an error object instead of a simple string. A full (correct) solution should probably detect the browser type and version and then decide what a proper response is.

(Of course, I would have never found this design problem if it wasn't for the design problems in upload.php. In total, I had to modify 3 core WordPress files to fix these problems.)


Author: Robert Clemenzi
URL: http:// mc-computing.com / ISPs / WordPress / 500_server_error.html