fusioninventory / fusioninventory-for-glpi

FusionInventory plugin for GLPI
http://www.FusionInventory.org/
GNU Affero General Public License v3.0
361 stars 148 forks source link

Undefined index name on XML import #2388

Open DIOHz0r opened 6 years ago

DIOHz0r commented 6 years ago

Hello,

I'm getting the following PHP notice when I use the XML import function from this plugin.

*** PHP Notice(8): Undefined index: name
  Backtrace :
  ...nventory\inc\inventorycomputerlib.class.php:187 
  ...ry\inc\inventorycomputerinventory.class.php:573 PluginFusioninventoryInventoryComputerLib->updateComputer()
  ...inventory\inc\inventoryruleimport.class.php:790 PluginFusioninventoryInventoryComputerInventory->rulepassed()
  inc\rule.class.php:1436                            PluginFusioninventoryInventoryRuleImport->executeActions()
  inc\rulecollection.class.php:1461                  Rule->process()
  ...ry\inc\inventorycomputerinventory.class.php:378 RuleCollection->processAllRules()
  ...ry\inc\inventorycomputerinventory.class.php:126 PluginFusioninventoryInventoryComputerInventory->sendCriteria()
  ...fusioninventory\inc\communication.class.php:234 PluginFusioninventoryInventoryComputerInventory->import()
  ...fusioninventory\inc\communication.class.php:463 PluginFusioninventoryCommunication->import()
  plugins\flyvemdm\inc\agent.class.php:1231          PluginFusioninventoryCommunication->handleOCSCommunication()
  plugins\flyvemdm\inc\agent.class.php:455           PluginFlyvemdmAgent->enrollByInvitationToken()
  inc\commondbtm.class.php:891                       PluginFlyvemdmAgent->prepareInputForAdd()
  ...s\suite-integration\PluginFlyvemdmAgent.php:871 CommonDBTM->add()
  ...\suite-integration\PluginFlyvemdmAgent.php:1000 tests\units\PluginFlyvemdmAgent->enrollFromInvitation()
  ...s\suite-integration\PluginFlyvemdmAgent.php:203 tests\units\PluginFlyvemdmAgent->agentFromInvitation()
  ...yvemdm\vendor\atoum\atoum\classes\test.php:1270 tests\units\PluginFlyvemdmAgent->testEnrollAgent()
  ...\atoum\atoum\classes\test\engines\inline.php:43 mageekguy\atoum\test->runTestMethod()
  ...yvemdm\vendor\atoum\atoum\classes\test.php:1807 mageekguy\atoum\test\engines\inline->run()
  ...yvemdm\vendor\atoum\atoum\classes\test.php:1716 mageekguy\atoum\test->runEngine()
  ...yvemdm\vendor\atoum\atoum\classes\test.php:1384 mageekguy\atoum\test->runEngines()
  ...vemdm\vendor\atoum\atoum\classes\runner.php:597 mageekguy\atoum\test->run()
  ...dor\atoum\atoum\classes\scripts\runner.php:1250 mageekguy\atoum\runner->run()
  ...vemdm\vendor\atoum\atoum\classes\script.php:285 mageekguy\atoum\scripts\runner->doRun()
  ...\atoum\atoum\classes\script\configurable.php:80 mageekguy\atoum\script->run()
  ...ndor\atoum\atoum\classes\scripts\runner.php:214 mageekguy\atoum\script\configurable->run()
  ...ndor\atoum\atoum\classes\scripts\runner.php:699 mageekguy\atoum\scripts\runner->run()
  :                                                  mageekguy\atoum\scripts\runner::mageekguy\atoum\scripts\{closure}()

This notice is from a functional test of the FlyveMDM project and not showed on the module for "XML importing" in F.I. plugin.

The handleOCSCommunication function for import the XML is called at this line and the problem is triggered on the test around this line

wawax commented 6 years ago

Hi @DIOHz0r ,

Could you provide an XML inventory file so we can try to reproduce ? Thanks.

DIOHz0r commented 6 years ago

Hello,

Here is the example XML file example.zip

wawax commented 6 years ago

Hi @DIOHz0r ,

I've got no error trying to import your XML file in using glpi 9.2 + fi glpi9.2 branch or glpi 9.3 and fi master branch... I'm unable to reproduce the bug ;(

DIOHz0r commented 6 years ago

Hello,

I don't remember right now but I think the issue is when you try to import the XML a lot of times. @btry was able to reproduce this bug, didn't you?.

wawax commented 6 years ago

I'd like more informations to reproduce the issue 👍

btry commented 6 years ago

Well, I helped with several intricated things with this issue. Too many mess to remember exactly now. But I did not identified a bug in Fusion here.

I retained that Fusion Inventory needs to be redesigned when it adds some entries in $_SESSION (we workarounded in Flyve MDM, and this workaround is crappy.