Skip to content
Snippets Groups Projects
Commit 489f45e7 authored by Andreas Åkre Solberg's avatar Andreas Åkre Solberg
Browse files

Debugging missing parameters and adding debug backtrace on output

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1239 44740490-163a-0410-bde0-09ae8108e29a
parent bdb15033
No related branches found
No related tags found
No related merge requests found
...@@ -43,6 +43,15 @@ class sspmod_ldapstatus_LDAPTester { ...@@ -43,6 +43,15 @@ class sspmod_ldapstatus_LDAPTester {
} }
private function checkParameter($conf, $req) {
$res = $this->checkConfig($conf, array($req));
if ($res[0]) {
return 'Parameter [' . $req . '] found';
} else {
return 'Parameter [' . $req . '] NOT found';
}
}
private function log($str) { private function log($str) {
if ($this->debugOutput) { if ($this->debugOutput) {
echo '<p>' . $str; echo '<p>' . $str;
...@@ -85,7 +94,12 @@ class sspmod_ldapstatus_LDAPTester { ...@@ -85,7 +94,12 @@ class sspmod_ldapstatus_LDAPTester {
$result['time'] = microtime(TRUE) - $start; $result['time'] = microtime(TRUE) - $start;
return $result; return $result;
} }
$this->log($this->checkParameter($this->orgconfig, 'adminUser'));
$this->log($this->checkParameter($this->orgconfig, 'adminPassword'));
$this->log($this->checkParameter($this->orgconfig, 'testUser'));
$this->log($this->checkParameter($this->orgconfig, 'testPassword'));
$urldef = explode(' ', $this->orgconfig['hostname']); $urldef = explode(' ', $this->orgconfig['hostname']);
$url = parse_url($urldef[0]); $url = parse_url($urldef[0]);
$port = 389; $port = 389;
...@@ -95,6 +109,9 @@ class sspmod_ldapstatus_LDAPTester { ...@@ -95,6 +109,9 @@ class sspmod_ldapstatus_LDAPTester {
$this->log('ldapstatus Url parse [' . $this->orgconfig['hostname'] . '] => [' . $url['host'] . ']:[' . $port . ']' ); $this->log('ldapstatus Url parse [' . $this->orgconfig['hostname'] . '] => [' . $url['host'] . ']:[' . $port . ']' );
$result['ping'] = $this->phpping($url['host'], $port); $result['ping'] = $this->phpping($url['host'], $port);
if (!$result['ping'][0]) { if (!$result['ping'][0]) {
......
...@@ -11,25 +11,39 @@ if (!$session->isValid('login-admin') ) { ...@@ -11,25 +11,39 @@ if (!$session->isValid('login-admin') ) {
} }
function myErrorHandler($errno, $errstr, $errfile, $errline) { function backtrace() {
return join(' - ', debug_backtrace());
switch ($errno) { }
case E_USER_ERROR:
echo('<p>PHP_ERROR : [' . $errno . '] ' . $errstr . '. Fatal error on line ' . $errline . ' in file ' . $errfile);
break;
case E_USER_WARNING: function myErrorHandler($errno, $errstr, $errfile, $errline) {
echo('<p>PHP_WARNING : [' . $errno . '] ' . $errstr . '. Warning on line ' . $errline . ' in file ' . $errfile);
break;
case E_USER_NOTICE:
echo('<p>PHP_WARNING : [' . $errno . '] ' . $errstr . '. Warning on line ' . $errline . ' in file ' . $errfile);
break;
default: echo('<div style="border: 1px dotted #ccc; margin: .3em; padding: .4em;">');
echo('<p>PHP_UNKNOWN : [' . $errno . '] ' . $errstr . '. Unknown error on line ' . $errline . ' in file ' . $errfile); switch ($errno) {
break; case E_USER_ERROR:
echo('<p>PHP_ERROR : [' . $errno . '] ' . $errstr . '. Fatal error on line ' . $errline . ' in file ' . $errfile);
break;
case E_USER_WARNING:
echo('<p>PHP_WARNING : [' . $errno . '] ' . $errstr . '. Warning on line ' . $errline . ' in file ' . $errfile);
break;
case E_USER_NOTICE:
echo('<p>PHP_WARNING : [' . $errno . '] ' . $errstr . '. Warning on line ' . $errline . ' in file ' . $errfile);
break;
default:
echo('<p>PHP_UNKNOWN : [' . $errno . '] ' . $errstr . '. Unknown error on line ' . $errline . ' in file ' . $errfile);
break;
} }
# echo('<div style="font-style:monospace; font-size: x-small; margin: 1em; color: #966"><li>' . join('</li><li>', debug_backtrace()) . '</li></div>');
echo('<pre style="font-style:monospace; font-size: small; margin: 1em; color: #966">');
echo(debug_print_backtrace());
echo('</pre>');
echo('</div>');
flush(); flush();
/* Don't execute PHP internal error handler */ /* Don't execute PHP internal error handler */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment