Merge branch '5.0' into 5.1
* 5.0: [HttpClient] Support for cURL handler objects. [HttpClient] unset activity list when creating CurlResponse Fixed typo in test name add .body wrapper element [HttpFondation] Change file extension of "audio/mpeg" from "mpga" to "mp3" [VarDumper] Support for cURL handler objects. Check whether path is file in DataPart::fromPath() [DI][FrameworkBundle] Remove whitelist occurrences Avoid accessibility errors on debug toolbar update cookie test
This commit is contained in:
commit
01872c7fe3
@ -10,54 +10,56 @@
|
||||
</head>
|
||||
<body>
|
||||
<spacer size="32"></spacer>
|
||||
<container class="body_{{ ("urgent" == importance ? "alert" : ("high" == importance ? "warning" : "default")) }}">
|
||||
<spacer size="16"></spacer>
|
||||
<row>
|
||||
<columns large="12" small="12">
|
||||
{% block lead %}
|
||||
<small><strong>{{ importance|upper }}</strong></small>
|
||||
<p class="lead">
|
||||
{{ email.subject }}
|
||||
</p>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% if markdown %}
|
||||
{{ include('@email/zurb_2/notification/content_markdown.html.twig') }}
|
||||
{% else %}
|
||||
{{ (raw ? content|raw : content)|nl2br }}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block action %}
|
||||
{% if action_url %}
|
||||
<spacer size="16"></spacer>
|
||||
<button href="{{ action_url }}">{{ action_text }}</button>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block exception %}
|
||||
{% if exception %}
|
||||
<spacer size="16"></spacer>
|
||||
<p><em>Exception stack trace attached.</em></p>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
</columns>
|
||||
</row>
|
||||
|
||||
<wrapper class="secondary">
|
||||
<wrapper class="body">
|
||||
<container class="body_{{ ("urgent" == importance ? "alert" : ("high" == importance ? "warning" : "default")) }}">
|
||||
<spacer size="16"></spacer>
|
||||
{% block footer %}
|
||||
<row>
|
||||
<columns small="12" large="6">
|
||||
{% block footer_content %}
|
||||
<p><small>Notification e-mail sent by Symfony</small></p>
|
||||
{% endblock %}
|
||||
</columns>
|
||||
</row>
|
||||
{% endblock %}
|
||||
</wrapper>
|
||||
</container>
|
||||
<row>
|
||||
<columns large="12" small="12">
|
||||
{% block lead %}
|
||||
<small><strong>{{ importance|upper }}</strong></small>
|
||||
<p class="lead">
|
||||
{{ email.subject }}
|
||||
</p>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% if markdown %}
|
||||
{{ include('@email/zurb_2/notification/content_markdown.html.twig') }}
|
||||
{% else %}
|
||||
{{ (raw ? content|raw : content)|nl2br }}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block action %}
|
||||
{% if action_url %}
|
||||
<spacer size="16"></spacer>
|
||||
<button href="{{ action_url }}">{{ action_text }}</button>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block exception %}
|
||||
{% if exception %}
|
||||
<spacer size="16"></spacer>
|
||||
<p><em>Exception stack trace attached.</em></p>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
</columns>
|
||||
</row>
|
||||
|
||||
<wrapper class="secondary">
|
||||
<spacer size="16"></spacer>
|
||||
{% block footer %}
|
||||
<row>
|
||||
<columns small="12" large="6">
|
||||
{% block footer_content %}
|
||||
<p><small>Notification e-mail sent by Symfony</small></p>
|
||||
{% endblock %}
|
||||
</columns>
|
||||
</row>
|
||||
{% endblock %}
|
||||
</wrapper>
|
||||
</container>
|
||||
</wrapper>
|
||||
</body>
|
||||
</html>
|
||||
{% endapply %}
|
||||
|
@ -21,7 +21,7 @@ use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
*/
|
||||
class UnusedTagsPass implements CompilerPassInterface
|
||||
{
|
||||
private $whitelist = [
|
||||
private $knownTags = [
|
||||
'annotations.cached_reader',
|
||||
'auto_alias',
|
||||
'cache.pool',
|
||||
@ -91,11 +91,11 @@ class UnusedTagsPass implements CompilerPassInterface
|
||||
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
$tags = array_unique(array_merge($container->findTags(), $this->whitelist));
|
||||
$tags = array_unique(array_merge($container->findTags(), $this->knownTags));
|
||||
|
||||
foreach ($container->findUnusedTags() as $tag) {
|
||||
// skip whitelisted tags
|
||||
if (\in_array($tag, $this->whitelist)) {
|
||||
// skip known tags
|
||||
if (\in_array($tag, $this->knownTags)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -15,5 +15,5 @@ use Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler\UnusedTags
|
||||
|
||||
$target = dirname(__DIR__, 2).'/DependencyInjection/Compiler/UnusedTagsPass.php';
|
||||
$contents = file_get_contents($target);
|
||||
$contents = preg_replace('{private \$whitelist = \[(.+?)\];}sm', "private \$whitelist = [\n '".implode("',\n '", UnusedTagsPassUtils::getDefinedTags())."',\n ];", $contents);
|
||||
$contents = preg_replace('{private \$knownTags = \[(.+?)\];}sm', "private \$knownTags = [\n '".implode("',\n '", UnusedTagsPassUtils::getDefinedTags())."',\n ];", $contents);
|
||||
file_put_contents($target, $contents);
|
@ -32,13 +32,13 @@ class UnusedTagsPassTest extends TestCase
|
||||
$this->assertSame([sprintf('%s: Tag "kenrel.event_subscriber" was defined on service(s) "foo", "bar", but was never used. Did you mean "kernel.event_subscriber"?', UnusedTagsPass::class)], $container->getCompiler()->getLog());
|
||||
}
|
||||
|
||||
public function testMissingWhitelistTags()
|
||||
public function testMissingKnownTags()
|
||||
{
|
||||
if (\dirname((new \ReflectionClass(ContainerBuilder::class))->getFileName(), 3) !== \dirname(__DIR__, 5)) {
|
||||
$this->markTestSkipped('Tests are not run from the root symfony/symfony metapackage.');
|
||||
}
|
||||
|
||||
$this->assertSame(UnusedTagsPassUtils::getDefinedTags(), $this->getWhitelistTags(), 'The src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/UnusedTagsPass.php file must be updated; run src/Symfony/Bundle/FrameworkBundle/Resources/bin/check-unused-tags-whitelist.php.');
|
||||
$this->assertSame(UnusedTagsPassUtils::getDefinedTags(), $this->getKnownTags(), 'The src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/UnusedTagsPass.php file must be updated; run src/Symfony/Bundle/FrameworkBundle/Resources/bin/check-unused-known-tags.php.');
|
||||
}
|
||||
|
||||
private function getWhitelistTags(): array
|
||||
@ -46,7 +46,7 @@ class UnusedTagsPassTest extends TestCase
|
||||
// get tags in UnusedTagsPass
|
||||
$target = \dirname(__DIR__, 3).'/DependencyInjection/Compiler/UnusedTagsPass.php';
|
||||
$contents = file_get_contents($target);
|
||||
preg_match('{private \$whitelist = \[(.+?)\];}sm', $contents, $matches);
|
||||
preg_match('{private \$knownTags = \[(.+?)\];}sm', $contents, $matches);
|
||||
$tags = array_values(array_filter(array_map(function ($str) {
|
||||
return trim(preg_replace('{^ +\'(.+)\',}', '$1', $str));
|
||||
}, explode("\n", $matches[1]))));
|
||||
|
@ -1,4 +1,4 @@
|
||||
<div id="sfwdt{{ token }}" class="sf-toolbar sf-display-none"></div>
|
||||
<div id="sfwdt{{ token }}" class="sf-toolbar sf-display-none" role="region" aria-label="Symfony Web Debug Toolbar"></div>
|
||||
{{ include('@WebProfiler/Profiler/base_js.html.twig') }}
|
||||
<style{% if csp_style_nonce %} nonce="{{ csp_style_nonce }}"{% endif %}>
|
||||
{{ include('@WebProfiler/Profiler/toolbar.css.twig') }}
|
||||
|
@ -47,6 +47,7 @@ class CookieTest extends TestCase
|
||||
return [
|
||||
['foo=bar; path=/'],
|
||||
['foo=bar; path=/foo'],
|
||||
['foo="Test"; path=/'],
|
||||
['foo=bar; domain=example.com; path=/'],
|
||||
['foo=bar; domain=example.com; path=/; secure', 'https://example.com/'],
|
||||
['foo=bar; path=/; httponly'],
|
||||
|
@ -801,7 +801,7 @@ class QuestionHelperTest extends AbstractQuestionHelperTest
|
||||
$this->assertEquals('FooBundle', $dialog->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question));
|
||||
}
|
||||
|
||||
public function testDisableSttby()
|
||||
public function testDisableStty()
|
||||
{
|
||||
if (!Terminal::hasSttyAvailable()) {
|
||||
$this->markTestSkipped('`stty` is required to test autocomplete functionality');
|
||||
|
@ -337,7 +337,7 @@ final class CurlHttpClient implements HttpClientInterface, LoggerAwareInterface,
|
||||
$this->multi->dnsCache->evictions = $this->multi->dnsCache->evictions ?: $this->multi->dnsCache->removals;
|
||||
$this->multi->dnsCache->removals = $this->multi->dnsCache->hostnames = [];
|
||||
|
||||
if (\is_resource($this->multi->handle)) {
|
||||
if (\is_resource($this->multi->handle) || $this->multi->handle instanceof \CurlMultiHandle) {
|
||||
if (\defined('CURLMOPT_PUSHFUNCTION')) {
|
||||
curl_multi_setopt($this->multi->handle, CURLMOPT_PUSHFUNCTION, null);
|
||||
}
|
||||
@ -347,7 +347,7 @@ final class CurlHttpClient implements HttpClientInterface, LoggerAwareInterface,
|
||||
}
|
||||
|
||||
foreach ($this->multi->openHandles as [$ch]) {
|
||||
if (\is_resource($ch)) {
|
||||
if (\is_resource($ch) || $ch instanceof \CurlHandle) {
|
||||
curl_setopt($ch, CURLOPT_VERBOSE, false);
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ namespace Symfony\Component\HttpClient\Internal;
|
||||
*/
|
||||
final class CurlClientState extends ClientState
|
||||
{
|
||||
/** @var resource */
|
||||
/** @var \CurlMultiHandle|resource */
|
||||
public $handle;
|
||||
/** @var PushedResponse[] */
|
||||
public $pushedResponses = [];
|
||||
|
@ -36,13 +36,16 @@ final class CurlResponse implements ResponseInterface
|
||||
private $debugBuffer;
|
||||
|
||||
/**
|
||||
* @param \CurlHandle|resource|string $ch
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public function __construct(CurlClientState $multi, $ch, array $options = null, LoggerInterface $logger = null, string $method = 'GET', callable $resolveRedirect = null, int $curlVersion = null)
|
||||
{
|
||||
$this->multi = $multi;
|
||||
|
||||
if (\is_resource($ch)) {
|
||||
if (\is_resource($ch) || $ch instanceof \CurlHandle) {
|
||||
unset($multi->handlesActivity[(int) $ch]);
|
||||
$this->handle = $ch;
|
||||
$this->debugBuffer = fopen('php://temp', 'w+');
|
||||
if (0x074000 === $curlVersion) {
|
||||
|
@ -50,7 +50,7 @@ trait ResponseTrait
|
||||
'canceled' => false,
|
||||
];
|
||||
|
||||
/** @var resource */
|
||||
/** @var object|resource */
|
||||
private $handle;
|
||||
private $id;
|
||||
private $timeout = 0;
|
||||
|
@ -56,6 +56,10 @@ class DataPart extends TextPart
|
||||
$contentType = self::$mimeTypes->getMimeTypes($ext)[0] ?? 'application/octet-stream';
|
||||
}
|
||||
|
||||
if (false === is_readable($path)) {
|
||||
throw new InvalidArgumentException(sprintf('Path "%s" is not readable.', $path));
|
||||
}
|
||||
|
||||
if (false === $handle = @fopen($path, 'r', false)) {
|
||||
throw new InvalidArgumentException(sprintf('Unable to open path "%s".', $path));
|
||||
}
|
||||
|
@ -22,6 +22,11 @@ use Symfony\Component\VarDumper\Cloner\Stub;
|
||||
*/
|
||||
class ResourceCaster
|
||||
{
|
||||
/**
|
||||
* @param \CurlHandle|resource $h
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function castCurl($h, array $a, Stub $stub, bool $isNested)
|
||||
{
|
||||
return curl_getinfo($h);
|
||||
|
@ -145,7 +145,9 @@ abstract class AbstractCloner implements ClonerInterface
|
||||
'Ds\Pair' => ['Symfony\Component\VarDumper\Caster\DsCaster', 'castPair'],
|
||||
'Symfony\Component\VarDumper\Caster\DsPairStub' => ['Symfony\Component\VarDumper\Caster\DsCaster', 'castPairStub'],
|
||||
|
||||
'CurlHandle' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castCurl'],
|
||||
':curl' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castCurl'],
|
||||
|
||||
':dba' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castDba'],
|
||||
':dba persistent' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castDba'],
|
||||
':gd' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castGd'],
|
||||
|
Reference in New Issue
Block a user