Skip to content

Commit 0e9b543

Browse files
committed
AC-3643 fixed logic affected by PHP8.1 compatibility issues
1 parent b2bfd05 commit 0e9b543

File tree

2 files changed

+3
-2
lines changed
  • app/code/Magento/Elasticsearch/SearchAdapter/Query/Builder
  • lib/internal/Magento/Framework

2 files changed

+3
-2
lines changed

app/code/Magento/Elasticsearch/SearchAdapter/Query/Builder/Sort.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function getSort(RequestInterface $request)
9292
if (in_array($item['field'], $this->skippedFields)) {
9393
continue;
9494
}
95-
$attribute = $this->attributeAdapterProvider->getByAttributeCode($item['field']);
95+
$attribute = $this->attributeAdapterProvider->getByAttributeCode((string)$item['field']);
9696
$fieldName = $this->fieldNameResolver->getFieldName($attribute);
9797
if (isset($this->map[$fieldName])) {
9898
$fieldName = $this->map[$fieldName];

lib/internal/Magento/Framework/DataObject.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ public function unsetData($key = null)
120120
* @param string $key
121121
* @param string|int $index
122122
* @return mixed
123+
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
123124
*/
124125
public function getData($key = '', $index = null)
125126
{
@@ -128,7 +129,7 @@ public function getData($key = '', $index = null)
128129
}
129130

130131
/* process a/b/c key as ['a']['b']['c'] */
131-
if (strpos((string)$key, '/') !== false) {
132+
if ($key !== null && strpos($key, '/') !== false) {
132133
$data = $this->getDataByPath($key);
133134
} else {
134135
$data = $this->_getData($key);

0 commit comments

Comments
 (0)