Merge branch '2.8' into 3.4

* 2.8:
  Another PR template tweak
  [PropertyInfo] ReflectionExtractor: give a chance to other extractors if no properties
  Clean calls to http_build_query()
  [WebProfilerBundle] limit ajax request to 100 and remove the last one
  [HttpFoundation] Fix missing "throw" in JsonResponse
  Improve the documentation of
  Suppress warning from sapi_windows_vt100_support on stream other than STDIO
  removed extra-verbose comments
  Fixes #26136: Avoid emitting warning in hasParameterOption()
  Added a README entry to the PR template
  [HttpFoundation] Add x-zip-compressed to MimeTypeExtensionGuesser.
  [DI] Add null check for removeChild
This commit is contained in:
Nicolas Grekas 2018-02-22 11:48:49 +01:00
commit 43344598dd
14 changed files with 64 additions and 20 deletions

View File

@ -3,16 +3,18 @@
| Branch? | master for features / 2.7 up to 4.0 for bug fixes <!-- see below -->
| Bug fix? | yes/no
| New feature? | yes/no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks? | yes/no
| BC breaks? | no <!-- see https://symfony.com/bc -->
| Deprecations? | yes/no <!-- don't forget to update UPGRADE-*.md files -->
| Tests pass? | yes/no
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
| Tests pass? | yes <!-- please add some, will be required by reviewers -->
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | symfony/symfony-docs#... <!--highly recommended for new features-->
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
<!--
- Bug fixes must be submitted against the lowest branch where they apply
(lowest branches are regularly merged to upper ones so they get the fixes too).
- Features and deprecations must be submitted against the master branch.
- Replace this comment by a description of what your PR is solving.
Write a short README entry for your feature/bugfix here (replace this comment block.)
This will help people understand your PR and can be used as a start of the Doc PR.
Additionally:
- Bug fixes must be submitted against the lowest branch where they apply
(lowest branches are regularly merged to upper ones so they get the fixes too).
- Features and deprecations must be submitted against the master branch.
-->

View File

@ -286,7 +286,7 @@ class ArgvInput extends Input
// For long options, test for '--option=' at beginning
// For short options, test for '-o' at beginning
$leading = 0 === strpos($value, '--') ? $value.'=' : $value;
if ($token === $value || 0 === strpos($token, $leading)) {
if ($token === $value || '' !== $leading && 0 === strpos($token, $leading)) {
return true;
}
}
@ -317,7 +317,7 @@ class ArgvInput extends Input
// For long options, test for '--option=' at beginning
// For short options, test for '-o' at beginning
$leading = 0 === strpos($value, '--') ? $value.'=' : $value;
if (0 === strpos($token, $leading)) {
if ('' !== $leading && 0 === strpos($token, $leading)) {
return substr($token, strlen($leading));
}
}

View File

