Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f0515c0

Browse filesBrowse files
committed
Merge pull request symfony#85 from stof/patch-1
Fix lower bounds for an advisory
2 parents 513cffa + 275c397 commit f0515c0
Copy full SHA for f0515c0

File tree

2 files changed

+22
-7
lines changed
Filter options

2 files changed

+22
-7
lines changed

‎namshi/jose/2015-02-19.yaml

Copy file name to clipboardExpand all lines: namshi/jose/2015-02-19.yaml
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ branches:
77
versions: [<1.1.2]
88
"1.2":
99
time: 2015-02-19 10:59:35
10-
versions: [<1.2.2]
10+
versions: [>=1.2.0,<1.2.2]
1111
"2.0":
1212
time: 2015-02-19 10:59:35
13-
versions: [<2.0.3]
13+
versions: [>=2.0.0,<2.0.3]
1414
"2.1":
1515
time: 2015-02-19 10:59:35
16-
versions: [<2.1.2]
16+
versions: [>=2.1.0,<2.1.2]
1717
reference: composer://namshi/jose

‎validator.php

Copy file name to clipboardExpand all lines: validator.php
+19-4Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@
8484
continue; // Don't validate branches when not set to avoid notices
8585
}
8686

87+
$upperBoundWithoutLowerBound = null;
88+
8789
foreach ($data['branches'] as $name => $branch) {
8890
if (!preg_match('/^([\d\.\-]+(\.x)?(\-dev)?|master)$/', $name)) {
8991
$messages[$path][] = sprintf('Invalid branch name "%s".', $name);
@@ -104,17 +106,30 @@
104106
} elseif (!is_array($branch['versions'])) {
105107
$messages[$path][] = sprintf('"versions" must be an array for branch "%s".', $name);
106108
} else {
107-
$hasMax = false;
109+
$upperBound = null;
110+
$hasMin = false;
108111
foreach ($branch['versions'] as $version) {
109112
if ('<' === substr($version, 0, 1)) {
110-
$hasMax = true;
111-
break;
113+
$upperBound = $version;
114+
continue;
115+
}
116+
if ('>' === substr($version, 0, 1)) {
117+
$hasMin = true;
112118
}
113119
}
114120

115-
if (!$hasMax) {
121+
if (null === $upperBound) {
116122
$messages[$path][] = sprintf('"versions" must have an upper bound for branch "%s".', $name);
117123
}
124+
125+
if (!$hasMin && null === $upperBoundWithoutLowerBound) {
126+
$upperBoundWithoutLowerBound = $upperBound;
127+
}
128+
129+
// Branches can omit the lower bound only if their upper bound is the same than for other branches without lower bound.
130+
if (!$hasMin && $upperBoundWithoutLowerBound !== $upperBound) {
131+
$messages[$path][] = sprintf('"versions" must have a lower bound for branch "%s" to avoid overlapping lower branches.', $name);
132+
}
118133
}
119134
}
120135
} catch (ParseException $e) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.