[wp-hackers] "Plugin could not be activated because it triggered a fatal error." But what is the error?

Andrew Nacin wp at andrewnacin.com
Fri Mar 12 18:15:22 UTC 2010


Otto is right in that "some hosting systems don't let you turn on
display_errors."

Beyond that, it's exactly what I suspected. Re-declaring a plugin throws an
E_COMPILE_ERROR, which in 2.9 we do not account for. (Thus, if you have two
active plugins defining the same function, you'll get a white screen of
death.)

A few lines above the include and ini_set, there's an error_reporting()
call. Add E_COMPILE_ERROR in there and you'll see your fatal error.

We're probably going to backport the E_COMPILE_ERROR check to 2.9. This is
fixed in 3.0.

As a general reminder, always give your plugin functions a unique prefix (or
wrap them in a class). And don't forget that your own plugins should play
nice with one another as well.

On Fri, Mar 12, 2010 at 1:01 PM, James Nachlin <jnachlin at sixapart.com>wrote:

> Yes.  I in fact do have another plugin defining widget()!  Renaming my
> functions made the error go away.
>
> I think Otto is right.  The process dies right in plugins.php, at
>
> include(WP_PLUGIN_DIR . '/' . $plugin);
>
> The previous line's ini_set is not having the effect of turning on the
> display of the errors, in the case of a name collision between two function
> names in two different plugins.
>
> If I fix that problem, I can activate the plugin.  If I deactivate the
> plugin, then intentionally add a new error to my plugin, I see the error in
> the iframe as I should.
>
> Thanks again,
> Jim
>
> Andrew Nacin wrote:
>
>> James mentioned to me he was running 2.9.2. I've looked into this further,
>> and the issue appears to be that we only started including E_COMPILE_ERROR
>> in default error reporting (including the plugin activation sandbox) in
>> 3.0.
>> Additionally, we previously overrode the error reporting level set up via
>> WP_DEBUG in the sandbox. (In 3.0, we account for WP_DEBUG.) Thus, my guess
>> is you have another plugin that is defining widget(), which throws the
>> apparently unreported Zend error.
>>
>


More information about the wp-hackers mailing list