You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2023-07-13 17:45:29

J2C99
Member
Registered: 2020-08-11
Posts: 107

[GLPI 10.0.7/Fields 1.20.4] UPDATE par API REST KO

Bonjour

  J'arrive à effectuer des updates de champs supplémentaire par curl en [GLPI 9.5.11/Fields 1.12.5]  mais plus en [GLPI 10.0.7/Fields 1.20.4]

curl --insecure -v --compressed -X PUT  -v -H 'Content-Type:  application/json' -H 'App-Token: ***' -H 'Session-Token: ***' -d '{
  "input": {
    "id":          525,
    "listefield":  "AdminCNT;Admins du domaine;GR-BO-EXPL;MigrationACC"
}}'  http://******/apirest.php/Computer/4138/PluginFieldsComputerchampssupplmentaire

le curl me renvoit bien un HTTP/200, toutefois j'ai cet erreur dans php-errors.log.

[2023-07-13 17:22:32] glpiphplog.CRITICAL:   *** Uncaught Exception TypeError: property_exists(): Argument #1 ($object_or_class) must be of type object|string, array given in /var/www/glpi-10.0.7/src/Api/API.php at line 1984
  Backtrace :
  src/Api/API.php:1984                         property_exists()
  src/Api/APIRest.php:326                     Glpi\Api\API->updateItems()
  apirest.php:57                                   Glpi\Api\APIRest->call()
  public/index.php:73                           require()



je n'arrive pas trop à comprendre la cause du pbm

Merci d'avance pour votre aide

Cordialement

JCC

Offline

#2 2023-07-13 18:41:14

J2C99
Member
Registered: 2020-08-11
Posts: 107

Re: [GLPI 10.0.7/Fields 1.20.4] UPDATE par API REST KO

En premiere analyse , il se pourrait que ce soit un bug dans 'src/Api/API.php'



Lgn 1953:        if (is_array($input)) {                  #on teste si input est un array
...
Lgn 1957:            foreach ($input as $object) {   # on boucle
...
Lgn 1986:                  if (!property_exists($input, $fk_parent)) {   # et la c'est le drame ..!



Le type du premier argement est Array , mais property_exists veut un objet ou string, ce qui ne correspond pas à un array
D'ou le message 'Uncaught Exception TypeError: property_exists(): Argument #1 ($object_or_class) must be of type object|string, array given in /var/www/glpi-10.0.7/src/Api/API.php at line 1983'

Offline

#3 2023-07-14 17:22:20

cconard96
Moderator
Registered: 2018-07-31
Posts: 2,435
Website

Re: [GLPI 10.0.7/Fields 1.20.4] UPDATE par API REST KO

Pouvez-vous signaler le bogue sur le GLPI GitHub avec des étapes pour recréer le problème et le problème potentiel dans le code que vous avez trouvé ?

https://github.com/glpi-project/glpi/is … report.yml


GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.

Offline

#4 2023-07-17 10:07:07

J2C99
Member
Registered: 2020-08-11
Posts: 107

Re: [GLPI 10.0.7/Fields 1.20.4] UPDATE par API REST KO

Offline

#5 2024-01-23 12:32:30

J2C99
Member
Registered: 2020-08-11
Posts: 107

Re: [GLPI 10.0.7/Fields 1.20.4] UPDATE par API REST KO

Merci de spécifier ce bug comme résolu

Offline

Board footer

Powered by FluxBB