Jump to content

Install died silently because of suppressed error in init.ph


TSP

Recommended Posts

I experienced that my dev area suddenly died. 

No matter what I did there was no chance I could get PHP to print any error messages. 

So after one hour I had an idea that led me to finding out what it was caused by. 

I started to comment out entries in plugins/hooks.php as I saw it had been modified at the time I started having problems. Eventually I got my dev setup to respond again, at least on certain pages. 

Turns out it was caused by entries like this: 

  '\\IPS\\CustomField' => 
  array (
    356 => 
    array (
      'file' => 'applications/tekcode/hooks/CustomFieldExtend.php',
      'class' => 'tekcode_hook_CustomFieldExtend',
    ),
    365 => 
    array (
      'file' => 'applications/tekcode/hooks/CustomFieldExtend.php',
      'class' => 'tekcode_hook_CustomFieldExtend',
    ),
  ),

For some reason some entries had been duplicated.

And why didn't it give me any errors and just a blank page? Well, because of this beautiful line inside function monkeyPatch:

if( @eval( $contents ) !== FALSE )

When I remove that @, then I got the error:  

Fatal error: Cannot redeclare class IPS\tekcode_hook_tekMemberExtend in /*/init.php(434) : eval()'d code on line 110

So you know, maybe consider:

1) Prevent this from happening in the first place (I have literally no idea myself how it could happen, so easier said than done but... just saying)

2) Not let everything die silently with no visible explanation causing us to potentially scratch our heads in frustration for hours when something fails

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...