Skip to content

Commit 3a41f42

Browse files
committed
Fix more PHP 8 warnings
Fixes #560 #618
1 parent 765d0d5 commit 3a41f42

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

helper/field.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,14 @@ public function renderfield($params, Doku_Form $form, $formid)
109109
*/
110110
protected function createValue()
111111
{
112-
$preparedValue = $this->opt['value'];
112+
$preparedValue = $this->opt['value'] ?? '';
113113

114114
// page fields might need to be JSON encoded depending on usetitles config
115115
if (
116116
$this->column->getType() instanceof Page
117117
&& $this->column->getType()->getConfig()['usetitles']
118118
) {
119-
$preparedValue = json_encode([$this->opt['value'], null]);
119+
$preparedValue = json_encode([$preparedValue, null]);
120120
}
121121

122122
$value = new Value($this->column, $preparedValue);

meta/ConfigParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct($lines)
4242
);
4343
// parse info
4444
foreach ($lines as $line) {
45-
list($key, $val) = $this->splitLine($line);
45+
list($key, $val) = array_pad($this->splitLine($line), 2, '');
4646
if (!$key) continue;
4747

4848
$logic = 'OR';

meta/SchemaBuilder.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,10 @@ protected function updateColumns()
178178
// we should probably have a list of fields at one place
179179
$newEntry['config'] = $this->data['cols'][$column->getColref()]['config'];
180180
$newEntry['label'] = $this->data['cols'][$column->getColref()]['label'];
181-
$newEntry['ismulti'] = $this->data['cols'][$column->getColref()]['ismulti'];
181+
$newEntry['ismulti'] = $this->data['cols'][$column->getColref()]['ismulti'] ?? 0;
182182
$newEntry['class'] = $this->data['cols'][$column->getColref()]['class'];
183183
$sort = $this->data['cols'][$column->getColref()]['sort'];
184-
$enabled = (bool)$this->data['cols'][$column->getColref()]['isenabled'];
184+
$enabled = (bool)($this->data['cols'][$column->getColref()]['isenabled'] ?? 0);
185185

186186
// when the type definition has changed, we create a new one
187187
if (array_diff_assoc($oldEntry, $newEntry)) {
@@ -265,7 +265,7 @@ protected function addColumns()
265265
$newEntry = array();
266266
$newEntry['config'] = $column['config'] ?? '{}';
267267
$newEntry['label'] = $column['label'];
268-
$newEntry['ismulti'] = $column['ismulti'];
268+
$newEntry['ismulti'] = $column['ismulti'] ?? 0;
269269
$newEntry['class'] = $column['class'];
270270
$sort = $column['sort'];
271271

0 commit comments

Comments
 (0)