Browse Source

#659 exception handling producing notices, hence causing confusion

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@2625 a333f486-631f-4898-b8df-5754b55c2be0
romainq 12 năm trước cách đây
mục cha
commit
ca4f4a5433
2 tập tin đã thay đổi với 9 bổ sung2 xóa
  1. 1 0
      setup/ajax.dataloader.php
  2. 8 2
      setup/applicationinstaller.class.inc.php

+ 1 - 0
setup/ajax.dataloader.php

@@ -79,6 +79,7 @@ function FatalErrorCatcher($sOutput)
 	if ( preg_match('|<phpfatalerror>.*</phpfatalerror>|s', $sOutput, $aMatches) )
 	{
 		header("HTTP/1.0 500 Internal server error.");
+		$errors = '';
 		foreach ($aMatches as $sMatch)
 		{
 			$errors .= strip_tags($sMatch)."\n";

+ 8 - 2
setup/applicationinstaller.class.inc.php

@@ -375,11 +375,17 @@ class ApplicationInstaller
 			
 			SetupPage::log_error('An exception occurred: '.$e->getMessage().' at line '.$e->getLine().' in file '.$e->getFile());
 			$idx = 0;
-			// Log the call stack, but log the parameters since they may contain passwords or other sensitive data
+			// Log the call stack, but not the parameters since they may contain passwords or other sensitive data
 			SetupPage::log("Call stack:");
 			foreach($e->getTrace() as $aTrace)
 			{
-				SetupPage::log("#$idx {$aTrace['file']}({$aTrace['line']}): {$aTrace['function']}(...)");
+				$sLine = empty($aTrace['line']) ? "" : $aTrace['line'];
+				$sFile = empty($aTrace['file']) ? "" : $aTrace['file'];
+				$sClass = empty($aTrace['class']) ? "" : $aTrace['class'];
+				$sType = empty($aTrace['type']) ? "" : $aTrace['type'];
+				$sFunction = empty($aTrace['function']) ? "" : $aTrace['function'];
+				$sVerb = empty($sClass) ? $sFunction : "$sClass{$sType}$sFunction";
+				SetupPage::log("#$idx $sFile($sLine): $sVerb(...)");
 				$idx++;
 			}
 		}