Merge branch '2.8' into 3.1

* 2.8:
  Disable CLI color for Windows 10 greater than 10.0.10586
  Exception details break the layout
  [HttpKernel] Remove wrong docblock
  [HttpKernel] Fix HttpCache validation HTTP method
  Move space from the before 'if' to the after 'if'
  [TwigBundle] Add a check for choice's attributes emptiness before calling block('attributes')
This commit is contained in:
Nicolas Grekas 2016-08-19 08:48:39 +02:00
commit 36b5716303
8 changed files with 32 additions and 20 deletions

View File

@ -195,7 +195,7 @@ class DeprecationErrorHandler
{
if ('\\' === DIRECTORY_SEPARATOR) {
return
0 >= version_compare('10.0.10586', PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD)
'10.0.10586' === PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD
|| false !== getenv('ANSICON')
|| 'ON' === getenv('ConEmuANSI')
|| 'xterm' === getenv('TERM');

View File

@ -79,8 +79,7 @@
{{- block('choice_widget_options') -}}
</optgroup>
{%- else -%}
{% set attr = choice.attr %}
<option value="{{ choice.value }}" {{ block('attributes') }}{% if choice is selectedchoice(value) %} selected="selected"{% endif %}>{{ choice_translation_domain is same as(false) ? choice.label : choice.label|trans({}, choice_translation_domain) }}</option>
<option value="{{ choice.value }}"{% if choice.attr %} {% set attr = choice.attr %}{{ block('attributes') }}{% endif %}{% if choice is selectedchoice(value) %} selected="selected"{% endif %}>{{ choice_translation_domain is same as(false) ? choice.label : choice.label|trans({}, choice_translation_domain) }}</option>
{%- endif -%}
{% endfor %}
{%- endblock choice_widget_options -%}

View File

@ -85,7 +85,7 @@ class StreamOutput extends Output
*
* Colorization is disabled if not supported by the stream:
*
* - Windows before 10.0.10586 without Ansicon, ConEmu or Mintty
* - Windows != 10.0.10586 without Ansicon, ConEmu or Mintty
* - non tty consoles
*
* @return bool true if the stream supports colorization, false otherwise
@ -94,7 +94,7 @@ class StreamOutput extends Output
{
if (DIRECTORY_SEPARATOR === '\\') {
return
0 >= version_compare('10.0.10586', PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD)
'10.0.10586' === PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD
|| false !== getenv('ANSICON')
|| 'ON' === getenv('ConEmuANSI')
|| 'xterm' === getenv('TERM');

View File

@ -299,6 +299,7 @@ EOF;
border-bottom:1px solid #ccc;
border-right:1px solid #ccc;
border-left:1px solid #ccc;
word-wrap: break-word;
}
.sf-reset .block_exception { background-color:#ddd; color: #333; padding:20px;
-webkit-border-top-left-radius: 16px;

View File

@ -68,18 +68,6 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte
}
}
/**
* Gets the called events.
*
* @return array An array of called events
*
* @see TraceableEventDispatcherInterface
*/
public function countErrors()
{
return isset($this->data['error_count']) ? $this->data['error_count'] : 0;
}
/**
* Gets the logs.
*
@ -95,6 +83,11 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte
return isset($this->data['priorities']) ? $this->data['priorities'] : array();
}
public function countErrors()
{
return isset($this->data['error_count']) ? $this->data['error_count'] : 0;
}
public function countDeprecations()
{
return isset($this->data['deprecation_count']) ? $this->data['deprecation_count'] : 0;

View File

@ -354,7 +354,9 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
$subRequest = clone $request;
// send no head requests because we want content
$subRequest->setMethod('GET');
if ('HEAD' === $request->getMethod()) {
$subRequest->setMethod('GET');
}
// add our cached last-modified validator
$subRequest->headers->set('if_modified_since', $entry->headers->get('Last-Modified'));
@ -415,7 +417,9 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
$subRequest = clone $request;
// send no head requests because we want content
$subRequest->setMethod('GET');
if ('HEAD' === $request->getMethod()) {
$subRequest->setMethod('GET');
}
// avoid that the backend sends no content
$subRequest->headers->remove('if_modified_since');

View File

@ -799,6 +799,21 @@ class HttpCacheTest extends HttpCacheTestCase
$this->assertTraceNotContains('miss');
}
public function testValidatesCachedResponsesUseSameHttpMethod()
{
$test = $this;
$this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($test) {
$test->assertSame('OPTIONS', $request->getMethod());
});
// build initial request
$this->request('OPTIONS', '/');
// build subsequent request
$this->request('OPTIONS', '/');
}
public function testValidatesCachedResponsesWithETagAndNoFreshnessInformation()
{
$this->setNextResponse(200, array(), 'Hello World', function ($request, $response) {

View File

@ -453,7 +453,7 @@ class CliDumper extends AbstractDumper
if ('\\' === DIRECTORY_SEPARATOR) {
static::$defaultColors = @(
0 >= version_compare('10.0.10586', PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD)
'10.0.10586' === PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD
|| false !== getenv('ANSICON')
|| 'ON' === getenv('ConEmuANSI')
|| 'xterm' === getenv('TERM')