BUGFIX Making status description in Debug::friendlyError() compatible to HTTP 1.1 spec (removing any markup and newlines)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@106867 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-06-22 02:40:28 +00:00 committed by Sam Minnee
parent 42ee289493
commit 4eb8a346a8

View File

@ -317,7 +317,14 @@ class Debug {
if(!$friendlyErrorMessage) $friendlyErrorMessage = self::$friendly_error_header;
if(!$friendlyErrorDetail) $friendlyErrorDetail = self::$friendly_error_detail;
if(!headers_sent()) header($_SERVER['SERVER_PROTOCOL'] . " $statusCode $friendlyErrorMessage");
if(!headers_sent()) {
header(sprintf('%s %d %s',
$_SERVER['SERVER_PROTOCOL'],
$statusCode,
// Ensure the error message complies with the HTTP 1.1 spec
strip_tags(str_replace(array("\n", "\r"), '', $friendlyErrorMessage))
));
}
if(Director::is_ajax()) {
echo $friendlyErrorMessage;