Skip to content

Commit 0b14453

Browse files
committed
Merge pull request #1 from tractorcow/pulls/fix-create
BUG Fix ReflectionInstance::newInstanceArgs crashing
2 parents 6e47a59 + d25ecfe commit 0b14453

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

code/SegmentFieldModifier/AbstractSegmentFieldModifier.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
use SilverStripe\Forms\SegmentFieldModifier;
88

99
abstract class AbstractSegmentFieldModifier implements SegmentFieldModifier {
10+
11+
public function __construct() {
12+
// required so that ReflectionInstance::newInstanceArgs doesn't fail
13+
}
14+
1015
/**
1116
* @var mixed
1217
*/
@@ -88,6 +93,10 @@ public function getRequest() {
8893
public static function create() {
8994
$reflection = new ReflectionClass(get_called_class());
9095

91-
return $reflection->newInstanceArgs(func_get_args());
96+
if(func_num_args()) {
97+
return $reflection->newInstanceArgs(func_get_args());
98+
} else {
99+
return $reflection->newInstance();
100+
}
92101
}
93102
}

0 commit comments

Comments
 (0)