Skip to content

Commit

Permalink
Fix PHP 7: Cannot unpack array with string keys
Browse files Browse the repository at this point in the history
  • Loading branch information
thekid committed Mar 28, 2024
1 parent 1b096e2 commit ec898dc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/php/util/log/LogConfiguration.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,13 @@ private function appendersFor($properties, $section) {
// Class
if ($class= $properties->readString($section, 'class', null)) {
try {
$appender= Reflection::type($class)->newInstance(...$properties->readArray($section, 'args', []));
$type= Reflection::type($class);
if ($ctor= $type->constructor()) {
$appender= $ctor->newInstance($properties->readArray($section, 'args', []));
} else {
$appender= $type->newInstance();
}

if ($layout= $properties->readString($section, 'layout', null)) {
if (false !== ($p= strcspn($layout, '('))) {
$appender->setLayout(Reflection::type(substr($layout, 0, $p))->newInstance(...eval(
Expand Down

0 comments on commit ec898dc

Please sign in to comment.