ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
+ 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 563 of file CAS.php.

References $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_File\write(), CAS_PGTStorage_AbstractStorage\write(), and CAS_PGTStorage_Db\write().

564  {
566  $dbg = debug_backtrace();
567  $function = '?';
568  $file = '?';
569  $line = '?';
570  if (is_array($dbg)) {
571  for ($i = 1; $i < sizeof($dbg); $i++) {
572  if (is_array($dbg[$i]) && isset($dbg[$i]['class'])) {
573  if ($dbg[$i]['class'] == __CLASS__) {
574  $function = $dbg[$i]['function'];
575  $file = $dbg[$i]['file'];
576  $line = $dbg[$i]['line'];
577  }
578  }
579  }
580  }
581  if (self::$_PHPCAS_VERBOSE) {
582  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";
583  } else {
584  echo "<br />\n<b>Error</b>: <font color=\"FF0000\"><b>" . DEFAULT_ERROR . "</b><br />\n";
585  }
586  phpCAS :: trace($msg . ' in ' . $file . 'on line ' . $line);
588 
589  throw new CAS_GracefullTerminationException(__CLASS__ . "::" . $function . '(): ' . $msg);
590  }
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:658
static trace($str)
This method is used to log something in debug mode.
Definition: CAS.php:599
static traceBegin()
This method is used to indicate the start of the execution of a function in debug mode...
Definition: CAS.php:611
$i
Definition: disco.tpl.php:19
+ 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.

249 {
250  if (!empty($_ENV['TMP'])) {
251  return realpath($_ENV['TMP']);
252  }
253  if (!empty($_ENV['TMPDIR'])) {
254  return realpath($_ENV['TMPDIR']);
255  }
256  if (!empty($_ENV['TEMP'])) {
257  return realpath($_ENV['TEMP']);
258  }
259  return "/tmp";
260 }

◆ getVerbose()

static phpCAS::getVerbose ( )
static

Show is verbose mode is on.

Returns
boot verbose

Definition at line 518 of file CAS.php.

519  {
520  return self::$_PHPCAS_VERBOSE;
521  }

◆ log()

static phpCAS::log (   $str)
static

Logs a string in debug mode.

Parameters
string$strthe string to write
Returns
void

Definition at line 531 of file CAS.php.

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

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

532  {
533  $indent_str = ".";
534 
535 
536  if (!empty(self::$_PHPCAS_DEBUG['filename'])) {
537  // Check if file exists and modifiy file permissions to be only
538  // readable by the webserver
539  if (!file_exists(self::$_PHPCAS_DEBUG['filename'])) {
540  touch(self::$_PHPCAS_DEBUG['filename']);
541  // Chmod will fail on windows
542  @chmod(self::$_PHPCAS_DEBUG['filename'], 0600);
543  }
544  for ($i = 0; $i < self::$_PHPCAS_DEBUG['indent']; $i++) {
545  $indent_str .= '| ';
546  }
547  // allow for multiline output with proper identing. Usefull for
548  // dumping cas answers etc.
549  $str2 = str_replace("\n", "\n" . self::$_PHPCAS_DEBUG['unique_id'] . ' ' . $indent_str, $str);
550  error_log(self::$_PHPCAS_DEBUG['unique_id'] . ' ' . $indent_str . $str2 . "\n", 3, self::$_PHPCAS_DEBUG['filename']);
551  }
552  }
$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 462 of file CAS.php.

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

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

