1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-21 14:02:59 +02:00

Fix issue processwire/processwire-issues#535 missing null check for return value from getInputfield() in ProcessField

This commit is contained in:
Ryan Cramer
2018-03-15 08:55:27 -04:00
parent eb95498183
commit bd72c59e41

View File

@@ -1012,7 +1012,8 @@ class ProcessField extends Process implements ConfigurableModule {
$fieldtypeNames = $this->field->type->getConfigAllowContext($this->field); $fieldtypeNames = $this->field->type->getConfigAllowContext($this->field);
if(!is_array($fieldtypeNames)) $fieldtypeNames = array(); if(!is_array($fieldtypeNames)) $fieldtypeNames = array();
$dummyPage = $this->wire('pages')->get("/"); // only using this to satisfy param requirement $dummyPage = $this->wire('pages')->get("/"); // only using this to satisfy param requirement
$inputfieldNames = $this->field->getInputfield($dummyPage)->getConfigAllowContext($this->field); $inputfield = $this->field->getInputfield($dummyPage);
$inputfieldNames = $inputfield ? $inputfield->getConfigAllowContext($this->field) : array();
if(!is_array($inputfieldNames)) $inputfieldNames = array(); if(!is_array($inputfieldNames)) $inputfieldNames = array();
$alwaysSelected = array_merge($fieldtypeNames, $inputfieldNames); $alwaysSelected = array_merge($fieldtypeNames, $inputfieldNames);
$allowContexts = $this->field->get('allowContexts'); $allowContexts = $this->field->get('allowContexts');