GithubHelp home page GithubHelp logo

V4 Debug function about wet-boew-php HOT 2 OPEN

wet-boew avatar wet-boew commented on July 19, 2024
V4 Debug function

from wet-boew-php.

Comments (2)

upsonp avatar upsonp commented on July 19, 2024

@michael-milette How do you handle it?

You have much more refined error reporting than I have. I have the same issue as @crochefort and don't see errors on my page. Might be part of the reason why some little things slip by me.

from wet-boew-php.

michael-milette avatar michael-milette commented on July 19, 2024

Below is some code I came across that might help you. It's from http://motoma.io/turning-on-php-debugging-and-error-messages/. I slightly modified the code to fix errors (mostly brace issues).

     <?php
     $DEBUGGING = True;
     $TRACECOUNT = 0;

     if($DEBUGGING) {
         error_reporting(E_ALL);
         ini_set('display_errors', True);
     }

     function trace($message) {
         global $DEBUGGING;
         global $TRACECOUNT;
         if($DEBUGGING) {
             echo '<hr />;'.$TRACECOUNT++.'<code>'.$message.'</code><hr />';
         }
     }

     function tarr($arr) {
         global $DEBUGGING; 
         global $TRACECOUNT; 
         if($DEBUGGING) { 
             echo '<hr />'.$TRACECOUNT++.'<code>'; 
             print_r($arr); 
             echo '</code><hr />'; 
         } 
     } 

     ?>

Include it at the top of in your config/config.php file to enable debugging. In addition, you can call the trace() and tarr() functions within your code to help in your debugging efforts:

NOTE: One of the problems you might be having is a result of the use of:

=> include and include_once: Will only produce a warning if it fails (not visible with debugging turned off)

...instead of...

=> require and require_once: Will cause an error if it fails.

Hope that helps.

Michael Milette

from wet-boew-php.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.