463  {
464  if ($filename != false && gettype($filename) != 'string') {
465  phpCAS :: error('type mismatched for parameter $dbg (should be false or the name of the log file)');
466  }
467  if ($filename === false) {
468  self::$_PHPCAS_DEBUG['filename'] = false;
469  } else {
470  if (empty($filename)) {
471  if (preg_match('/^Win.*/', getenv('OS'))) {
472  if (isset($_ENV['TMP'])) {
473  $debugDir = $_ENV['TMP'] . '/';
474  } else {
475  $debugDir = '';
476  }
477  } else {
478  $debugDir = DEFAULT_DEBUG_DIR;
479  }
480  $filename = $debugDir . 'phpCAS.log';
481  }
482 
483  if (empty(self::$_PHPCAS_DEBUG['unique_id'])) {
484  self::$_PHPCAS_DEBUG['unique_id'] = substr(strtoupper(md5(uniqid(''))), 0, 4);
485  }
486 
487  self::$_PHPCAS_DEBUG['filename'] = $filename;
488  self::$_PHPCAS_DEBUG['indent'] = 0;
489 
490  phpCAS :: trace('START (' . date("Y-m-d H:i:s") . ') phpCAS-' . PHPCAS_VERSION . ' ******************');
491  }
492  }
static error($msg)
This method is used by interface methods to print an error and where the function was originally call...
Definition: CAS.php:563
static trace($str)
This method is used to log something in debug mode.
Definition: CAS.php:599
const DEFAULT_DEBUG_DIR
Definition: CAS.php:261
$filename
Definition: buildRTE.php:89
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 503 of file CAS.php.

References $verbose.

Referenced by ilAuthProviderCAS\doAuthentication().

504  {
505  if ($verbose === true) {
506  self::$_PHPCAS_VERBOSE = true;
507  } else {
508  self::$_PHPCAS_VERBOSE = false;
509  }
510  }
$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 599 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().

600  {
601  $dbg = debug_backtrace();
602  phpCAS :: log($str . ' [' . basename($dbg[0]['file']) . ':' . $dbg[0]['line'] . ']');
603  }
static log($str)
Logs a string in debug mode.
Definition: CAS.php:531
+ 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 611 of file CAS.php.

References $index, and phpCAS\log().

Referenced by CAS_AuthenticationException\__construct(), CAS_PGTStorage_AbstractStorage\__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().

612  {
613  $dbg = debug_backtrace();
614  $str = '=> ';
615  if (!empty($dbg[1]['class'])) {
616  $str .= $dbg[1]['class'] . '::';
617  }
618  $str .= $dbg[1]['function'] . '(';
619  if (is_array($dbg[1]['args'])) {
620  foreach ($dbg[1]['args'] as $index => $arg) {
621  if ($index != 0) {
622  $str .= ', ';
623  }
624  if (is_object($arg)) {
625  $str .= get_class($arg);
626  } else {
627  $str .= str_replace(array("\r\n", "\n", "\r"), "", var_export($arg, true));
628  }
629  }
630  }
631  if (isset($dbg[1]['file'])) {
632  $file = basename($dbg[1]['file']);
633  } else {
634  $file = 'unknown_file';
635  }
636  if (isset($dbg[1]['line'])) {
637  $line = $dbg[1]['line'];
638  } else {
639  $line = 'unknown_line';
640  }
641  $str .= ') [' . $file . ':' . $line . ']';
642  phpCAS :: log($str);
643  if (!isset(self::$_PHPCAS_DEBUG['indent'])) {
644  self::$_PHPCAS_DEBUG['indent'] = 0;
645  } else {
646  self::$_PHPCAS_DEBUG['indent']++;
647  }
648  }
$index
Definition: metadata.php:60
static log($str)
Logs a string in debug mode.
Definition: CAS.php:531
+ 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 658 of file CAS.php.

References $res, 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().

659  {
660  if (empty(self::$_PHPCAS_DEBUG['indent'])) {
661  self::$_PHPCAS_DEBUG['indent'] = 0;
662  } else {
663  self::$_PHPCAS_DEBUG['indent']--;
664  }
665  $dbg = debug_backtrace();
666  $str = '';
667  if (is_object($res)) {
668  $str .= '<= ' . get_class($res);
669  } else {
670  $str .= '<= ' . str_replace(array("\r\n", "\n", "\r"), "", var_export($res, true));
671  }
672 
673  phpCAS :: log($str);
674  }
static log($str)
Logs a string in debug mode.
Definition: CAS.php:531
foreach($_POST as $key=> $value) $res
+ 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 681 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().

682  {
683  phpCAS :: log('exit()');
684  while (self::$_PHPCAS_DEBUG['indent'] > 0) {
685  phpCAS :: log('-');
686  self::$_PHPCAS_DEBUG['indent']--;
687  }
688  }
static log($str)
Logs a string in debug mode.
Definition: CAS.php:531
+ 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 261 of file CAS.php.

Referenced by phpCAS\setDebug().