@ -92,7 +92,7 @@ class StreamOutput extends Output
{
if (DIRECTORY_SEPARATOR === '\\') {
return
function_exists('sapi_windows_vt100_support') && sapi_windows_vt100_support($this->stream)
function_exists('sapi_windows_vt100_support') && @sapi_windows_vt100_support($this->stream)
|| '10.0.10586' === PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD
|| false !== getenv('ANSICON')
|| 'ON' === getenv('ConEmuANSI')

View File

@ -370,6 +370,19 @@ class ArgvInputTest extends TestCase
$this->assertFalse($input->hasParameterOption('-fh'), '->hasParameterOption() returns true if the given short option is in the raw input');
}
public function testNoWarningOnInvalidParameterOption()
{
$input = new ArgvInput(array('cli.php', '-edev'));
$this->assertTrue($input->hasParameterOption(array('-e', '')));
// No warning thrown
$this->assertFalse($input->hasParameterOption(array('-m', '')));
$this->assertEquals('dev', $input->getParameterOption(array('-e', '')));
// No warning thrown
$this->assertFalse($input->getParameterOption(array('-m', '')));
}
public function testToString()
{
$input = new ArgvInput(array('cli.php', '-f', 'foo'));

View File

@ -209,7 +209,7 @@ class Form extends Link implements \ArrayAccess
parse_str($query, $currentParameters);
}
$queryString = http_build_query(array_merge($currentParameters, $this->getValues()), null, '&');
$queryString = http_build_query(array_merge($currentParameters, $this->getValues()), '', '&');
$pos = strpos($uri, '?');
$base = false === $pos ? $uri : substr($uri, 0, $pos);

View File

@ -519,13 +519,18 @@ class Filesystem
/**
* Mirrors a directory to another.
*
* Copies files and directories from the origin directory into the target directory. By default:
*
* - existing files in the target directory will be overwritten, except if they are newer (see the `override` option)
* - files in the target directory that do not exist in the source directory will not be deleted (see the `delete` option)
*
* @param string $originDir The origin directory
* @param string $targetDir The target directory
* @param \Traversable $iterator A Traversable instance
* @param \Traversable $iterator Iterator that filters which files and directories to copy
* @param array $options An array of boolean options
* Valid options are:
* - $options['override'] Whether to override an existing file on copy or not (see copy())
* - $options['copy_on_windows'] Whether to copy files instead of links on Windows (see symlink())
* - $options['override'] If true, target files newer than origin files are overwritten (see copy(), defaults to false)
* - $options['copy_on_windows'] Whether to copy files instead of links on Windows (see symlink(), defaults to false)
* - $options['delete'] Whether to delete files that are not in the source directory (defaults to false)
*
* @throws IOException When file type is unknown

View File

@ -599,6 +599,7 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface
'application/x-xliff+xml' => 'xlf',
'application/x-xpinstall' => 'xpi',
'application/x-xz' => 'xz',
'application/x-zip-compressed' => 'zip',
'application/x-zmachine' => 'z1',
'application/xaml+xml' => 'xaml',
'application/xcap-diff+xml' => 'xdf',

View File

@ -557,7 +557,7 @@ class Request
*/
public function overrideGlobals()
{
$this->server->set('QUERY_STRING', static::normalizeQueryString(http_build_query($this->query->all(), null, '&')));
$this->server->set('QUERY_STRING', static::normalizeQueryString(http_build_query($this->query->all(), '', '&')));
$_GET = $this->query->all();
$_POST = $this->request->all();

View File

@ -2316,7 +2316,7 @@ class RequestContentProxy extends Request
{
public function getContent($asResource = false)
{
return http_build_query(array('_method' => 'PUT', 'content' => 'mycontent'));
return http_build_query(array('_method' => 'PUT', 'content' => 'mycontent'), '', '&');
}
}

View File

@ -109,7 +109,7 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp
$properties[$propertyName] = $propertyName;
}
return array_values($properties);
return $properties ? array_values($properties) : null;
}
/**

View File

@ -59,6 +59,8 @@ class ReflectionExtractorTest extends TestCase
),
$this->extractor->getProperties('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy')
);
$this->assertNull($this->extractor->getProperties('Symfony\Component\PropertyInfo\Tests\Fixtures\NoProperties'));
}
public function testGetPropertiesWithCustomPrefixes()

View File

@ -0,0 +1,21 @@
<?php
namespace Symfony\Component\PropertyInfo\Tests\Fixtures;
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\PropertyInfo\Tests\Fixtures;
/**
* @author Kévin Dunglas <dunglas@gmail.com>
*/
class NoProperties
{
}

View File

@ -95,7 +95,7 @@ class SwitchUserListener implements ListenerInterface
if (!$this->stateless) {
$request->query->remove($this->usernameParameter);
$request->server->set('QUERY_STRING', http_build_query($request->query->all()));
$request->server->set('QUERY_STRING', http_build_query($request->query->all(), '', '&'));
$response = new RedirectResponse($request->getUri(), 302);
$event->setResponse($response);

View File

@ -127,7 +127,7 @@ class LogoutUrlGenerator
$url = UrlGeneratorInterface::ABSOLUTE_URL === $referenceType ? $request->getUriForPath($logoutPath) : $request->getBaseUrl().$logoutPath;
if (!empty($parameters)) {
$url .= '?'.http_build_query($parameters);
$url .= '?'.http_build_query($parameters, '', '&');
}
} else {
if (!$this->router) {