Skip to content

Commit ec898dc

Browse files
committed
Fix PHP 7: Cannot unpack array with string keys
1 parent 1b096e2 commit ec898dc

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/main/php/util/log/LogConfiguration.class.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,13 @@ private function appendersFor($properties, $section) {
6767
// Class
6868
if ($class= $properties->readString($section, 'class', null)) {
6969
try {
70-
$appender= Reflection::type($class)->newInstance(...$properties->readArray($section, 'args', []));
70+
$type= Reflection::type($class);
71+
if ($ctor= $type->constructor()) {
72+
$appender= $ctor->newInstance($properties->readArray($section, 'args', []));
73+
} else {
74+
$appender= $type->newInstance();
75+
}
76+
7177
if ($layout= $properties->readString($section, 'layout', null)) {
7278
if (false !== ($p= strcspn($layout, '('))) {
7379
$appender->setLayout(Reflection::type(substr($layout, 0, $p))->newInstance(...eval(

0 commit comments

Comments
 (0)