Skip to content

Commit d051ef4

Browse files
committed
Merge branch '2.8' into 3.2
* 2.8: Misspelled word Display a better error design when the toolbar cannot be displayed do not validate empty values [Console] fix description of INF default values [PropertyAccess] Fix TypeError discard [Validator] Throw exception on Comparison constraints null options Identify tty tests in Component/Process [Security] Fix annotation
2 parents 3ccef6e + 2f8eeed commit d051ef4

32 files changed

+183
-32
lines changed

src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ public function validate($entity, Constraint $constraint)
6363
throw new ConstraintDefinitionException('At least one field has to be specified.');
6464
}
6565

66+
if (null === $entity) {
67+
return;
68+
}
69+
6670
if ($constraint->em) {
6771
$em = $this->registry->getManager($constraint->em);
6872

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,3 +522,33 @@
522522
display: none;
523523
}
524524
}
525+
526+
/***** Error Toolbar *****/
527+
.sf-error-toolbar .sf-toolbarreset {
528+
background: #222;
529+
color: #f5f5f5;
530+
font: 13px/36px Arial, sans-serif;
531+
height: 36px;
532+
padding: 0 15px;
533+
text-align: left;
534+
}
535+
536+
.sf-error-toolbar .sf-toolbarreset svg {
537+
height: auto;
538+
}
539+
540+
.sf-error-toolbar .sf-toolbarreset a {
541+
color: #99cdd8;
542+
margin-left: 5px;
543+
text-decoration: underline;
544+
}
545+
546+
.sf-error-toolbar .sf-toolbarreset a:hover {
547+
text-decoration: none;
548+
}
549+
550+
.sf-error-toolbar .sf-toolbarreset .sf-toolbar-icon {
551+
float: left;
552+
padding: 5px 0;
553+
margin-right: 10px;
554+
}

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,15 @@
9696
})
9797
},
9898
function(xhr) {
99-
var errorToolbarHtml = '
100-
<style>
101-
.sfErrorToolbar { background: #222; bottom: 0; color: #f5f5f5; font: 13px/36px Arial, sans-serif; height: 36px; padding: 0 15px; position: fixed; width: 100%; }
102-
.sfErrorToolbar a { color: #99cdd8; margin-left: 5px; text-decoration: underline; }
103-
.sfErrorToolbar a:hover { text-decoration: none; }
104-
</style>
105-
<div class="sfErrorToolbar">An error occurred while loading the web debug toolbar. <a href="{{ path("_profiler", { "token": token }) }}">Open the web profiler.</a></div>
106-
';
107-
10899
if (xhr.status !== 0) {
109-
window.document.body.insertAdjacentHTML('beforeend', errorToolbarHtml);
100+
var sfwdt = document.getElementById('sfwdt{{ token }}');
101+
sfwdt.innerHTML = '\
102+
<div class="sf-toolbarreset">\
103+
<div class="sf-toolbar-icon"><svg width="26" height="28" xmlns="http://www.w3.org/2000/svg" version="1.1" x="0px" y="0px" viewBox="0 0 26 28" enable-background="new 0 0 26 28" xml:space="preserve"><path fill="#FFFFFF" d="M13 0C5.8 0 0 5.8 0 13c0 7.2 5.8 13 13 13c7.2 0 13-5.8 13-13C26 5.8 20.2 0 13 0z M20 7.5 c-0.6 0-1-0.3-1-0.9c0-0.2 0-0.4 0.2-0.6c0.1-0.3 0.2-0.3 0.2-0.4c0-0.3-0.5-0.4-0.7-0.4c-2 0.1-2.5 2.7-2.9 4.8l-0.2 1.1 c1.1 0.2 1.9 0 2.4-0.3c0.6-0.4-0.2-0.8-0.1-1.3C18 9.2 18.4 9 18.7 8.9c0.5 0 0.8 0.5 0.8 1c0 0.8-1.1 2-3.3 1.9 c-0.3 0-0.5 0-0.7-0.1L15 14.1c-0.4 1.7-0.9 4.1-2.6 6.2c-1.5 1.8-3.1 2.1-3.8 2.1c-1.3 0-2.1-0.6-2.2-1.6c0-0.9 0.8-1.4 1.3-1.4 c0.7 0 1.2 0.5 1.2 1.1c0 0.5-0.2 0.6-0.4 0.7c-0.1 0.1-0.3 0.2-0.3 0.4c0 0.1 0.1 0.3 0.4 0.3c0.5 0 0.9-0.3 1.2-0.5 c1.3-1 1.7-2.9 2.4-6.2l0.1-0.8c0.2-1.1 0.5-2.3 0.8-3.5c-0.9-0.7-1.4-1.5-2.6-1.8c-0.8-0.2-1.3 0-1.7 0.4C8.4 10 8.6 10.7 9 11.1 l0.7 0.7c0.8 0.9 1.3 1.7 1.1 2.7c-0.3 1.6-2.1 2.8-4.3 2.1c-1.9-0.6-2.2-1.9-2-2.7c0.2-0.6 0.7-0.8 1.2-0.6 c0.5 0.2 0.7 0.8 0.6 1.3c0 0.1 0 0.1-0.1 0.3C6 15 5.9 15.2 5.9 15.3c-0.1 0.4 0.4 0.7 0.8 0.8c0.8 0.3 1.7-0.2 1.9-0.9 c0.2-0.6-0.2-1.1-0.4-1.2l-0.8-0.9c-0.4-0.4-1.2-1.5-0.8-2.8c0.2-0.5 0.5-1 0.9-1.4c1-0.7 2-0.8 3-0.6c1.3 0.4 1.9 1.2 2.8 1.9 c0.5-1.3 1.1-2.6 2-3.8c0.9-1 2-1.7 3.3-1.8C20 4.8 21 5.4 21 6.3C21 6.7 20.8 7.5 20 7.5z"/></svg></div>\
104+
An error occurred while loading the web debug toolbar. <a href="{{ path("_profiler", { "token": token }) }}">Open the web profiler.</a>\
105+
</div>\
106+
';
107+
sfwdt.setAttribute('class', 'sf-toolbar sf-error-toolbar');
110108
}
111109
},
112110
{ maxTries: 5 }

src/Symfony/Component/Console/Descriptor/JsonDescriptor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ private function getInputArgumentData(InputArgument $argument)
103103
'is_required' => $argument->isRequired(),
104104
'is_array' => $argument->isArray(),
105105
'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $argument->getDescription()),
106-
'default' => $argument->getDefault(),
106+
'default' => INF === $argument->getDefault() ? 'INF' : $argument->getDefault(),
107107
);
108108
}
109109

