Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[HttpFoundation] removed deprecated Request::splitHttpAcceptHeader() …

…method
  • Loading branch information...
commit 8ec3bfbdc52e7f4b9e5fa6807dc050ec691a08c9 1 parent 61f15c8
@fabpot fabpot authored
Showing with 0 additions and 62 deletions.
  1. +0 −25 Request.php
  2. +0 −37 Tests/RequestTest.php
View
25 Request.php
@@ -1426,31 +1426,6 @@ public function isXmlHttpRequest()
return 'XMLHttpRequest' == $this->headers->get('X-Requested-With');
}
- /**
- * Splits an Accept-* HTTP header.
- *
- * @param string $header Header to split
- *
- * @return array Array indexed by the values of the Accept-* header in preferred order
- *
- * @deprecated Deprecated since version 2.2, to be removed in 2.3.
- */
- public function splitHttpAcceptHeader($header)
- {
- trigger_error('splitHttpAcceptHeader() is deprecated since version 2.2 and will be removed in 2.3.', E_USER_DEPRECATED);
-
- $headers = array();
- foreach (AcceptHeader::fromString($header)->all() as $item) {
- $key = $item->getValue();
- foreach ($item->getAttributes() as $name => $value) {
- $key .= sprintf(';%s=%s', $name, $value);
- }
- $headers[$key] = $item->getQuality();
- }
-
- return $headers;
- }
-
/*
* The following methods are derived from code of the Zend Framework (1.10dev - 2010-01-24)
*
View
37 Tests/RequestTest.php
@@ -17,15 +17,6 @@
class RequestTest extends \PHPUnit_Framework_TestCase
{
- public function deprecationErrorHandler($errorNumber, $message, $file, $line, $context)
- {
- if ($errorNumber & E_USER_DEPRECATED) {
- return true;
- }
-
- return \PHPUnit_Util_ErrorHandler::handleError($errorNumber, $message, $file, $line);
- }
-
/**
* @covers Symfony\Component\HttpFoundation\Request::__construct
*/
@@ -908,8 +899,6 @@ public function testOverrideGlobals()
// restore initial $_SERVER array
$_SERVER = $server;
-
- restore_error_handler();
}
public function testGetScriptName()
@@ -1158,32 +1147,6 @@ public function testToString()
$this->assertContains('Accept-Language: zh, en-us; q=0.8, en; q=0.6', $request->__toString());
}
- /**
- * @dataProvider splitHttpAcceptHeaderData
- */
- public function testSplitHttpAcceptHeader($acceptHeader, $expected)
- {
- $request = new Request();
-
- set_error_handler(array($this, "deprecationErrorHandler"));
- $this->assertEquals($expected, $request->splitHttpAcceptHeader($acceptHeader));
- restore_error_handler();
- }
-
- public function splitHttpAcceptHeaderData()
- {
- return array(
- array(null, array()),
- array('text/html;q=0.8', array('text/html' => 0.8)),
- array('text/html;foo=bar;q=0.8 ', array('text/html;foo=bar' => 0.8)),
- array('text/html;charset=utf-8; q=0.8', array('text/html;charset=utf-8' => 0.8)),
- array('text/html,application/xml;q=0.9,*/*;charset=utf-8; q=0.8', array('text/html' => 1.0, 'application/xml' => 0.9, '*/*;charset=utf-8' => 0.8)),
- array('text/html,application/xhtml+xml;q=0.9,*/*;q=0.8; foo=bar', array('text/html' => 1.0, 'application/xhtml+xml' => 0.9, '*/*;foo=bar' => 0.8)),
- array('text/html,application/xhtml+xml;charset=utf-8;q=0.9; foo=bar,*/*', array('text/html' => 1.0, '*/*' => 1.0, 'application/xhtml+xml;charset=utf-8;foo=bar' => 0.9)),
- array('text/html,application/xhtml+xml', array('text/html' => 1.0, 'application/xhtml+xml' => 1.0)),
- );
- }
-
public function testIsMethod()
{
$request = new Request();
Please sign in to comment.
Something went wrong with that request. Please try again.