diff --git a/src/aphront/handler/PhabricatorDefaultRequestExceptionHandler.php b/src/aphront/handler/PhabricatorDefaultRequestExceptionHandler.php --- a/src/aphront/handler/PhabricatorDefaultRequestExceptionHandler.php +++ b/src/aphront/handler/PhabricatorDefaultRequestExceptionHandler.php @@ -42,7 +42,14 @@ } $class = get_class($throwable); - $message = $throwable->getMessage(); + + // Include last location in error message: Get absolute Phorge path, strip + // its /webroot, and remove it as path prefix not to expose server details + $root_dir_len = strlen(substr(realpath($_SERVER['DOCUMENT_ROOT']), 0, + -15)); + $filename = substr($throwable->getFile(), $root_dir_len); + $message = $throwable->getMessage().' at ['.$filename.':'. + $throwable->getLine().']'; if ($throwable instanceof AphrontSchemaQueryException) { $message .= "\n\n".pht(