Skip to content

Commit 3b08bbe

Browse files
committed
Merge remote-tracking branch 'origin/develop' into MCLOUD-10604
2 parents 1cc7c09 + 65edb6e commit 3b08bbe

14 files changed

+169
-12
lines changed

patches.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,5 +399,10 @@
399399
">=2.3.4-p2 <2.3.7-p3 || >=2.4.0 <2.4.3": "MDVA-43443__parser_token_new_fix__2.3.4-p2.patch",
400400
">=2.4.3 <2.4.3-p2": "MDVA-43443__parser_token_new_fix__2.4.3.patch"
401401
}
402+
},
403+
"magento/framework": {
404+
"Fix regexp cache tag validation": {
405+
">=103.0.6 <103.0.7": "MCLOUD-10226__fix_regexp_cache_tag_validation__2.4.6.patch"
406+
}
402407
}
403408
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
diff -Naur a/vendor/magento/framework/Cache/Core.php b/vendor/magento/framework/Cache/Core.php
2+
--- a/vendor/magento/framework/Cache/Core.php 2023-02-23 14:11:04
3+
+++ b/vendor/magento/framework/Cache/Core.php 2023-04-14 11:54:58
4+
@@ -5,6 +5,10 @@ namespace Magento\Framework\Cache;
5+
*/
6+
namespace Magento\Framework\Cache;
7+
8+
+use Magento\Framework\Cache\Backend\Redis;
9+
+use Zend_Cache;
10+
+use Zend_Cache_Exception;
11+
+
12+
class Core extends \Zend_Cache_Core
13+
{
14+
/**
15+
@@ -124,6 +128,34 @@ class Core extends \Zend_Cache_Core
16+
{
17+
$tags = $this->_tags($tags);
18+
return parent::getIdsNotMatchingTags($tags);
19+
+ }
20+
+
21+
+ /**
22+
+ * Validate a cache id or a tag (security, reliable filenames, reserved prefixes...)
23+
+ *
24+
+ * Throw an exception if a problem is found
25+
+ *
26+
+ * @param string $string Cache id or tag
27+
+ * @throws Zend_Cache_Exception
28+
+ * @return void
29+
+ */
30+
+ protected function _validateIdOrTag($string)
31+
+ {
32+
+ if ($this->_backend instanceof Redis) {
33+
+ if (!is_string($string)) {
34+
+ Zend_Cache::throwException('Invalid id or tag : must be a string');
35+
+ }
36+
+ if (substr($string, 0, 9) == 'internal-') {
37+
+ Zend_Cache::throwException('"internal-*" ids or tags are reserved');
38+
+ }
39+
+ if (!preg_match('~^[a-zA-Z0-9_{}]+$~D', $string)) {
40+
+ Zend_Cache::throwException("Invalid id or tag '$string' : must use only [a-zA-Z0-9_{}]");
41+
+ }
42+
+
43+
+ return;
44+
+ }
45+
+
46+
+ parent::_validateIdOrTag($string);
47+
}
48+
49+
/**

src/Command/Process/Action/ConfirmRequiredAction.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
*/
2222
class ConfirmRequiredAction implements ActionInterface
2323
{
24+
const PATCH_INFO_URL = "https://experienceleague.adobe.com/tools/commerce-quality-patches/index.html";
25+
2426
/**
2527
* @var OptionalPool
2628
*/
@@ -76,10 +78,16 @@ function ($patch) {
7678
}
7779

7880
if ($requiredNotAppliedPatches) {
81+
$url = self::PATCH_INFO_URL . '?keyword=' . current($patchFilter);
82+
$output->writeln(
83+
'<info>Please double check patch details and requirements at ' .
84+
sprintf('<href=%1$s>%1$s</>', $url) .
85+
'</info>' .
86+
PHP_EOL
87+
);
7988
$output->writeln(
8089
'<info>Next patches are required by ' . implode(' ', $patchFilter) . ':</info>' . PHP_EOL
8190
);
82-
8391
$aggregatedPatches = $this->aggregator->aggregate($requiredNotAppliedPatches);
8492
$this->renderer->printTable($output, $aggregatedPatches);
8593

src/Command/Process/Renderer.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,11 @@ function ($item) {
220220
$details .= 'Affected components:' . $glue . implode($glue, $patch->getAffectedComponents());
221221
}
222222

223+
if ($patch->getRequirements()) {
224+
$requirements = rtrim(chunk_split($patch->getRequirements(), 50, PHP_EOL));
225+
$details .= PHP_EOL . '<comment>Requirements:</comment>' . PHP_EOL . ' - ' . $requirements;
226+
}
227+
223228
$id = $patch->getType() === PatchInterface::TYPE_CUSTOM ? 'N/A' : $patch->getId();
224229
$title = chunk_split($patch->getTitle(), 60, PHP_EOL);
225230

src/Command/Process/ShowStatus.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,9 @@ private function getPatchCategories(array $patches): array
284284
*/
285285
private function printDetailsInfo(OutputInterface $output)
286286
{
287-
$supportUrl = 'https://support.magento.com';
288-
$releaseNotesUrl = 'https://devdocs.magento.com/quality-patches/release-notes.html';
287+
// phpcs:ignore
288+
$releaseNotesUrl = 'https://experienceleague.adobe.com/docs/commerce-operations/tools/quality-patches-tool/release-notes.html';
289+
$supportUrl = 'https://experienceleague.adobe.com/tools/commerce-quality-patches/index.html';
289290

290291
$output->writeln(
291292
'<info>Patch details you can find on </info>' .

src/Patch/AggregatedPatchFactory.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public function create(
3636
$require = $this->getRequire($items);
3737
$replacedWith = $this->getReplacedWith($items);
3838
$isDeprecated = $this->isDeprecated($items);
39+
$requirements = $this->getRequirements($items);
3940

4041
return new AggregatedPatch(
4142
$id,
@@ -47,7 +48,8 @@ public function create(
4748
$require,
4849
$replacedWith,
4950
$isDeprecated,
50-
$items
51+
$items,
52+
$requirements
5153
);
5254
}
5355

@@ -189,4 +191,17 @@ private function isDeprecated(array $patches): bool
189191

190192
return false;
191193
}
194+
195+
/**
196+
* Returns aggregated patch requirements.
197+
*
198+
* @param PatchInterface[] $patches
199+
* @return string
200+
*/
201+
private function getRequirements(array $patches): string
202+
{
203+
$patch = reset($patches);
204+
205+
return $patch->getRequirements();
206+
}
192207
}

src/Patch/Collector/SupportCollector.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ class SupportCollector implements CollectorInterface
5555

5656
const ORIGIN = 'Adobe Commerce Support';
5757

58+
const PROP_REQUIREMENTS = 'requirements';
59+
5860
/**
5961
* @var Package
6062
*/
@@ -113,6 +115,7 @@ public function collect(): array
113115
$category = !empty($patchGeneralConfig[self::PROP_CATEGORIES])
114116
? array_map('trim', $patchGeneralConfig[self::PROP_CATEGORIES])
115117
: ['Other'];
118+
$patchRequirements = $patchGeneralConfig[self::PROP_REQUIREMENTS] ?? '';
116119

117120
if ($this->package->matchConstraint($packageName, $packageConstraint)) {
118121
$result[] = $this->createPatch(
@@ -124,7 +127,8 @@ public function collect(): array
124127
$packageConstraint,
125128
$patchRequire,
126129
$patchReplacedWith,
127-
$patchDeprecated
130+
$patchDeprecated,
131+
$patchRequirements
128132
);
129133
}
130134
}
@@ -145,9 +149,11 @@ public function collect(): array
145149
* @param array $patchRequire
146150
* @param string $patchReplacedWith
147151
* @param bool $patchDeprecated
152+
* @param string $patchRequirements
148153
*
149154
* @return PatchInterface
150155
* @throws CollectorException
156+
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
151157
*/
152158
private function createPatch(
153159
string $patchId,
@@ -158,7 +164,8 @@ private function createPatch(
158164
string $packageConstraint,
159165
array $patchRequire,
160166
string $patchReplacedWith,
161-
bool $patchDeprecated
167+
bool $patchDeprecated,
168+
string $patchRequirements
162169
): PatchInterface {
163170
try {
164171
$patchPath = $this->qualityPackage->getPatchesDirectoryPath() . '/' . $patchFile;
@@ -174,6 +181,7 @@ private function createPatch(
174181
$this->patchBuilder->setRequire($patchRequire);
175182
$this->patchBuilder->setReplacedWith($patchReplacedWith);
176183
$this->patchBuilder->setDeprecated($patchDeprecated);
184+
$this->patchBuilder->setRequirements($patchRequirements);
177185
$patch = $this->patchBuilder->build();
178186
} catch (PatchIntegrityException $e) {
179187
throw new CollectorException($e->getMessage(), $e->getCode(), $e);

src/Patch/Data/AggregatedPatch.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ class AggregatedPatch implements AggregatedPatchInterface
6262
*/
6363
private $origin;
6464

65+
/**
66+
* @var string
67+
*/
68+
private $requirements = '';
69+
6570
/**
6671
* @param string $id
6772
* @param string $type
@@ -85,7 +90,8 @@ public function __construct(
8590
array $require,
8691
string $replacedWith,
8792
bool $isDeprecated,
88-
array $items
93+
array $items,
94+
string $requirements = ''
8995
) {
9096

9197
$this->id = $id;
@@ -98,6 +104,7 @@ public function __construct(
98104
$this->replacedWith = $replacedWith;
99105
$this->isDeprecated = $isDeprecated;
100106
$this->items = $items;
107+
$this->requirements = $requirements;
101108
}
102109

103110
/**
@@ -187,4 +194,11 @@ public function getItems(): array
187194
{
188195
return $this->items;
189196
}
197+
/**
198+
* @inheritDoc
199+
*/
200+
public function getRequirements(): string
201+
{
202+
return $this->requirements;
203+
}
190204
}

src/Patch/Data/AggregatedPatchInterface.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,11 @@ public function isDeprecated(): bool;
8383
* @return PatchInterface[]
8484
*/
8585
public function getItems(): array;
86+
87+
/**
88+
* Patch requirements.
89+
*
90+
* @return string
91+
*/
92+
public function getRequirements(): string;
8693
}

src/Patch/Data/Patch.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ class Patch implements PatchInterface
7676
*/
7777
private $origin;
7878

79+
/**
80+
* @var string
81+
*/
82+
private $requirements = '';
83+
7984
/**
8085
* @param string $id
8186
* @param string $type
@@ -90,6 +95,7 @@ class Patch implements PatchInterface
9095
* @param string[] $require
9196
* @param string $replacedWith
9297
* @param bool $isDeprecated
98+
* @param string $requirements
9399
*
94100
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
95101
*/
@@ -106,7 +112,8 @@ public function __construct(
106112
array $affectedComponents,
107113
array $require,
108114
string $replacedWith,
109-
bool $isDeprecated
115+
bool $isDeprecated,
116+
string $requirements = ''
110117
) {
111118

112119
$this->id = $id;
@@ -122,6 +129,7 @@ public function __construct(
122129
$this->require = $require;
123130
$this->replacedWith = $replacedWith;
124131
$this->isDeprecated = $isDeprecated;
132+
$this->requirements = $requirements;
125133
}
126134

127135
/**
@@ -235,4 +243,12 @@ public function isDeprecated(): bool
235243
{
236244
return $this->isDeprecated;
237245
}
246+
247+
/**
248+
* @inheritDoc
249+
*/
250+
public function getRequirements(): string
251+
{
252+
return $this->requirements;
253+
}
238254
}

0 commit comments

Comments
 (0)