Skip to content

Commit 08fba0e

Browse files
committed
Revert "AC-7422:Incompatible issues fix for PHP8.2"
This reverts commit ede05f2. Changes to be committed: modified: app/code/Magento/Sales/Helper/Admin.php modified: dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/MultiStoreCurrencyTest.php modified: dev/tests/integration/testsuite/Magento/Sales/Helper/AdminTest.php modified: lib/internal/Magento/Framework/Escaper.php
1 parent 78dd77e commit 08fba0e

File tree

4 files changed

+9
-16
lines changed

4 files changed

+9
-16
lines changed

app/code/Magento/Sales/Helper/Admin.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,7 @@ public function escapeHtmlWithLinks($data, $allowedTags = null)
166166

167167
$internalErrors = libxml_use_internal_errors(true);
168168

169-
// phpcs:ignore Magento2.Functions.DiscouragedFunction
170-
$data = html_entity_decode(htmlentities($data, ENT_QUOTES, 'UTF-8'), ENT_QUOTES, 'ISO-8859-1');
171-
169+
$data = mb_convert_encoding($data, 'HTML-ENTITIES', 'UTF-8');
172170
$domDocument->loadHTML(
173171
'<html><body id="' . $wrapperElementId . '">' . $data . '</body></html>'
174172
);
@@ -194,7 +192,7 @@ public function escapeHtmlWithLinks($data, $allowedTags = null)
194192
}
195193
}
196194

197-
$result = htmlspecialchars_decode($domDocument->saveHTML(), ENT_QUOTES);
195+
$result = mb_convert_encoding($domDocument->saveHTML(), 'UTF-8', 'HTML-ENTITIES');
198196
preg_match('/<body id="' . $wrapperElementId . '">(.+)<\/body><\/html>$/si', $result, $matches);
199197
$data = !empty($matches) ? $matches[1] : '';
200198
}

dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/MultiStoreCurrencyTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function testMultiStoreRenderPrice(): void
5656

5757
$this->reloadProductPriceInfo();
5858
$this->localeResolver->setLocale('uk_UA');
59-
$this->assertProductStorePrice('simple2', '240,00 ', 'fixturestore');
59+
$this->assertProductStorePrice('simple2', '240,00 ', 'fixturestore');
6060
}
6161

6262
/**
@@ -80,7 +80,7 @@ public function testMultiStoreRenderSpecialPrice(): void
8080

8181
$this->reloadProductPriceInfo();
8282
$this->localeResolver->setLocale('uk_UA');
83-
$this->assertProductStorePrice('simple', 'Special Price 143,76  Regular Price 240,00 ', 'fixturestore');
83+
$this->assertProductStorePrice('simple', 'Special Price 143,76  Regular Price 240,00 ', 'fixturestore');
8484
}
8585

8686
/**
@@ -111,7 +111,7 @@ public function testMultiStoreRenderTierPrice(): void
111111
$this->localeResolver->setLocale('uk_UA');
112112
$this->assertProductStorePrice(
113113
'simple-product-tax-none',
114-
'Buy 2 for 960,00  each and save 80%',
114+
'Buy 2 for 960,00  each and save 80%',
115115
'fixturestore',
116116
self::TIER_PRICE_BLOCK_NAME
117117
);

dev/tests/integration/testsuite/Magento/Sales/Helper/AdminTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function escapeHtmlWithLinksDataProvider(): array
5555
[
5656
// @codingStandardsIgnoreStart
5757
'Authorized amount of €30.00. Transaction ID: "<a target="_blank" href="https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_view-a-trans&id=123456789QWERTY">123456789QWERTY</a>"',
58-
'Authorized amount of &euro;30.00. Transaction ID: &quot;<a href="https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_view-a-trans&amp;id=123456789QWERTY">123456789QWERTY</a>&quot;',
58+
'Authorized amount of 30.00. Transaction ID: &quot;<a href="https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_view-a-trans&amp;id=123456789QWERTY">123456789QWERTY</a>&quot;',
5959
// @codingStandardsIgnoreEnd
6060
'allowedTags' => ['b', 'br', 'strong', 'i', 'u', 'a'],
6161
],

lib/internal/Magento/Framework/Escaper.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Escaper
1717
{
1818
/**
1919
* HTML special characters flag
20-
* @var $htmlSpecialCharsFlag
20+
* @var int
2121
*/
2222
private $htmlSpecialCharsFlag = ENT_QUOTES | ENT_SUBSTITUTE;
2323

@@ -97,7 +97,7 @@ function ($errorNumber, $errorString) {
9797
}
9898
);
9999
$data = $this->prepareUnescapedCharacters($data);
100-
$string = @iconv("UTF-8", "ISO-8859-1//IGNORE", $data);
100+
$string = mb_convert_encoding($data, 'HTML-ENTITIES', 'UTF-8');
101101
try {
102102
$domDocument->loadHTML(
103103
'<html><body id="' . $wrapperElementId . '">' . $string . '</body></html>'
@@ -114,7 +114,7 @@ function ($errorNumber, $errorString) {
114114
$this->escapeText($domDocument);
115115
$this->escapeAttributeValues($domDocument);
116116

117-
$result = html_entity_decode($domDocument->saveHTML(), ENT_QUOTES, 'UTF-8');
117+
$result = mb_convert_encoding($domDocument->saveHTML(), 'UTF-8', 'HTML-ENTITIES');
118118
preg_match('/<body id="' . $wrapperElementId . '">(.+)<\/body><\/html>$/si', $result, $matches);
119119
return !empty($matches) ? $matches[1] : '';
120120
} else {
@@ -347,7 +347,6 @@ public function escapeCss($string)
347347
* @param string $quote
348348
* @return string|array
349349
* @deprecated 101.0.0
350-
* @see 6729b6e01368248abc33300208eb292c95050203
351350
*/
352351
public function escapeJsQuote($data, $quote = '\'')
353352
{
@@ -368,7 +367,6 @@ public function escapeJsQuote($data, $quote = '\'')
368367
* @param string $data
369368
* @return string
370369
* @deprecated 101.0.0
371-
* @see 6729b6e01368248abc33300208eb292c95050203
372370
*/
373371
public function escapeXssInUrl($data)
374372
{
@@ -417,7 +415,6 @@ private function escapeScriptIdentifiers(string $data): string
417415
* @param bool $addSlashes
418416
* @return string
419417
* @deprecated 101.0.0
420-
* @see 6729b6e01368248abc33300208eb292c95050203
421418
*/
422419
public function escapeQuote($data, $addSlashes = false)
423420
{
@@ -432,7 +429,6 @@ public function escapeQuote($data, $addSlashes = false)
432429
*
433430
* @return \Magento\Framework\ZendEscaper
434431
* @deprecated 101.0.0
435-
* @see 6729b6e01368248abc33300208eb292c95050203
436432
*/
437433
private function getEscaper()
438434
{
@@ -448,7 +444,6 @@ private function getEscaper()
448444
*
449445
* @return \Psr\Log\LoggerInterface
450446
* @deprecated 101.0.0
451-
* @see 6729b6e01368248abc33300208eb292c95050203
452447
*/
453448
private function getLogger()
454449
{

0 commit comments

Comments
 (0)