ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
+ Collaboration diagram for Debugging:

Functions

 gettmpdir ()
 The default directory for the debug file under Unix. More...
 
static phpCAS::setDebug ($filename='')
 Set/unset debug mode. More...
 
static phpCAS::setVerbose ($verbose)
 Enable verbose errors messages in the website output This is a security relevant since internal status info may leak an may help an attacker. More...
 
static phpCAS::getVerbose ()
 Show is verbose mode is on. More...
 
static phpCAS::log ($str)
 Logs a string in debug mode. More...
 
static phpCAS::error ($msg)
 This method is used by interface methods to print an error and where the function was originally called from. More...
 
static phpCAS::trace ($str)
 This method is used to log something in debug mode. More...
 
static phpCAS::traceBegin ()
 This method is used to indicate the start of the execution of a function in debug mode. More...
 
static phpCAS::traceEnd ($res='')
 This method is used to indicate the end of the execution of a function in debug mode. More...
 
static phpCAS::traceExit ()
 This method is used to indicate the end of the execution of the program. More...
 

Variables

const DEFAULT_DEBUG_DIR gettmpdir()."/"
 

Detailed Description

Function Documentation

◆ error()

static phpCAS::error (   $msg)
static

This method is used by interface methods to print an error and where the function was originally called from.

Parameters
string$msgthe message to print
Returns
void

Definition at line 543 of file CAS.php.

References $file, $function, $i, DEFAULT_ERROR, phpCAS\trace(), phpCAS\traceBegin(), and phpCAS\traceEnd().

Referenced by CAS_PGTStorage_AbstractStorage\__construct(), CAS_PGTStorage_File\__construct(), CAS_Client\__construct(), CAS_Client\_callback(), CAS_Client\_getUser(), CAS_Client\_readURL(), phpCAS\addRebroadcastHeader(), phpCAS\addRebroadcastNode(), phpCAS\allowProxyChain(), phpCAS\client(), CAS_PGTStorage_Db\createTable(), phpCAS\getAttribute(), CAS_Client\getAttributes(), phpCAS\getAttributes(), phpCAS\getProxiedService(), CAS_PGTStorage_AbstractStorage\getStorageInfo(), CAS_PGTStorage_AbstractStorage\getStorageType(), phpCAS\getUser(), CAS_Client\handleLogoutRequests(), phpCAS\hasAttribute(), phpCAS\hasAttributes(), CAS_PGTStorage_Db\init(), phpCAS\initializeProxiedService(), phpCAS\logout(), CAS_Client\logout(), phpCAS\logoutWithRedirectService(), phpCAS\logoutWithRedirectServiceAndUrl(), phpCAS\logoutWithUrl(), phpCAS\proxy(), CAS_PGTStorage_AbstractStorage\read(), CAS_PGTStorage_File\read(), phpCAS\retrievePT(), phpCAS\serviceMail(), phpCAS\serviceWeb(), phpCAS\setCacheTimesForAuthRecheck(), phpCAS\setCasServerCACert(), phpCAS\setDebug(), phpCAS\setFixedCallbackURL(), phpCAS\setFixedServiceURL(), phpCAS\setHTMLFooter(), phpCAS\setHTMLHeader(), phpCAS\setLang(), phpCAS\setPGTStorage(), CAS_Client\setPGTStorage(), phpCAS\setPGTStorageDb(), phpCAS\setPGTStorageFile(), phpCAS\setServerLoginURL(), phpCAS\setServerLogoutURL(), phpCAS\setServerProxyValidateURL(), phpCAS\setServerSamlValidateURL(), phpCAS\setServerServiceValidateURL(), CAS_PGTStorage_AbstractStorage\write(), CAS_PGTStorage_File\write(), and CAS_PGTStorage_Db\write().

