minor #41565 [FrameworkBundle][WebProfilerBundle] Don't pass null to string parameters (derrabus)

This PR was merged into the 4.4 branch.

Discussion
----------

[FrameworkBundle][WebProfilerBundle] Don't pass null to string parameters

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Part of #41552
| License       | MIT
| Doc PR        | N/A

This should fix the remaining issues from our bundle tests

Commits
-------

5af6edae62 [FrameworkBundle][WebProfilerBundle] Don't pass null to string parameters
This commit is contained in:
Nicolas Grekas 2021-06-07 09:53:22 +02:00
commit fb79727653
3 changed files with 7 additions and 5 deletions

View File

@ -285,7 +285,7 @@ class XmlDescriptor extends Descriptor
$descriptionXML->appendChild($dom->createCDATASection($classDescription));
}
$serviceXML->setAttribute('class', $definition->getClass());
$serviceXML->setAttribute('class', $definition->getClass() ?? '');
if ($factory = $definition->getFactory()) {
$serviceXML->appendChild($factoryXML = $dom->createElement('factory'));
@ -311,7 +311,7 @@ class XmlDescriptor extends Descriptor
$serviceXML->setAttribute('abstract', $definition->isAbstract() ? 'true' : 'false');
$serviceXML->setAttribute('autowired', $definition->isAutowired() ? 'true' : 'false');
$serviceXML->setAttribute('autoconfigured', $definition->isAutoconfigured() ? 'true' : 'false');
$serviceXML->setAttribute('file', $definition->getFile());
$serviceXML->setAttribute('file', $definition->getFile() ?? '');
$calls = $definition->getMethodCalls();
if (\count($calls) > 0) {

View File

@ -76,8 +76,10 @@ class ConcreteMicroKernel extends Kernel implements EventSubscriberInterface
public function __destruct()
{
$fs = new Filesystem();
$fs->remove($this->cacheDir);
if ($this->cacheDir) {
$fs = new Filesystem();
$fs->remove($this->cacheDir);
}
}
protected function configureRoutes(RouteCollectionBuilder $routes)

View File

@ -103,7 +103,7 @@ class WebDebugToolbarListener implements EventSubscriberInterface
|| $response->isRedirection()
|| ($response->headers->has('Content-Type') && false === strpos($response->headers->get('Content-Type'), 'html'))
|| 'html' !== $request->getRequestFormat()
|| false !== stripos($response->headers->get('Content-Disposition'), 'attachment;')
|| false !== stripos($response->headers->get('Content-Disposition', ''), 'attachment;')
) {
return;
}