1

I am quite new to OOP and classes. One thing I am struggling with is that if there are errors within a method of a class, no error messaging is displayed, the page just breaks. Does anyone know why this is or how I can get this to display errors?

4
  • This has nothing to do with OOP or classes, but with error reporting. Take a look at How to get useful error messages in PHP?. Commented May 21, 2012 at 14:47
  • Fatal errors aren't specific to OOP. ini_set('display_errors', 1) Commented May 21, 2012 at 14:48
  • 4
    -1 because you haven't shown that you've done any research on the topic. This is one of the most commonly asked questions regarding PHP so you should be able to find plenty of answers. Commented May 21, 2012 at 14:49
  • Are the downvotes due to the fact that he thought that the error messages were related to OOP? If so, I don't think they were deserved. Commented May 21, 2012 at 14:49

1 Answer 1

1

http://us.php.net/manual/en/function.error-reporting.php

Put this at the top of the page that includes your class.

<?php
error_reporting(E_ALL);
?>
Sign up to request clarification or add additional context in comments.

1 Comment

Id originally added this error reporting inside the class and not inside the page that includes the class. I have moved it and it seems to be working. Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.