Skip to content

Commit 147992c

Browse files
Merge branch '2.4-develop' into ACQE-functional-deployment-version7
2 parents 0b0721c + ebedc8a commit 147992c

File tree

7 files changed

+153
-23
lines changed

7 files changed

+153
-23
lines changed

app/bootstrap.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,6 @@
5050
$mask = file_exists($umaskFile) ? octdec(file_get_contents($umaskFile)) : 002;
5151
umask($mask);
5252

53-
if (empty($_SERVER['ENABLE_IIS_REWRITES']) || ($_SERVER['ENABLE_IIS_REWRITES'] != 1)) {
54-
/*
55-
* Unset headers used by IIS URL rewrites.
56-
*/
57-
unset($_SERVER['HTTP_X_REWRITE_URL']);
58-
unset($_SERVER['HTTP_X_ORIGINAL_URL']);
59-
unset($_SERVER['IIS_WasUrlRewritten']);
60-
unset($_SERVER['UNENCODED_URL']);
61-
unset($_SERVER['ORIG_PATH_INFO']);
62-
}
63-
6453
if (
6554
(!empty($_SERVER['MAGE_PROFILER']) || file_exists(BP . '/var/profiler.flag'))
6655
&& isset($_SERVER['HTTP_ACCEPT'])

app/code/Magento/Catalog/Model/ResourceModel/Url.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ protected function _getCategories($categoryIds, $storeId = null, $path = null)
412412
if (!is_array($categoryIds)) {
413413
$categoryIds = [$categoryIds];
414414
}
415-
$isActiveExpr = $connection->getCheckSql('c.value_id > 0', 'c.value', 'c.value');
415+
$isActiveExpr = $connection->getCheckSql('c.value_id IS NOT NULL', 'c.value', 'd.value');
416416
$select = $connection->select()->from(
417417
['main_table' => $this->getTable('catalog_category_entity')],
418418
[

app/code/Magento/Catalog/view/adminhtml/web/js/product-gallery.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,14 @@ define([
355355
imageData.isRemoved = true;
356356
$imageContainer.addClass('removed').hide().find('.is-removed').val(1);
357357

358+
// Reset all image role/type selections to 'no_selection' value
359+
// For each role (like base image, small image, etc.), clears both
360+
// the UI select element and the internal types data structure
361+
$.each(this.options.types, $.proxy(function (index, type) {
362+
this.element.find('.image-' + type.code).val('no_selection');
363+
this.options.types[index].value = 'no_selection';
364+
}, this));
365+
358366
this._contentUpdated();
359367
},
360368

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
<?php
2+
/**
3+
* Copyright 2025 Adobe
4+
* All Rights Reserved.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Catalog\Model\ResourceModel;
9+
10+
use Magento\Catalog\Api\CategoryRepositoryInterface;
11+
use Magento\Catalog\Test\Fixture\Category as CategoryFixture;
12+
use Magento\Framework\Exception\CouldNotSaveException;
13+
use Magento\Framework\Exception\NoSuchEntityException;
14+
use Magento\Store\Model\StoreManagerInterface;
15+
use Magento\TestFramework\Fixture\DataFixture;
16+
use Magento\TestFramework\Fixture\DataFixtureStorage;
17+
use Magento\TestFramework\Fixture\DataFixtureStorageManager;
18+
use Magento\TestFramework\Fixture\DbIsolation;
19+
use Magento\TestFramework\Helper\Bootstrap;
20+
use PHPUnit\Framework\TestCase;
21+
22+
/**
23+
* Tests for the Catalog Url Resource Model.
24+
*/
25+
class UrlTest extends TestCase
26+
{
27+
/**
28+
* @var CategoryRepositoryInterface
29+
*/
30+
private CategoryRepositoryInterface $categoryRepository;
31+
32+
/**
33+
* @var DataFixtureStorage
34+
*/
35+
private DataFixtureStorage $fixtures;
36+
37+
/**
38+
* @var StoreManagerInterface
39+
*/
40+
private StoreManagerInterface $storeManager;
41+
42+
/**
43+
* @var Url
44+
*/
45+
private Url $urlResource;
46+
47+
protected function setUp(): void
48+
{
49+
$objectManager = Bootstrap::getObjectManager();
50+
$this->categoryRepository = $objectManager->create(CategoryRepositoryInterface::class);
51+
$this->fixtures = $objectManager->get(DataFixtureStorageManager::class)->getStorage();
52+
$this->storeManager = $objectManager->create(StoreManagerInterface::class);
53+
$this->urlResource = $objectManager->create(Url::class);
54+
}
55+
56+
/**
57+
* Test that scope is respected for the is_active flag.
58+
*
59+
* @return void
60+
* @throws NoSuchEntityException|CouldNotSaveException
61+
*/
62+
#[
63+
DbIsolation(true),
64+
DataFixture(CategoryFixture::class, [
65+
'name' => 'Enabled on default scope',
66+
'is_active' => '1',
67+
], 'c1'),
68+
DataFixture(CategoryFixture::class, [
69+
'name' => 'Disabled on default scope',
70+
'is_active' => '0',
71+
], 'c2'),
72+
DataFixture(CategoryFixture::class, [
73+
'name' => 'Enabled on default scope, disabled for store',
74+
'is_active' => '1',
75+
], 'c3'),
76+
DataFixture(CategoryFixture::class, [
77+
'name' => 'Disabled on default scope, enabled for store',
78+
'is_active' => '0',
79+
], 'c4'),
80+
]
81+
public function testIsActiveScope(): void
82+
{
83+
// Get Store ID
84+
$storeId = (int) $this->storeManager->getStore('default')->getId();
85+
86+
// Get Category IDs
87+
$categoryIds = [];
88+
foreach (['c1', 'c2', 'c3', 'c4'] as $fixtureName) {
89+
$categoryIds[$fixtureName] = (int) $this->fixtures->get($fixtureName)->getId();
90+
}
91+
92+
// Disable c3 for store
93+
$c3 = $this->categoryRepository->get($categoryIds['c3'], $storeId);
94+
$c3->setIsActive(false);
95+
$this->categoryRepository->save($c3);
96+
97+
// Enable c4 for store
98+
$c4 = $this->categoryRepository->get($categoryIds['c4'], $storeId);
99+
$c4->setIsActive(true);
100+
$this->categoryRepository->save($c4);
101+
102+
// Check categories
103+
$categories = $this->urlResource->getCategories($categoryIds, $storeId);
104+
$this->assertSame('1', $categories[$categoryIds['c1']]->getIsActive());
105+
$this->assertSame('0', $categories[$categoryIds['c2']]->getIsActive());
106+
$this->assertSame('0', $categories[$categoryIds['c3']]->getIsActive());
107+
$this->assertSame('1', $categories[$categoryIds['c4']]->getIsActive());
108+
}
109+
}

lib/internal/Magento/Framework/View/Model/Layout/Merge.php

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2011 Adobe
4+
* All Rights Reserved.
55
*/
66
namespace Magento\Framework\View\Model\Layout;
77

@@ -564,6 +564,21 @@ protected function _loadXmlString($xmlString)
564564
return simplexml_load_string($xmlString, \Magento\Framework\View\Layout\Element::class);
565565
}
566566

567+
/**
568+
* Return object representation of XML string, or false, if XML was invalid
569+
*
570+
* @param string $xmlString
571+
* @return \SimpleXMLElement|false
572+
*/
573+
protected function _safeLoadXmlString(string $xmlString): \SimpleXMLElement|false
574+
{
575+
return simplexml_load_string(
576+
$xmlString,
577+
\Magento\Framework\View\Layout\Element::class,
578+
LIBXML_NOWARNING | LIBXML_NOERROR
579+
);
580+
}
581+
567582
/**
568583
* Merge layout update by handle
569584
*
@@ -988,15 +1003,7 @@ public function getCacheId()
9881003
private function extractHandlers(): void
9891004
{
9901005
foreach ($this->updates as $update) {
991-
$updateXml = null;
992-
993-
try {
994-
$updateXml = is_string($update) ? $this->_loadXmlString($update) : false;
995-
// phpcs:ignore Magento2.CodeAnalysis.EmptyBlock
996-
} catch (\Exception $exception) {
997-
// ignore invalid
998-
}
999-
1006+
$updateXml = is_string($update) ? $this->_safeLoadXmlString($update) : false;
10001007
if ($updateXml && strtolower($updateXml->getName()) == 'update' && isset($updateXml['handle'])) {
10011008
$this->addHandle((string)$updateXml['handle']);
10021009
}

nginx.conf.sample

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ location /.user.ini {
4747
location ~* ^/setup($|/) {
4848
root $MAGE_ROOT;
4949
location ~ ^/setup/index.php {
50+
deny all;
51+
# If you want to enable the web based setup functionality, add your
52+
# ip address to the allow list below or comment out the deny all above.
53+
# allow 127.0.0.1;
54+
5055
fastcgi_pass fastcgi_backend;
5156

5257
fastcgi_param PHP_FLAG "session.auto_start=off \n suhosin.session.cryptua=off";

setup/.htaccess

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
# If you want to enable the web based setup functionality, add your ip address
2+
# to the allow list below or comment out the IfVersion Deny deny blocks below.
3+
<Files "index.php">
4+
<IfVersion < 2.4>
5+
order allow,deny
6+
deny from all
7+
</IfVersion>
8+
<IfVersion >= 2.4>
9+
Require all denied
10+
</IfVersion>
11+
</Files>
12+
113
Options -Indexes
214

315
<IfModule mod_rewrite.c>

0 commit comments

Comments
 (0)