Skip to content

Commit 92002c1

Browse files
committed
Added fixes for using call_user_func_array with associative arrays
1 parent 926a8ad commit 92002c1

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/internal/Magento/Framework/DB/AbstractMapper.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ public function map(CriteriaInterface $criteria)
126126
if (!is_array($value)) {
127127
throw new \InvalidArgumentException('Wrong type of argument, expecting array for '. $mapperMethod);
128128
}
129-
call_user_func_array([$this, $mapperMethod], ...[$value]);
129+
// The `array_values` is a workaround to ensure the same behavior in PHP 7 and 8.
130+
call_user_func_array([$this, $mapperMethod], array_values($value));
130131
}
131132
}
132133
return $this->select;

lib/internal/Magento/Framework/View/Layout/Generator/Block.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,8 @@ protected function generateAction($block, $methodName, $actionArguments)
299299
$profilerKey = 'BLOCK_ACTION:' . $block->getNameInLayout() . '>' . $methodName;
300300
\Magento\Framework\Profiler::start($profilerKey);
301301
$args = $this->evaluateArguments($actionArguments);
302-
call_user_func_array([$block, $methodName], ...[$args]);
302+
// The `array_values` is a workaround to ensure the same behavior in PHP 7 and 8.
303+
call_user_func_array([$block, $methodName], array_values($args));
303304
\Magento\Framework\Profiler::stop($profilerKey);
304305
}
305306

0 commit comments

Comments
 (0)