X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fsymfony%2Fhttp-foundation%2FResponse.php;fp=vendor%2Fsymfony%2Fhttp-foundation%2FResponse.php;h=acc4bb6eab39f4b022cb8f7e2215a313cb1f34bd;hp=65c5fce23f4cfb5569b2a18f46bd81f2775693fc;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/vendor/symfony/http-foundation/Response.php b/vendor/symfony/http-foundation/Response.php index 65c5fce23..acc4bb6ea 100644 --- a/vendor/symfony/http-foundation/Response.php +++ b/vendor/symfony/http-foundation/Response.php @@ -186,6 +186,30 @@ class Response 511 => 'Network Authentication Required', // RFC6585 ); + private static $deprecatedMethods = array( + 'setDate', 'getDate', + 'setExpires', 'getExpires', + 'setLastModified', 'getLastModified', + 'setProtocolVersion', 'getProtocolVersion', + 'setStatusCode', 'getStatusCode', + 'setCharset', 'getCharset', + 'setPrivate', 'setPublic', + 'getAge', 'getMaxAge', 'setMaxAge', 'setSharedMaxAge', + 'getTtl', 'setTtl', 'setClientTtl', + 'getEtag', 'setEtag', + 'hasVary', 'getVary', 'setVary', + 'isInvalid', 'isSuccessful', 'isRedirection', + 'isClientError', 'isOk', 'isForbidden', + 'isNotFound', 'isRedirect', 'isEmpty', + ); + private static $deprecationsTriggered = array( + __CLASS__ => true, + BinaryFileResponse::class => true, + JsonResponse::class => true, + RedirectResponse::class => true, + StreamedResponse::class => true, + ); + /** * Constructor. * @@ -206,6 +230,23 @@ class Response if (!$this->headers->has('Date')) { $this->setDate(\DateTime::createFromFormat('U', time())); } + + // Deprecations + $class = get_class($this); + if ($this instanceof \PHPUnit_Framework_MockObject_MockObject || $this instanceof \Prophecy\Doubler\DoubleInterface) { + $class = get_parent_class($class); + } + if (isset(self::$deprecationsTriggered[$class])) { + return; + } + + self::$deprecationsTriggered[$class] = true; + foreach (self::$deprecatedMethods as $method) { + $r = new \ReflectionMethod($class, $method); + if (__CLASS__ !== $r->getDeclaringClass()->getName()) { + @trigger_error(sprintf('Extending %s::%s() in %s is deprecated since version 3.2 and won\'t be supported anymore in 4.0 as it will be final.', __CLASS__, $method, $class), E_USER_DEPRECATED); + } + } } /** @@ -312,7 +353,7 @@ class Response } // Check if we need to send extra expire info headers - if ('1.0' == $this->getProtocolVersion() && 'no-cache' == $this->headers->get('Cache-Control')) { + if ('1.0' == $this->getProtocolVersion() && false !== strpos($this->headers->get('Cache-Control'), 'no-cache')) { $this->headers->set('pragma', 'no-cache'); $this->headers->set('expires', -1); } @@ -351,7 +392,11 @@ class Response // cookies foreach ($this->headers->getCookies() as $cookie) { - setcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly()); + if ($cookie->isRaw()) { + setrawcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly()); + } else { + setcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly()); + } } return $this; @@ -1164,6 +1209,7 @@ class Response { $status = ob_get_status(true); $level = count($status); + // PHP_OUTPUT_HANDLER_* are not defined on HHVM 3.3 $flags = defined('PHP_OUTPUT_HANDLER_REMOVABLE') ? PHP_OUTPUT_HANDLER_REMOVABLE | ($flush ? PHP_OUTPUT_HANDLER_FLUSHABLE : PHP_OUTPUT_HANDLER_CLEANABLE) : -1; while ($level-- > $targetLevel && ($s = $status[$level]) && (!isset($s['del']) ? !isset($s['flags']) || $flags === ($s['flags'] & $flags) : $s['del'])) {