Commit 8731cbde authored by Côme Chilliet's avatar Côme Chilliet
Browse files

Fixes #5414 Added empty values for optional partition fields to avoid PHP errors

parent 1fd2b06b
...@@ -142,8 +142,10 @@ class PartitionTableAttribute extends DialogOrderedArrayAttribute ...@@ -142,8 +142,10 @@ class PartitionTableAttribute extends DialogOrderedArrayAttribute
$ldap->search($this->diskFilter, array('*'), 'one'); $ldap->search($this->diskFilter, array('*'), 'one');
$this->value = array(); $this->value = array();
while ($subattrs = $ldap->fetch()) { while ($subattrs = $ldap->fetch()) {
$diskInfos = array('description' => '', 'FAIdiskType' => 'disk'); $diskInfos = array(
$diskInfos['description'] = ''; 'description' => '',
'FAIdiskType' => 'disk'
);
foreach (array('cn', 'description','FAIdiskType') as $attr) { foreach (array('cn', 'description','FAIdiskType') as $attr) {
if (isset($subattrs[$attr][0])) { if (isset($subattrs[$attr][0])) {
$diskInfos[$attr] = $subattrs[$attr][0]; $diskInfos[$attr] = $subattrs[$attr][0];
...@@ -175,7 +177,10 @@ class PartitionTableAttribute extends DialogOrderedArrayAttribute ...@@ -175,7 +177,10 @@ class PartitionTableAttribute extends DialogOrderedArrayAttribute
$ldap->cd($disk['dn']); $ldap->cd($disk['dn']);
$ldap->search($this->partFilter, array('*'), 'one'); $ldap->search($this->partFilter, array('*'), 'one');
while ($obj = $ldap->fetch()) { while ($obj = $ldap->fetch()) {
$partitionInfos = array(); $partitionInfos = array(
'description' => '',
'FAIpartitionSize' => '',
);
foreach ($this->partitionAttributes as $attr) { foreach ($this->partitionAttributes as $attr) {
if (isset($obj[$attr][0])) { if (isset($obj[$attr][0])) {
$partitionInfos[$attr] = $obj[$attr][0]; $partitionInfos[$attr] = $obj[$attr][0];
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment