diff --git a/control/HTTPResponse.php b/control/HTTPResponse.php index c952c9306..0b7f4c06f 100644 --- a/control/HTTPResponse.php +++ b/control/HTTPResponse.php @@ -66,12 +66,12 @@ class SS_HTTPResponse { ); /** - * @var Int + * @var int */ protected $statusCode = 200; /** - * @var String + * @var string */ protected $statusDescription = "OK"; @@ -93,9 +93,9 @@ class SS_HTTPResponse { /** * Create a new HTTP response * - * @param $body The body of the response - * @param $statusCode The numeric status code - 200, 404, etc - * @param $statusDescription The text to be given alongside the status code. + * @param string $body The body of the response + * @param int $statusCode The numeric status code - 200, 404, etc + * @param string $statusDescription The text to be given alongside the status code. * See {@link setStatusCode()} for more information. */ public function __construct($body = null, $statusCode = null, $statusDescription = null) { @@ -104,12 +104,12 @@ class SS_HTTPResponse { } /** - * @param String $code - * @param String $description Optional. See {@link setStatusDescription()}. + * @param int $code + * @param string $description Optional. See {@link setStatusDescription()}. * No newlines are allowed in the description. * If omitted, will default to the standard HTTP description * for the given $code value (see {@link $status_codes}). - * @return SS_HTTPRequest $this + * @return $this */ public function setStatusCode($code, $description = null) { if(isset(self::$status_codes[$code])) $this->statusCode = $code; @@ -124,8 +124,8 @@ class SS_HTTPResponse { * The text to be given alongside the status code ("reason phrase"). * Caution: Will be overwritten by {@link setStatusCode()}. * - * @param String $description - * @return SS_HTTPRequest $this + * @param string $description + * @return $this */ public function setStatusDescription($description) { $this->statusDescription = $description; @@ -133,7 +133,7 @@ class SS_HTTPResponse { } /** - * @return Int + * @return int */ public function getStatusCode() { return $this->statusCode; @@ -157,7 +157,7 @@ class SS_HTTPResponse { /** * @param string $body - * @return SS_HTTPRequest $this + * @return $this */ public function setBody($body) { $this->body = $body ? (string) $body : $body; // Don't type-cast false-ish values, eg null is null not '' @@ -176,7 +176,7 @@ class SS_HTTPResponse { * * @param string $header Example: "Content-Type" * @param string $value Example: "text/xml" - * @return SS_HTTPRequest $this + * @return $this */ public function addHeader($header, $value) { $this->headers[$header] = $value; @@ -206,7 +206,7 @@ class SS_HTTPResponse { * e.g. "Content-Type". * * @param string $header - * @return SS_HTTPRequest $this + * @return $this */ public function removeHeader($header) { if(isset($this->headers[$header])) unset($this->headers[$header]); @@ -216,7 +216,7 @@ class SS_HTTPResponse { /** * @param string $dest * @param int $code - * @return SS_HTTPRequest $this + * @return $this */ public function redirect($dest, $code=302) { if(!in_array($code, self::$redirect_codes)) $code = 302; @@ -310,12 +310,17 @@ EOT */ class SS_HTTPResponse_Exception extends Exception { + /** + * @var SS_HTTPResponse + */ protected $response; /** * @param string|SS_HTTPResponse body Either the plaintext content of the error message, or an SS_HTTPResponse * object representing it. In either case, the $statusCode and * $statusDescription will be the HTTP status of the resulting response. + * @param int $statusCode + * @param string $statusDescription * @see SS_HTTPResponse::__construct(); */ public function __construct($body = null, $statusCode = null, $statusDescription = null) { diff --git a/dev/SapphireTest.php b/dev/SapphireTest.php index b91286929..f48181885 100644 --- a/dev/SapphireTest.php +++ b/dev/SapphireTest.php @@ -192,8 +192,6 @@ class SapphireTest extends PHPUnit_Framework_TestCase { // i18n needs to be set to the defaults or tests fail i18n::set_locale(i18n::default_locale()); - i18n::config()->date_format = null; - i18n::config()->time_format = null; // Set default timezone consistently to avoid NZ-specific dependencies date_default_timezone_set('UTC'); diff --git a/model/Versioned.php b/model/Versioned.php index 92eb7bb4a..4b6968b03 100644 --- a/model/Versioned.php +++ b/model/Versioned.php @@ -313,7 +313,7 @@ class Versioned extends DataExtension implements TemplateGlobalProvider { // Ensure that any sort order referring to this ID is correctly aliased $orders = $query->getOrderBy(); foreach($orders as $order => $dir) { - if($order === "\"$baseTable\".\"ID\"") { + if($order === "\"$baseTable\".\"ID\"" || trim($order, "'\"") === "ID") { unset($orders[$order]); $orders["\"{$baseTable}_versions\".\"RecordID\""] = $dir; }