Skip to content

Commit 9260a7b

Browse files
committed
Merge branch '3.2' into 3.3
* 3.2: Misspelled word Display a better error design when the toolbar cannot be displayed do not validate empty values [Cache] fix cleanup of expired items for PdoAdapter [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 [Workflow] Added more events to the announce function [Validator] Remove property path suggestion for using the Expression validator [WebProfilerBundle] Fix css trick used for offsetting html anchor from fixed header [Security] Fix annotation
2 parents bfd4173 + d051ef4 commit 9260a7b

38 files changed

+217
-36
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/open.css.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ a.doc:hover {
6464

6565
.anchor {
6666
position: relative;
67-
padding-top: 7em;
68-
margin-top: -7em;
67+
display: block;
68+
top: -7em;
6969
visibility: hidden;
7070
}

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,3 +533,33 @@
533533
display: none;
534534
}
535535
}
536+
537+
/***** Error Toolbar *****/
538+
.sf-error-toolbar .sf-toolbarreset {
539+
background: #222;
540+
color: #f5f5f5;
541+
font: 13px/36px Arial, sans-serif;
542+
height: 36px;
543+
padding: 0 15px;
544+
text-align: left;
545+
}
546+
547+
.sf-error-toolbar .sf-toolbarreset svg {
548+
height: auto;
549+
}
550+
551+
.sf-error-toolbar .sf-toolbarreset a {
552+
color: #99cdd8;
553+
margin-left: 5px;
554+
text-decoration: underline;
555+
}
556+
557+
.sf-error-toolbar .sf-toolbarreset a:hover {
558+
text-decoration: none;
559+
}
560+
561+
.sf-error-toolbar .sf-toolbarreset .sf-toolbar-icon {
562+
float: left;
563+
padding: 5px 0;
564+
margin-right: 10px;
565+
}

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
@@ -95,17 +95,15 @@
9595
Sfjs.renderAjaxRequests();
9696
},
9797
function(xhr) {
98-
var errorToolbarHtml = '
99-
<style>
100-
.sfErrorToolbar { background: #222; bottom: 0; color: #f5f5f5; font: 13px/36px Arial, sans-serif; height: 36px; padding: 0 15px; position: fixed; width: 100%; }
101-
.sfErrorToolbar a { color: #99cdd8; margin-left: 5px; text-decoration: underline; }
102-
.sfErrorToolbar a:hover { text-decoration: none; }
103-
</style>
104-
<div class="sfErrorToolbar">An error occurred while loading the web debug toolbar. <a href="{{ path("_profiler", { "token": token }) }}">Open the web profiler.</a></div>
105-
';
106-
10798
if (xhr.status !== 0) {
108-
window.document.body.insertAdjacentHTML('beforeend', errorToolbarHtml);
99+
var sfwdt = document.getElementById('sfwdt{{ token }}');
100+
sfwdt.innerHTML = '\
101+
<div class="sf-toolbarreset">\
102+
<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>\
103+
An error occurred while loading the web debug toolbar. <a href="{{ path("_profiler", { "token": token }) }}">Open the web profiler.</a>\
104+
</div>\
105+
';
106+
sfwdt.setAttribute('class', 'sf-toolbar sf-error-toolbar');
109107
}
110108
},
111109
{ maxTries: 5 }

src/Symfony/Component/Cache/Tests/Adapter/PdoAdapterTest.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,30 @@ public function createCachePool($defaultLifetime = 0)
4141
{
4242
return new PdoAdapter('sqlite:'.self::$dbFile, 'ns', $defaultLifetime);
4343
}
44+
45+
public function testCleanupExpiredItems()
46+
{
47+
$pdo = new \PDO('sqlite:'.self::$dbFile);
48+
49+
$getCacheItemCount = function () use ($pdo) {
50+
return (int) $pdo->query('SELECT COUNT(*) FROM cache_items')->fetch(\PDO::FETCH_COLUMN);
51+
};
52+
53+
$this->assertSame(0, $getCacheItemCount());
54+
55+
$cache = $this->createCachePool();
56+
57+
$item = $cache->getItem('some_nice_key');
58+
$item->expiresAfter(1);
59+
$item->set(1);
60+
61+
$cache->save($item);
62+
$this->assertSame(1, $getCacheItemCount());
63+
64+
sleep(2);
65+
66+
$newItem = $cache->getItem($item->getKey());
67+
$this->assertFalse($newItem->isHit());
68+
$this->assertSame(0, $getCacheItemCount(), 'PDOAdapter must clean up expired items');
69+
}
4470
}

src/Symfony/Component/Cache/Traits/PdoTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ protected function doFetch(array $ids)
170170
foreach ($expired as $id) {
171171
$stmt->bindValue(++$i, $id);
172172
}
173-
$stmt->execute($expired);
173+
$stmt->execute();
174174
}
175175
}
176176

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ private function getInputArgumentData(InputArgument $argument)
115115
'is_required' => $argument->isRequired(),
116116
'is_array' => $argument->isArray(),
117117
'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $argument->getDescription()),
118-
'default' => $argument->getDefault(),
118+
'default' => INF === $argument->getDefault() ? 'INF' : $argument->getDefault(),
119119
);
120120
}
121121

@@ -133,7 +133,7 @@ private function getInputOptionData(InputOption $option)
133133
'is_value_required' => $option->isValueRequired(),
134134
'is_multiple' => $option->isArray(),
135135
'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $option->getDescription()),
136-
'default' => $option->getDefault(),
136+
'default' => INF === $option->getDefault() ? 'INF' : $option->getDefault(),
137137
);
138138
}
139139

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,10 @@ private function getCommandAliasesText($command)
278278
*/
279279
private function formatDefaultValue($default)
280280
{
281+
if (INF === $default) {
282+
return 'INF';
283+
}
284+
281285
if (is_string($default)) {
282286
$default = OutputFormatter::escape($default);
283287
} 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+
}

0 commit comments

Comments
 (0)