Menu

#17 $debug variable for troubleshooting

None
closed
None
2014-09-10
2014-06-05
Alexander
No

I appended $debug variable in config.php like so:

$debug = true;

error_reporting(0);
if($debug) error_reporting(E_ALL);

Discussion

  • Alexander

    Alexander - 2014-06-05

    oh, i created ticket too fast )
    this variable has no effect, 'cause there are several error_reporting settings in the code already.
    maybe create one error reporting setting for all code?

     
  • James Turner

    James Turner - 2014-06-22

    There are two sequences of code where the error_reporting() value
    is briefly changed to 0, then back to its previous setting:

    $old_error_reporting=error_reporting();
    error_reporting(0);
    
    // Do LDAP operation that might fail
    
    error_reporting($old_error_reporting);
    
    // Do something with the result of the LDAP operation,
    // if it succeeded
    

    The two code sequences in question are:

    • in index.php - displays LDAP records if successfully returned
      from a call to ldap_list() or ldap_search()

    • in function log_on_to_directory($ldap_link), utils.php - attempt
      ldap_bind() as the appropriate LDAP user and returns whether
      or not it worked

    These LDAP functions all return false if there was an error. As the original value of error_reporting() is saved and restored each time, I would expect your debugging to work as you wish other than within these small sections.

    The code would be stylistically better (in my opinion) if the
    above LDAP functions were prefixed with @ (see:
    http://www.php.net//manual/en/language.operators.errorcontrol.php)
    rather than changing the value of error_reporting(), and I would
    be inclined to do this for the next version. Would this change
    sufficiently address your debugging issue?

     

    Last edit: James Turner 2014-06-22
  • Alexander

    Alexander - 2014-06-30

    Cool, thanks!

     
  • James Turner

    James Turner - 2014-07-04
    • status: open --> pending
    • assigned_to: James Turner
    • Milestone: -->
     
  • James Turner

    James Turner - 2014-09-10

    All code that changes error_reporting() has been removed as of version 0.13.

     
  • James Turner

    James Turner - 2014-09-10
    • status: pending --> closed
     

Log in to post a comment.