@@ -121,7 +121,7 @@ private function getInputOptionData(InputOption $option)
121121
'is_value_required' => $option->isValueRequired(),
122122
'is_multiple' => $option->isArray(),
123123
'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $option->getDescription()),
124-
'default' => $option->getDefault(),
124+
'default' => INF === $option->getDefault() ? 'INF' : $option->getDefault(),
125125
);
126126
}
127127

src/Symfony/Component/Console/Descriptor/TextDescriptor.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,10 @@ private function getCommandAliasesText($command)
262262
*/
263263
private function formatDefaultValue($default)
264264
{
265+
if (INF === $default) {
266+
return 'INF';
267+
}
268+
265269
if (is_string($default)) {
266270
$default = OutputFormatter::escape($default);
267271
} elseif (is_array($default)) {

src/Symfony/Component/Console/Tests/Descriptor/ObjectsProvider.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public static function getInputArguments()
3232
'input_argument_3' => new InputArgument('argument_name', InputArgument::OPTIONAL, 'argument description', 'default_value'),
3333
'input_argument_4' => new InputArgument('argument_name', InputArgument::REQUIRED, "multiline\nargument description"),
3434
'input_argument_with_style' => new InputArgument('argument_name', InputArgument::OPTIONAL, 'argument description', '<comment>style</>'),
35+
'input_argument_with_default_inf_value' => new InputArgument('argument_name', InputArgument::OPTIONAL, 'argument description', INF),
3536
);
3637
}
3738

@@ -46,6 +47,7 @@ public static function getInputOptions()
4647
'input_option_6' => new InputOption('option_name', array('o', 'O'), InputOption::VALUE_REQUIRED, 'option with multiple shortcuts'),
4748
'input_option_with_style' => new InputOption('option_name', 'o', InputOption::VALUE_REQUIRED, 'option description', '<comment>style</>'),
4849
'input_option_with_style_array' => new InputOption('option_name', 'o', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'option description', array('<comment>Hello</comment>', '<info>world</info>')),
50+
'input_option_with_default_inf_value' => new InputOption('option_name', 'o', InputOption::VALUE_OPTIONAL, 'option description', INF),
4951
);
5052
}
5153

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "argument_name",
3+
"is_required": false,
4+
"is_array": false,
5+
"description": "argument description",
6+
"default": "INF"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
**argument_name:**
2+
3+
* Name: argument_name
4+
* Is required: no
5+
* Is array: no
6+
* Description: argument description
7+
* Default: `INF`
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<info>argument_name</info> argument description<comment> [default: INF]</comment>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<argument name="argument_name" is_required="0" is_array="0">
3+
<description>argument description</description>
4+
<defaults>
5+
<default>INF</default>
6+
</defaults>
7+
</argument>

0 commit comments

Comments
 (0)