Merge branch '2.7' into 2.8
* 2.7: Clean calls to http_build_query() [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:
commit
9cbb2569b9
8
.github/PULL_REQUEST_TEMPLATE.md
vendored
8
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -11,8 +11,10 @@
|
||||
| Doc PR | symfony/symfony-docs#... <!--highly recommended for new features-->
|
||||
|
||||
<!--
|
||||
- Bug fixes must be submitted against the lowest branch where they apply
|
||||
Write a short README entry for your feature 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.
|
||||
- Replace this comment by a description of what your PR is solving.
|
||||
- Features and deprecations must be submitted against the master branch.
|
||||
-->
|
||||
|
@ -285,7 +285,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;
|
||||
}
|
||||
}
|
||||
@ -313,7 +313,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));
|
||||
}
|
||||
}
|
||||
|
@ -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')
|
||||
|
@ -337,6 +337,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'));
|
||||
|
@ -347,10 +347,12 @@ class XmlFileLoader extends FileLoader
|
||||
$domElement->parentNode->replaceChild($tmpDomElement, $domElement);
|
||||
$tmpDomElement->setAttribute('id', $id);
|
||||
} else {
|
||||
if (null !== $domElement->parentNode) {
|
||||
$domElement->parentNode->removeChild($domElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns arguments as valid php types.
|
||||
|
@ -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);
|
||||
|
@ -431,13 +431,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
|
||||
|
@ -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',
|
||||
|
@ -148,6 +148,7 @@ class JsonResponse extends Response
|
||||
if (\PHP_VERSION_ID < 50500 || !interface_exists('JsonSerializable', false)) {
|
||||
restore_error_handler();
|
||||
}
|
||||
throw $e;
|
||||
} catch (\Exception $e) {
|
||||
if (\PHP_VERSION_ID < 50500 || !interface_exists('JsonSerializable', false)) {
|
||||
restore_error_handler();
|
||||
|
@ -531,7 +531,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();
|
||||
|
@ -2114,7 +2114,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'), '', '&');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ class SwitchUserListener implements ListenerInterface
|
||||
}
|
||||
|
||||
$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);
|
||||
|
||||
|
@ -128,7 +128,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) {
|
||||
|
Reference in New Issue
Block a user