ocsinventoryng icon indicating copy to clipboard operation
ocsinventoryng copied to clipboard

PHP warning with 10.0.7

Open liedekef opened this issue 1 year ago • 9 comments

Hi, running ocsi inventory ng version 2.0.4 on GLPI 10.0.7, I see a lot of these PHP warnings in the GLPI error log:

[2023-06-16 13:21:38] glpiphplog.WARNING:   *** PHP Warning (2): Undefined array key "ocsservers_id" in /var/www/glpi/marketplace/ocsinventoryng/hook.php at line 1377
[2023-06-16 13:21:38] glpiphplog.WARNING:   *** PHP Warning (2): Undefined array key "plugin_ocsinventoryng_ocsservers_id" in /var/www/glpi/marketplace/ocsinventoryng/hook.php at line 1379
[2023-06-16 13:22:43] glpiphplog.WARNING:   *** PHP User Warning (512): Relation between "glpi_networkports" and "glpi_plugin_ocsinventoryng_networkports" table based on "networkports_id" field cannot be handled automatically as "networkports_id" also corresponds to index field of the target table. in /var/www/glpi/src/DbUtils.php at line 2099

While the first 2 can be contributed to the fact I haven't defined OCSI servers yet, it should still be handled more elegant :-) Next to that, the last one seems something that certainly needs fixing ...

liedekef avatar Jun 16 '23 11:06 liedekef

Hello have you found a solution ?

jlb5980 avatar Jun 30 '23 09:06 jlb5980

Haven't investigated further. Also it seems nobody of the devs is reacting in any way, and the main glpi dev-guys don't bother as well. Too bad, but it seems the plugins are being neglected a lot in my opinion.

liedekef avatar Jun 30 '23 09:06 liedekef

Sorry, I don't have much time at the moment. Moreover I'm not the original developer, I Just forked the plugin to be able to use It on glpi 10. We've not upgraded our instance, yet.

jackburton79 avatar Jun 30 '23 10:06 jackburton79

I'm guessing the indexes need to be named differently for ocsi: the index names seem to collide with those of regular glpi prefixing them with 'ocsi_' or so might already be sufficient.

liedekef avatar Jun 30 '23 11:06 liedekef

Is there any way to fix this error? Or offer a solution.

Roland-GoIT avatar Oct 24 '23 11:10 Roland-GoIT

Have you tried to set index networkports_id as non unique ?

jmichault avatar Jan 05 '24 09:01 jmichault

Hi, about the same problem for me.

config : Debian 12 - OCS 2.10 - GLPI 10.0.11

PHP Warning: Relation between "glpi_networkports" and "glpi_plugin_ocsinventoryng_networkports" table based on "networkports_id" field cannot be handled automatically as "networkports_id" also corresponds to index field of the target table. in /.../.../DbUtils.php on line 2154

tontonrico avatar Jan 17 '24 13:01 tontonrico

This Threads may help :

  • https://github.com/pluginsGLPI/ocsinventoryng/issues/362
  • https://github.com/pluginsGLPI/ocsinventoryng/issues/371

Latest commit 8433a48 fix the issue, download it from here : https://github.com/pluginsGLPI/ocsinventoryng/archive/8433a4822d7693619981adfcd0c5a934633a55ec.zip

roms2000 avatar Apr 14 '24 10:04 roms2000

Creation of dynamic property PluginOcsinventoryngOcsDbClient::$dbname is deprecated in /var/www/html/plugins/ocsinventoryng/inc/ocsdbclient.class.php at line 55

Roland-GoIT avatar Apr 15 '24 07:04 Roland-GoIT