Commit 91dee2fde62efdd42286d3e74ec0d181d9a3fbb2

Authored by Benjamin Renard
1 parent 41a65bfc

Fix bug with the call of empty function

Showing 1 changed file with 14 additions and 8 deletions   Show diff stats
php/classes/SharedObjectTreeFile.php
... ... @@ -91,9 +91,11 @@ class SharedObjectTreeFile {
91 91  
92 92 $folders = array();
93 93 foreach ($folderNodes as $folderNode) {
94   - if (empty($folderNode->getAttribute('name')) || empty($folderNode->getAttribute('xml:id')))
  94 + $nameAtt = $folderNode->getAttribute('name');
  95 + $idAtt = $folderNode->getAttribute('xml:id');
  96 + if (empty($nameAtt) || empty($idAtt))
95 97 continue;
96   - $folders[] = array('id' => $folderNode->getAttribute('xml:id'), 'name' => $folderNode->getAttribute('name'));
  98 + $folders[] = array('id' => $idAtt, 'name' => $nameAtt);
97 99 }
98 100  
99 101 return $folders;
... ... @@ -127,11 +129,13 @@ class SharedObjectTreeFile {
127 129 $folderNodes = $listNode->getElementsByTagName("folder");
128 130  
129 131 foreach ($folderNodes as $folderNode) {
130   - if (empty($folderNode->getAttribute('name')) || empty($folderNode->getAttribute('xml:id')))
  132 + $nameAtt = $folderNode->getAttribute('name');
  133 + $idAtt = $folderNode->getAttribute('xml:id');
  134 + if (empty($nameAtt) || empty($idAtt))
131 135 continue;
132   - if ($folder_id != $folderNode->getAttribute('xml:id'))
  136 + if ($folder_id != $idAtt)
133 137 continue;
134   - return $folderNode->getAttribute('name');
  138 + return $nameAtt;
135 139 }
136 140  
137 141 return FALSE;
... ... @@ -146,14 +150,16 @@ class SharedObjectTreeFile {
146 150 $folderNodes = $listNode->getElementsByTagName("folder");
147 151  
148 152 foreach ($folderNodes as $folderNode) {
149   - if (empty($folderNode->getAttribute('name')) || empty($folderNode->getAttribute('xml:id')))
  153 + $nameAtt = $folderNode->getAttribute('name');
  154 + $idAtt = $folderNode->getAttribute('xml:id');
  155 + if (empty($nameAtt) || empty($idAtt))
150 156 continue;
151 157  
152 158 $objectNodes = $folderNode->getElementsByTagName($object_type);
153 159  
154 160 foreach ($objectNodes as $objectNode) {
155   - if ($objectNode->getAttribute('xml:id') == $object_id)
156   - return $folderNode->getAttribute('xml:id');
  161 + if ($idAtt == $object_id)
  162 + return $idAtt;
157 163 }
158 164 }
159 165  
... ...