544  {
546  $dbg = debug_backtrace();
547  $function = '?';
548  $file = '?';
549  $line = '?';
550  if (is_array($dbg)) {
551  for ($i = 1; $i < sizeof($dbg); $i++) {
552  if (is_array($dbg[$i]) && isset($dbg[$i]['class']) ) {
553  if ($dbg[$i]['class'] == __CLASS__) {
554  $function = $dbg[$i]['function'];
555  $file = $dbg[$i]['file'];
556  $line = $dbg[$i]['line'];
557  }
558  }
559  }
560  }
561  if (self::$_PHPCAS_VERBOSE) {
562  echo "<br />\n<b>phpCAS error</b>: <font color=\"FF0000\"><b>" . __CLASS__ . "::" . $function . '(): ' . htmlentities($msg) . "</b></font> in <b>" . $file . "</b> on line <b>" . $line . "</b><br />\n";
563  } else {
564  echo "<br />\n<b>Error</b>: <font color=\"FF0000\"><b>". DEFAULT_ERROR ."</b><br />\n";
565  }
566  phpCAS :: trace($msg . ' in ' . $file . 'on line ' . $line );
568 
569  throw new CAS_GracefullTerminationException(__CLASS__ . "::" . $function . '(): ' . $msg);
570  }
const DEFAULT_ERROR
SAML Attributes.
Definition: CAS.php:142
static traceEnd($res='')
This method is used to indicate the end of the execution of a function in debug mode.
Definition: CAS.php:638
static trace($str)
This method is used to log something in debug mode.
Definition: CAS.php:579
static traceBegin()
This method is used to indicate the start of the execution of a function in debug mode...
Definition: CAS.php:591
$function
Definition: cas.php:28
$i
Definition: disco.tpl.php:19
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gettmpdir()

gettmpdir ( )

The default directory for the debug file under Unix.

Definition at line 248 of file CAS.php.

248  {
249 if (!empty($_ENV['TMP'])) { return realpath($_ENV['TMP']); }
250 if (!empty($_ENV['TMPDIR'])) { return realpath( $_ENV['TMPDIR']); }
251 if (!empty($_ENV['TEMP'])) { return realpath( $_ENV['TEMP']); }
252 return "/tmp";
253 }

◆ getVerbose()

static phpCAS::getVerbose ( )
static

Show is verbose mode is on.

Returns
boot verbose

Definition at line 496 of file CAS.php.

497  {
498  return self::$_PHPCAS_VERBOSE;
499  }

◆ log()

static phpCAS::log (   $str)
static

Logs a string in debug mode.

Parameters
string$strthe string to write
Returns
void

Definition at line 509 of file CAS.php.

References $i, and Monolog\Handler\error_log().

Referenced by phpCAS\addRebroadcastNode(), phpCAS\trace(), phpCAS\traceBegin(), phpCAS\traceEnd(), and phpCAS\traceExit().

510  {
511  $indent_str = ".";
512 
513 
514  if (!empty(self::$_PHPCAS_DEBUG['filename'])) {
515  // Check if file exists and modifiy file permissions to be only
516  // readable by the webserver
517  if (!file_exists(self::$_PHPCAS_DEBUG['filename'])) {
518  touch(self::$_PHPCAS_DEBUG['filename']);
519  // Chmod will fail on windows
520  @chmod(self::$_PHPCAS_DEBUG['filename'], 0600);
521  }
522  for ($i = 0; $i < self::$_PHPCAS_DEBUG['indent']; $i++) {
523 
524  $indent_str .= '| ';
525  }
526  // allow for multiline output with proper identing. Usefull for
527  // dumping cas answers etc.
528  $str2 = str_replace("\n", "\n" . self::$_PHPCAS_DEBUG['unique_id'] . ' ' . $indent_str, $str);
529  error_log(self::$_PHPCAS_DEBUG['unique_id'] . ' ' . $indent_str . $str2 . "\n", 3, self::$_PHPCAS_DEBUG['filename']);
530  }
531 
532  }
$i
Definition: disco.tpl.php:19
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDebug()

static phpCAS::setDebug (   $filename = '')
static

Set/unset debug mode.

Parameters
string$filenamethe name of the file used for logging, or false to stop debugging.
Returns
void

Definition at line 439 of file CAS.php.

References $filename, date, DEFAULT_DEBUG_DIR, phpCAS\error(), PHPCAS_VERSION, and phpCAS\trace().

Referenced by ilAuthProviderCAS\doAuthentication(), and ilAuthContainerCAS\initCAS().

440  {
441  if ($filename != false && gettype($filename) != 'string') {
442  phpCAS :: error('type mismatched for parameter $dbg (should be false or the name of the log file)');
443  }
444  if ($filename === false) {
445  self::$_PHPCAS_DEBUG['filename'] = false;
446 
447  } else {
448  if (empty ($filename)) {
449  if (preg_match('/^Win.*/', getenv('OS'))) {
450  if (isset ($_ENV['TMP'])) {
451  $debugDir = $_ENV['TMP'] . '/';
452  } else {
453  $debugDir = '';
454  }
455  } else {
456  $debugDir = DEFAULT_DEBUG_DIR;
457  }
458  $filename = $debugDir . 'phpCAS.log';
459  }
460 
461  if (empty (self::$_PHPCAS_DEBUG['unique_id'])) {
462  self::$_PHPCAS_DEBUG['unique_id'] = substr(strtoupper(md5(uniqid(''))), 0, 4);
463  }
464 
465  self::$_PHPCAS_DEBUG['filename'] = $filename;
466  self::$_PHPCAS_DEBUG['indent'] = 0;
467 
468  phpCAS :: trace('START ('.date("Y-m-d H:i:s").') phpCAS-' . PHPCAS_VERSION . ' ******************');
469  }
470  }
static error($msg)
This method is used by interface methods to print an error and where the function was originally call...
Definition: CAS.php:543
static trace($str)
This method is used to log something in debug mode.
Definition: CAS.php:579
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
const DEFAULT_DEBUG_DIR
Definition: CAS.php:254
const PHPCAS_VERSION(!defined('E_USER_DEPRECATED'))
phpCAS version.
Definition: CAS.php:64
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setVerbose()

static phpCAS::setVerbose (   $verbose)
static

Enable verbose errors messages in the website output This is a security relevant since internal status info may leak an may help an attacker.

Default is therefore false

Parameters
bool$verboseenable verbose output
Returns
void

Definition at line 481 of file CAS.php.

References $verbose.

Referenced by ilAuthProviderCAS\doAuthentication().

482  {
483  if ($verbose === true) {
484  self::$_PHPCAS_VERBOSE = true;
485  } else {
486  self::$_PHPCAS_VERBOSE = false;
487  }
488  }
$verbose
+ Here is the caller graph for this function:

◆ trace()

static phpCAS::trace (   $str)
static

This method is used to log something in debug mode.

Parameters
string$strstring to log
Returns
void

Definition at line 579 of file CAS.php.

References phpCAS\log().

Referenced by CAS_AuthenticationException\__construct(), CAS_Client\__construct(), CAS_Client\_authError(), CAS_Client\_callback(), CAS_Client\_rebroadcast(), CAS_Client\_renameSession(), CAS_Client\_setSessionAttributes(), CAS_Client\_validatePGT(), CAS_Client\_wasPreviouslyAuthenticated(), CAS_Client\checkAuthentication(), CAS_ProxyChain_AllowedList\contains(), phpCAS\error(), CAS_Client\forceAuthentication(), CAS_PGTStorage_File\getPGTIouFilename(), CAS_Client\getURL(), CAS_Client\handleLogoutRequests(), CAS_Request_CurlRequest\initAndConfigure(), CAS_Client\isAuthenticated(), CAS_ProxyChain_AllowedList\isProxyListAllowed(), CAS_Client\logout(), CAS_ProxiedService_Http_Abstract\makeRequest(), CAS_ProxyChain_Any\matches(), CAS_ProxyChain\matches(), CAS_ProxiedService_Imap\open(), CAS_CookieJar\parseCookieHeader(), CAS_PGTStorage_File\read(), CAS_PGTStorage_Db\read(), CAS_Client\redirectToCas(), CAS_Client\renewAuthentication(), CAS_Client\retrievePT(), CAS_Request_CurlRequest\sendRequest(), phpCAS\setDebug(), phpCAS\setNoCasServerValidation(), CAS_CookieJar\storeCookies(), CAS_Client\validateCAS10(), CAS_Client\validateCAS20(), CAS_Client\validateSA(), and CAS_PGTStorage_File\write().

580  {
581  $dbg = debug_backtrace();
582  phpCAS :: log($str . ' [' . basename($dbg[0]['file']) . ':' . $dbg[0]['line'] . ']');
583  }
static log($str)
Logs a string in debug mode.
Definition: CAS.php:509
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ traceBegin()

static phpCAS::traceBegin ( )
static

This method is used to indicate the start of the execution of a function in debug mode.

Returns
void

Definition at line 591 of file CAS.php.

References $file, $index, array, and phpCAS\log().

Referenced by CAS_PGTStorage_AbstractStorage\__construct(), CAS_AuthenticationException\__construct(), CAS_PGTStorage_File\__construct(), CAS_PGTStorage_Db\__construct(), CAS_Client\__construct(), CAS_Client\_authError(), CAS_Client\_buildSAMLPayload(), CAS_Client\_callback(), CAS_Client\_getNodeType(), CAS_Client\_readURL(), CAS_Client\_rebroadcast(), CAS_Client\_renameSession(), CAS_Client\_setSessionAttributes(), CAS_Client\_validatePGT(), CAS_Client\_wasPreviouslyAuthenticated(), phpCAS\addRebroadcastHeader(), phpCAS\addRebroadcastNode(), phpCAS\allowProxyChain(), phpCAS\checkAuthentication(), CAS_Client\checkAuthentication(), phpCAS\client(), CAS_ProxyChain_AllowedList\contains(), CAS_PGTStorage_Db\createTable(), phpCAS\error(), phpCAS\forceAuthentication(), CAS_Client\forceAuthentication(), CAS_PGTStorage_File\getPGTIouFilename(), phpCAS\getProxiedService(), CAS_Client\getServerLoginURL(), CAS_Client\getServerProxyValidateURL(), CAS_Client\getServerSamlValidateURL(), CAS_Client\getServerServiceValidateURL(), CAS_Client\getURL(), CAS_Client\handleLogoutRequests(), CAS_PGTStorage_File\init(), CAS_PGTStorage_Db\init(), phpCAS\isAuthenticated(), CAS_Client\isAuthenticated(), CAS_ProxyChain_AllowedList\isProxyListAllowed(), phpCAS\logout(), CAS_Client\logout(), phpCAS\logoutWithRedirectService(), phpCAS\logoutWithRedirectServiceAndUrl(), phpCAS\logoutWithUrl(), CAS_ProxiedService_Imap\open(), CAS_CookieJar\parseCookieHeaders(), phpCAS\proxy(), CAS_PGTStorage_File\read(), CAS_PGTStorage_Db\read(), CAS_Client\redirectToCas(), phpCAS\renewAuthentication(), CAS_Client\renewAuthentication(), CAS_Client\retrievePT(), CAS_ProxiedService_Http_Abstract\send(), CAS_Request_CurlRequest\sendRequest(), phpCAS\serviceMail(), phpCAS\serviceWeb(), phpCAS\setCasServerCACert(), phpCAS\setExtraCurlOption(), phpCAS\setFixedCallbackURL(), phpCAS\setFixedServiceURL(), CAS_Client\setLang(), phpCAS\setNoCasServerValidation(), phpCAS\setNoClearTicketsFromUrl(), phpCAS\setPGTStorage(), phpCAS\setPGTStorageDb(), phpCAS\setPGTStorageFile(), phpCAS\setServerLoginURL(), phpCAS\setServerLogoutURL(), phpCAS\setServerProxyValidateURL(), phpCAS\setServerSamlValidateURL(), phpCAS\setServerServiceValidateURL(), CAS_Client\validateCAS10(), CAS_Client\validateCAS20(), CAS_PGTStorage_File\write(), and CAS_PGTStorage_Db\write().

592  {
593  $dbg = debug_backtrace();
594  $str = '=> ';
595  if (!empty ($dbg[1]['class'])) {
596  $str .= $dbg[1]['class'] . '::';
597  }
598  $str .= $dbg[1]['function'] . '(';
599  if (is_array($dbg[1]['args'])) {
600  foreach ($dbg[1]['args'] as $index => $arg) {
601  if ($index != 0) {
602  $str .= ', ';
603  }
604  if (is_object($arg)) {
605  $str .= get_class($arg);
606  } else {
607  $str .= str_replace(array("\r\n", "\n", "\r"), "", var_export($arg, true));
608  }
609  }
610  }
611  if (isset($dbg[1]['file'])) {
612  $file = basename($dbg[1]['file']);
613  } else {
614  $file = 'unknown_file';
615  }
616  if (isset($dbg[1]['line'])) {
617  $line = $dbg[1]['line'];
618  } else {
619  $line = 'unknown_line';
620  }
621  $str .= ') [' . $file . ':' . $line . ']';
622  phpCAS :: log($str);
623  if (!isset(self::$_PHPCAS_DEBUG['indent'])) {
624  self::$_PHPCAS_DEBUG['indent'] = 0;
625  } else {
626  self::$_PHPCAS_DEBUG['indent']++;
627  }
628  }
$index
Definition: metadata.php:60
static log($str)
Logs a string in debug mode.
Definition: CAS.php:509
Create styles array
The data for the language used.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ traceEnd()

static phpCAS::traceEnd (   $res = '')
static

This method is used to indicate the end of the execution of a function in debug mode.

Parameters
string$resthe result of the function
Returns
void

Definition at line 638 of file CAS.php.

References $res, array, and phpCAS\log().

