[wp-trac] Re: [WordPress Trac] #7671: Plugin fatal error yields irrelevant error message from WordPress

WordPress Trac wp-trac at lists.automattic.com
Thu Sep 4 10:22:39 GMT 2008


#7671: Plugin fatal error yields irrelevant error message from WordPress
-------------------------------+--------------------------------------------
 Reporter:  omry               |        Owner:  anonymous
     Type:  defect             |       Status:  reopened 
 Priority:  normal             |    Milestone:  2.7      
Component:  General            |      Version:  2.7      
 Severity:  normal             |   Resolution:           
 Keywords:  reporter-feedback  |  
-------------------------------+--------------------------------------------
Changes (by DD32):

  * status:  closed => reopened
  * version:  => 2.7
  * resolution:  invalid =>
  * milestone:  => 2.7

Comment:

 > any error inside the activated plugin generate some strange error
 messages. wasn't the point of this detection mechanism to help point out
 the problem in broken plugins?

 Yep, It was to protect against PHP errors, of which it currently does,
 die() or outputting some error message is not a Fatal PHP error which it
 was designed to protect against.

 > it's better not to provide an error message at all than to provide some
 bogus irrelevant message.
 No bogus error is produced, The "Bogus" error you provided was a PHP Fatal
 error message about you trying to redefine a allready defined function,
 Which is due to your code killing execution when its not expected to.

 > what if you swap those two:
 Then plugin which deactivate themselves on activation if requirements are
 not met will be broken.


 I've found a mid-ground which i think makes a bit more sense, Put simply,
 If you die() within the activation function AND call
 deactivate_plugins(__FILE__); before doing so, It'll deactivate the plugin
 as expected, I'll attach a patch in a moment.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/7671#comment:6>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list