diff --git a/lib/Cake/Controller/Controller.php b/lib/Cake/Controller/Controller.php index 20d5e7843..19e54692d 100644 --- a/lib/Cake/Controller/Controller.php +++ b/lib/Cake/Controller/Controller.php @@ -712,7 +712,7 @@ class Controller extends CakeObject implements CakeEventListener { * 800 => 'Unexpected Minotaur' * )); // sets these new values, and returns true * - * @return array Associative array of the HTTP codes as keys, and the message + * @return array|null|true Associative array of the HTTP codes as keys, and the message * strings as values, or null of the given $code does not exist. * @deprecated 3.0.0 Since 2.4. Will be removed in 3.0. Use CakeResponse::httpCodes(). */ @@ -757,7 +757,7 @@ class Controller extends CakeObject implements CakeEventListener { * * @param string|array $url A string or array-based URL pointing to another location within the app, * or an absolute URL - * @param int|array|null $status HTTP status code (eg: 301). Defaults to 302 when null is passed. + * @param int|array|null|string $status HTTP status code (eg: 301). Defaults to 302 when null is passed. * @param bool $exit If true, exit() will be called after the redirect * @return CakeResponse|null * @triggers Controller.beforeRedirect $this, array($url, $status, $exit) @@ -905,7 +905,7 @@ class Controller extends CakeObject implements CakeEventListener { * * `$errors = $this->validateErrors($this->Article, $this->User);` * - * @return array Validation errors, or false if none + * @return array|false Validation errors, or false if none * @deprecated 3.0.0 This method will be removed in 3.0 */ public function validateErrors() { diff --git a/lib/Cake/Network/CakeResponse.php b/lib/Cake/Network/CakeResponse.php index 5e1df6df6..4aa7eb076 100644 --- a/lib/Cake/Network/CakeResponse.php +++ b/lib/Cake/Network/CakeResponse.php @@ -374,7 +374,7 @@ class CakeResponse { * Holds all the cache directives that will be converted * into headers when sending the request * - * @var string + * @var array */ protected $_cacheDirectives = array(); @@ -672,8 +672,9 @@ class CakeResponse { * * For more on HTTP status codes see: http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html#sec6.1 * - * @return mixed associative array of the HTTP codes as keys, and the message - * strings as values, or null of the given $code does not exist. + * @return array|null|true associative array of the HTTP codes as keys, and the message + * strings as values, or null of the given $code does not exist. `true` if `$code` is + * an array of valid codes. * @throws CakeException If an attempt is made to add an invalid status code */ public function httpCodes($code = null) { @@ -717,7 +718,7 @@ class CakeResponse { * * e.g `type(array('jpg' => 'text/plain'));` * - * @param string $contentType Content type key. + * @param array|string $contentType Content type key. * @return mixed current content type or false if supplied an invalid content type */ public function type($contentType = null) { @@ -854,7 +855,7 @@ class CakeResponse { } $this->maxAge($time); - if (!$time) { + if ($time === null) { $this->_setCacheControl(); } return (bool)$public; @@ -1160,7 +1161,11 @@ class CakeResponse { * @return bool whether the response was marked as not modified or not. */ public function checkNotModified(CakeRequest $request) { - $etags = preg_split('/\s*,\s*/', $request->header('If-None-Match'), null, PREG_SPLIT_NO_EMPTY); + $ifNoneMatchHeader = $request->header('If-None-Match'); + $etags = array(); + if (is_string($ifNoneMatchHeader)) { + $etags = preg_split('/\s*,\s*/', $ifNoneMatchHeader, null, PREG_SPLIT_NO_EMPTY); + } $modifiedSince = $request->header('If-Modified-Since'); $checks = array(); if ($responseTag = $this->etag()) { @@ -1224,7 +1229,7 @@ class CakeResponse { * * `$this->cookie((array) $options)` * - * @param array $options Either null to get all cookies, string for a specific cookie + * @param array|string $options Either null to get all cookies, string for a specific cookie * or array to set cookie. * @return mixed */ @@ -1312,8 +1317,7 @@ class CakeResponse { $result[] = array('preg' => '@.@', 'original' => '*'); continue; } - - $original = $preg = $domain; + $original = $domain; if (strpos($domain, '://') === false) { $preg = ($requestIsSSL ? 'https://' : 'http://') . $domain; } @@ -1464,7 +1468,7 @@ class CakeResponse { $file->open('rb'); $end = $start = false; - if ($range) { + if (!empty($range)) { list($start, $end) = $range; } if ($start !== false) {