Referenced by CAS_PGTStorage_AbstractStorage\__construct(), CAS_PGTStorage_File\__construct(), CAS_PGTStorage_Db\__construct(), CAS_Client\__construct(), CAS_Client\_buildSAMLPayload(), CAS_Client\_getNodeType(), CAS_Client\_readExtraAttributesCas20(), CAS_Client\_readURL(), CAS_Client\_rebroadcast(), CAS_Client\_renameSession(), CAS_Client\_setSessionAttributes(), CAS_Client\_validatePGT(), CAS_Client\_wasPreviouslyAuthenticated(), phpCAS\addRebroadcastHeader(), phpCAS\addRebroadcastNode(), phpCAS\allowProxyChain(), phpCAS\checkAuthentication(), CAS_Client\checkAuthentication(), phpCAS\client(), CAS_ProxyChain_AllowedList\contains(), CAS_PGTStorage_Db\createTable(), phpCAS\error(), phpCAS\forceAuthentication(), CAS_Client\forceAuthentication(), CAS_PGTStorage_File\getPGTIouFilename(), phpCAS\getProxiedService(), CAS_Client\getServerLoginURL(), CAS_Client\getServerProxyValidateURL(), CAS_Client\getServerSamlValidateURL(), CAS_Client\getServerServiceValidateURL(), CAS_Client\getURL(), CAS_Client\handleLogoutRequests(), CAS_PGTStorage_File\init(), CAS_PGTStorage_Db\init(), phpCAS\isAuthenticated(), CAS_Client\isAuthenticated(), CAS_ProxyChain_AllowedList\isProxyListAllowed(), phpCAS\logout(), phpCAS\logoutWithRedirectService(), phpCAS\logoutWithRedirectServiceAndUrl(), phpCAS\logoutWithUrl(), CAS_CookieJar\parseCookieHeaders(), phpCAS\proxy(), CAS_PGTStorage_File\read(), CAS_PGTStorage_Db\read(), phpCAS\renewAuthentication(), CAS_Client\renewAuthentication(), CAS_Client\retrievePT(), CAS_ProxiedService_Http_Abstract\send(), CAS_Request_CurlRequest\sendRequest(), phpCAS\serviceMail(), phpCAS\serviceWeb(), phpCAS\setCasServerCACert(), phpCAS\setExtraCurlOption(), phpCAS\setFixedCallbackURL(), phpCAS\setFixedServiceURL(), CAS_Client\setLang(), phpCAS\setNoCasServerValidation(), phpCAS\setNoClearTicketsFromUrl(), phpCAS\setPGTStorage(), phpCAS\setPGTStorageDb(), phpCAS\setPGTStorageFile(), phpCAS\setServerLoginURL(), phpCAS\setServerLogoutURL(), phpCAS\setServerProxyValidateURL(), phpCAS\setServerSamlValidateURL(), phpCAS\setServerServiceValidateURL(), CAS_Client\validateSA(), CAS_PGTStorage_File\write(), and CAS_PGTStorage_Db\write().

639  {
640  if (empty(self::$_PHPCAS_DEBUG['indent'])) {
641  self::$_PHPCAS_DEBUG['indent'] = 0;
642  } else {
643  self::$_PHPCAS_DEBUG['indent']--;
644  }
645  $dbg = debug_backtrace();
646  $str = '';
647  if (is_object($res)) {
648  $str .= '<= ' . get_class($res);
649  } else {
650  $str .= '<= ' . str_replace(array("\r\n", "\n", "\r"), "", var_export($res, true));
651  }
652 
653  phpCAS :: log($str);
654  }
static log($str)
Logs a string in debug mode.
Definition: CAS.php:509
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ traceExit()

static phpCAS::traceExit ( )
static

This method is used to indicate the end of the execution of the program.

Returns
void

Definition at line 661 of file CAS.php.

References phpCAS\log().

Referenced by CAS_AuthenticationException\__construct(), CAS_Client\_authError(), CAS_Client\_callback(), CAS_Client\handleLogoutRequests(), CAS_Client\isAuthenticated(), CAS_Client\logout(), and CAS_Client\redirectToCas().

662  {
663  phpCAS :: log('exit()');
664  while (self::$_PHPCAS_DEBUG['indent'] > 0) {
665  phpCAS :: log('-');
666  self::$_PHPCAS_DEBUG['indent']--;
667  }
668  }
static log($str)
Logs a string in debug mode.
Definition: CAS.php:509
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ DEFAULT_DEBUG_DIR

const DEFAULT_DEBUG_DIR gettmpdir()."/"

Definition at line 254 of file CAS.php.

Referenced by phpCAS\setDebug().