Sometimes, my script cannot read output by a server and the following error occurs:
PHP Fatal error: Call to a member function somefun() on a non-object
This is not something that can't be fixed on my end but this causes my script to crash. Is there a way I can create a function that gets run when this particular error occurs? I don't think it's practical to make a try-catch or similar because I would have to find every instance where a member function gets called and test whether the object exists or not (several thousand).