Merge branch '4.3' into 4.4
* 4.3: [Config] Disable default alphabet sorting in glob function due of unstable sort [HttpClient] always return the empty string when the response cannot have a body [TwigBundle][exception] Added missing css variable to highlight line in trace [Serializer] Improve messages for unexpected resources values [SecurityBundle] correct types for default arguments for firewall configs
This commit is contained in:
commit
0b5b6fa79f
2
link
2
link
@ -66,6 +66,6 @@ foreach (glob("$pathToProject/vendor/symfony/*", GLOB_ONLYDIR | GLOB_NOSORT) as
|
|||||||
echo "\"$package\" has been linked to \"$sfPackages[$package]\".".PHP_EOL;
|
echo "\"$package\" has been linked to \"$sfPackages[$package]\".".PHP_EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (glob("$pathToProject/var/cache/*") as $cacheDir) {
|
foreach (glob("$pathToProject/var/cache/*", GLOB_NOSORT) as $cacheDir) {
|
||||||
$filesystem->remove($cacheDir);
|
$filesystem->remove($cacheDir);
|
||||||
}
|
}
|
||||||
|
@ -165,15 +165,15 @@
|
|||||||
<argument /> <!-- name -->
|
<argument /> <!-- name -->
|
||||||
<argument /> <!-- user_checker -->
|
<argument /> <!-- user_checker -->
|
||||||
<argument /> <!-- request_matcher -->
|
<argument /> <!-- request_matcher -->
|
||||||
<argument /> <!-- security enabled -->
|
<argument>false</argument> <!-- security enabled -->
|
||||||
<argument /> <!-- stateless -->
|
<argument>false</argument> <!-- stateless -->
|
||||||
<argument /> <!-- provider -->
|
<argument /> <!-- provider -->
|
||||||
<argument /> <!-- context -->
|
<argument /> <!-- context -->
|
||||||
<argument /> <!-- entry_point -->
|
<argument /> <!-- entry_point -->
|
||||||
<argument /> <!-- access_denied_handler -->
|
<argument /> <!-- access_denied_handler -->
|
||||||
<argument /> <!-- access_denied_url -->
|
<argument /> <!-- access_denied_url -->
|
||||||
<argument type="collection" /> <!-- listeners -->
|
<argument type="collection" /> <!-- listeners -->
|
||||||
<argument /> <!-- switch_user -->
|
<argument>null</argument> <!-- switch_user -->
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
<service id="security.logout_url_generator" class="Symfony\Component\Security\Http\Logout\LogoutUrlGenerator">
|
<service id="security.logout_url_generator" class="Symfony\Component\Security\Http\Logout\LogoutUrlGenerator">
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
--shadow: 0px 0px 1px rgba(128, 128, 128, .2);
|
--shadow: 0px 0px 1px rgba(128, 128, 128, .2);
|
||||||
--border: 1px solid #e0e0e0;
|
--border: 1px solid #e0e0e0;
|
||||||
--background-error: var(--color-error);
|
--background-error: var(--color-error);
|
||||||
|
--trace-selected-background: #F7E5A1;
|
||||||
--highlight-comment: #969896;
|
--highlight-comment: #969896;
|
||||||
--highlight-default: #222222;
|
--highlight-default: #222222;
|
||||||
--highlight-keyword: #a71d5d;
|
--highlight-keyword: #a71d5d;
|
||||||
|
@ -102,7 +102,9 @@ class GlobResource implements \IteratorAggregate, SelfCheckingResourceInterface
|
|||||||
$prefix = str_replace('\\', '/', $this->prefix);
|
$prefix = str_replace('\\', '/', $this->prefix);
|
||||||
|
|
||||||
if (0 !== strpos($this->prefix, 'phar://') && false === strpos($this->pattern, '/**/') && (\defined('GLOB_BRACE') || false === strpos($this->pattern, '{'))) {
|
if (0 !== strpos($this->prefix, 'phar://') && false === strpos($this->pattern, '/**/') && (\defined('GLOB_BRACE') || false === strpos($this->pattern, '{'))) {
|
||||||
foreach (glob($this->prefix.$this->pattern, \defined('GLOB_BRACE') ? GLOB_BRACE : 0) as $path) {
|
$paths = glob($this->prefix.$this->pattern, GLOB_NOSORT | (\defined('GLOB_BRACE') ? GLOB_BRACE : 0));
|
||||||
|
sort($paths);
|
||||||
|
foreach ($paths as $path) {
|
||||||
if ($this->excludedPrefixes) {
|
if ($this->excludedPrefixes) {
|
||||||
$normalizedPath = str_replace('\\', '/', $path);
|
$normalizedPath = str_replace('\\', '/', $path);
|
||||||
do {
|
do {
|
||||||
|
@ -595,7 +595,8 @@ class Finder implements \IteratorAggregate, \Countable
|
|||||||
foreach ((array) $dirs as $dir) {
|
foreach ((array) $dirs as $dir) {
|
||||||
if (is_dir($dir)) {
|
if (is_dir($dir)) {
|
||||||
$resolvedDirs[] = $this->normalizeDir($dir);
|
$resolvedDirs[] = $this->normalizeDir($dir);
|
||||||
} elseif ($glob = glob($dir, (\defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) {
|
} elseif ($glob = glob($dir, (\defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR | GLOB_NOSORT)) {
|
||||||
|
sort($glob);
|
||||||
$resolvedDirs = array_merge($resolvedDirs, array_map([$this, 'normalizeDir'], $glob));
|
$resolvedDirs = array_merge($resolvedDirs, array_map([$this, 'normalizeDir'], $glob));
|
||||||
} else {
|
} else {
|
||||||
throw new DirectoryNotFoundException(sprintf('The "%s" directory does not exist.', $dir));
|
throw new DirectoryNotFoundException(sprintf('The "%s" directory does not exist.', $dir));
|
||||||
|
@ -117,11 +117,15 @@ trait ResponseTrait
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null === $content) {
|
if (null !== $content) {
|
||||||
throw new TransportException('Cannot get the content of the response twice: buffering is disabled.');
|
return $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $content;
|
if ('HEAD' === $this->info['http_method'] || \in_array($this->info['http_code'], [204, 304], true)) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new TransportException('Cannot get the content of the response twice: buffering is disabled.');
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (self::stream([$this]) as $chunk) {
|
foreach (self::stream([$this]) as $chunk) {
|
||||||
|
@ -75,34 +75,4 @@ abstract class HttpClientTestCase extends BaseHttpClientTestCase
|
|||||||
$response = $client->request('GET', 'http://localhost:8057/404');
|
$response = $client->request('GET', 'http://localhost:8057/404');
|
||||||
$stream = $response->toStream();
|
$stream = $response->toStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testInfoOnCanceledResponse()
|
|
||||||
{
|
|
||||||
$this->markTestSkipped('Implemented as of version 4.4');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testBufferSink()
|
|
||||||
{
|
|
||||||
$this->markTestSkipped('Implemented as of version 4.4');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testConditionalBuffering()
|
|
||||||
{
|
|
||||||
$this->markTestSkipped('Implemented as of version 4.4');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testReentrantBufferCallback()
|
|
||||||
{
|
|
||||||
$this->markTestSkipped('Implemented as of version 4.4');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testThrowingBufferCallback()
|
|
||||||
{
|
|
||||||
$this->markTestSkipped('Implemented as of version 4.4');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testMaxDuration()
|
|
||||||
{
|
|
||||||
$this->markTestSkipped('Implemented as of version 4.4');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -468,7 +468,7 @@ class XmlEncoder implements EncoderInterface, DecoderInterface, NormalizationAwa
|
|||||||
return $this->appendNode($parentNode, $data, 'data');
|
return $this->appendNode($parentNode, $data, 'data');
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new NotEncodableValueException(sprintf('An unexpected value could not be serialized: %s', var_export($data, true)));
|
throw new NotEncodableValueException(sprintf('An unexpected value could not be serialized: %s', !\is_resource($data) ? var_export($data, true) : sprintf('%s resource', get_resource_type($data))));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -173,7 +173,7 @@ class Serializer implements SerializerInterface, ContextAwareNormalizerInterface
|
|||||||
throw new NotNormalizableValueException(sprintf('Could not normalize object of type %s, no supporting normalizer found.', \get_class($data)));
|
throw new NotNormalizableValueException(sprintf('Could not normalize object of type %s, no supporting normalizer found.', \get_class($data)));
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new NotNormalizableValueException(sprintf('An unexpected value could not be normalized: %s', var_export($data, true)));
|
throw new NotNormalizableValueException(sprintf('An unexpected value could not be normalized: %s', !\is_resource($data) ? var_export($data, true) : sprintf('%s resource', get_resource_type($data))));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -14,6 +14,7 @@ namespace Symfony\Component\Serializer\Tests\Encoder;
|
|||||||
use PHPUnit\Framework\MockObject\MockObject;
|
use PHPUnit\Framework\MockObject\MockObject;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Component\Serializer\Encoder\XmlEncoder;
|
use Symfony\Component\Serializer\Encoder\XmlEncoder;
|
||||||
|
use Symfony\Component\Serializer\Exception\NotEncodableValueException;
|
||||||
use Symfony\Component\Serializer\Normalizer\CustomNormalizer;
|
use Symfony\Component\Serializer\Normalizer\CustomNormalizer;
|
||||||
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
||||||
use Symfony\Component\Serializer\Serializer;
|
use Symfony\Component\Serializer\Serializer;
|
||||||
@ -816,6 +817,14 @@ XML;
|
|||||||
$this->assertEquals($this->createXmlWithDateTimeField(), $actualXml);
|
$this->assertEquals($this->createXmlWithDateTimeField(), $actualXml);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testNotEncodableValueExceptionMessageForAResource()
|
||||||
|
{
|
||||||
|
$this->expectException(NotEncodableValueException::class);
|
||||||
|
$this->expectExceptionMessage('An unexpected value could not be serialized: stream resource');
|
||||||
|
|
||||||
|
(new XmlEncoder())->encode(tmpfile(), 'xml');
|
||||||
|
}
|
||||||
|
|
||||||
public function testEncodeComment()
|
public function testEncodeComment()
|
||||||
{
|
{
|
||||||
$expected = <<<'XML'
|
$expected = <<<'XML'
|
||||||
|
@ -17,6 +17,7 @@ use Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor;
|
|||||||
use Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor;
|
use Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor;
|
||||||
use Symfony\Component\Serializer\Encoder\JsonEncoder;
|
use Symfony\Component\Serializer\Encoder\JsonEncoder;
|
||||||
use Symfony\Component\Serializer\Exception\InvalidArgumentException;
|
use Symfony\Component\Serializer\Exception\InvalidArgumentException;
|
||||||
|
use Symfony\Component\Serializer\Exception\NotNormalizableValueException;
|
||||||
use Symfony\Component\Serializer\Mapping\ClassDiscriminatorFromClassMetadata;
|
use Symfony\Component\Serializer\Mapping\ClassDiscriminatorFromClassMetadata;
|
||||||
use Symfony\Component\Serializer\Mapping\ClassDiscriminatorMapping;
|
use Symfony\Component\Serializer\Mapping\ClassDiscriminatorMapping;
|
||||||
use Symfony\Component\Serializer\Mapping\ClassMetadata;
|
use Symfony\Component\Serializer\Mapping\ClassMetadata;
|
||||||
@ -481,6 +482,14 @@ class SerializerTest extends TestCase
|
|||||||
$this->serializerWithClassDiscriminator()->deserialize('{"one":1}', DummyMessageInterface::class, 'json');
|
$this->serializerWithClassDiscriminator()->deserialize('{"one":1}', DummyMessageInterface::class, 'json');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testNotNormalizableValueExceptionMessageForAResource()
|
||||||
|
{
|
||||||
|
$this->expectException(NotNormalizableValueException::class);
|
||||||
|
$this->expectExceptionMessage('An unexpected value could not be normalized: stream resource');
|
||||||
|
|
||||||
|
(new Serializer())->normalize(tmpfile());
|
||||||
|
}
|
||||||
|
|
||||||
private function serializerWithClassDiscriminator()
|
private function serializerWithClassDiscriminator()
|
||||||
{
|
{
|
||||||
$classMetadataFactory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader()));
|
$classMetadataFactory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader()));
|
||||||
|
@ -89,7 +89,8 @@ function findTranslationFiles($originalFilePath, $localeToAnalyze)
|
|||||||
$originalFileName = basename($originalFilePath);
|
$originalFileName = basename($originalFilePath);
|
||||||
$translationFileNamePattern = str_replace('.en.', '.*.', $originalFileName);
|
$translationFileNamePattern = str_replace('.en.', '.*.', $originalFileName);
|
||||||
|
|
||||||
$translationFiles = glob($translationsDir.'/'.$translationFileNamePattern);
|
$translationFiles = glob($translationsDir.'/'.$translationFileNamePattern, GLOB_NOSORT);
|
||||||
|
sort($translationFiles);
|
||||||
foreach ($translationFiles as $filePath) {
|
foreach ($translationFiles as $filePath) {
|
||||||
$locale = extractLocaleFromFilePath($filePath);
|
$locale = extractLocaleFromFilePath($filePath);
|
||||||
|
|
||||||
|
@ -29,15 +29,20 @@ foreach ($_SERVER as $k => $v) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$json = json_encode($vars, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
|
||||||
|
|
||||||
switch ($vars['REQUEST_URI']) {
|
switch ($vars['REQUEST_URI']) {
|
||||||
default:
|
default:
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
|
case '/head':
|
||||||
|
header('Content-Length: '.strlen($json), true);
|
||||||
|
break;
|
||||||
|
|
||||||
case '/':
|
case '/':
|
||||||
case '/?a=a&b=b':
|
case '/?a=a&b=b':
|
||||||
case 'http://127.0.0.1:8057/':
|
case 'http://127.0.0.1:8057/':
|
||||||
case 'http://localhost:8057/':
|
case 'http://localhost:8057/':
|
||||||
header('Content-Type: application/json');
|
|
||||||
ob_start('ob_gzhandler');
|
ob_start('ob_gzhandler');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -85,6 +90,7 @@ switch ($vars['REQUEST_URI']) {
|
|||||||
case '/304':
|
case '/304':
|
||||||
header('Content-Length: 10', true, 304);
|
header('Content-Length: 10', true, 304);
|
||||||
echo '12345';
|
echo '12345';
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case '/307':
|
case '/307':
|
||||||
@ -153,4 +159,4 @@ switch ($vars['REQUEST_URI']) {
|
|||||||
|
|
||||||
header('Content-Type: application/json', true);
|
header('Content-Type: application/json', true);
|
||||||
|
|
||||||
echo json_encode($vars, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
|
echo $json;
|
||||||
|
@ -75,26 +75,24 @@ abstract class HttpClientTestCase extends TestCase
|
|||||||
public function testHeadRequest()
|
public function testHeadRequest()
|
||||||
{
|
{
|
||||||
$client = $this->getHttpClient(__FUNCTION__);
|
$client = $this->getHttpClient(__FUNCTION__);
|
||||||
$response = $client->request('HEAD', 'http://localhost:8057', [
|
$response = $client->request('HEAD', 'http://localhost:8057/head', [
|
||||||
'headers' => ['Foo' => 'baR'],
|
'headers' => ['Foo' => 'baR'],
|
||||||
'user_data' => $data = new \stdClass(),
|
'user_data' => $data = new \stdClass(),
|
||||||
|
'buffer' => false,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->assertSame([], $response->getInfo('response_headers'));
|
$this->assertSame([], $response->getInfo('response_headers'));
|
||||||
$this->assertSame($data, $response->getInfo()['user_data']);
|
|
||||||
$this->assertSame(200, $response->getStatusCode());
|
$this->assertSame(200, $response->getStatusCode());
|
||||||
|
|
||||||
$info = $response->getInfo();
|
$info = $response->getInfo();
|
||||||
$this->assertNull($info['error']);
|
|
||||||
$this->assertSame(0, $info['redirect_count']);
|
|
||||||
$this->assertSame('HTTP/1.1 200 OK', $info['response_headers'][0]);
|
$this->assertSame('HTTP/1.1 200 OK', $info['response_headers'][0]);
|
||||||
$this->assertSame('Host: localhost:8057', $info['response_headers'][1]);
|
$this->assertSame('Host: localhost:8057', $info['response_headers'][1]);
|
||||||
$this->assertSame('http://localhost:8057/', $info['url']);
|
|
||||||
|
|
||||||
$headers = $response->getHeaders();
|
$headers = $response->getHeaders();
|
||||||
|
|
||||||
$this->assertSame('localhost:8057', $headers['host'][0]);
|
$this->assertSame('localhost:8057', $headers['host'][0]);
|
||||||
$this->assertSame(['application/json'], $headers['content-type']);
|
$this->assertSame(['application/json'], $headers['content-type']);
|
||||||
|
$this->assertTrue(0 < $headers['content-length'][0]);
|
||||||
|
|
||||||
$this->assertSame('', $response->getContent());
|
$this->assertSame('', $response->getContent());
|
||||||
}
|
}
|
||||||
@ -329,6 +327,7 @@ abstract class HttpClientTestCase extends TestCase
|
|||||||
$client = $this->getHttpClient(__FUNCTION__);
|
$client = $this->getHttpClient(__FUNCTION__);
|
||||||
$response = $client->request('GET', 'http://localhost:8057/304', [
|
$response = $client->request('GET', 'http://localhost:8057/304', [
|
||||||
'headers' => ['If-Match' => '"abc"'],
|
'headers' => ['If-Match' => '"abc"'],
|
||||||
|
'buffer' => false,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->assertSame(304, $response->getStatusCode());
|
$this->assertSame(304, $response->getStatusCode());
|
||||||
|
Reference in New Issue
Block a user