Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Error on exporting the error log

Aperta Adatta ai principianti
#673 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
84/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
php
Ambito
backend

Direzione di ricerca

Inizia da plugins/datainjection/front/clientinjection.form.php alla riga 75 e da plugins/datainjection/inc/clientinjection.class.php alla riga 349, quindi segui readUploadedFile() e la richiesta di esportazione in plugins/datainjection/front/export.csv.php. Verifica che il nome del file caricato sia ancora disponibile dopo l’elaborazione e che facendo clic su «Export the log» vengano scaricate le righe rifiutate come CSV senza un HTTP 500.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Code of Conduct
  • I agree to follow this project's Code of Conduct
Is there an existing issue for this?
  • I have searched the existing issues
GLPI Version

11.0.9

Plugin version

2.15.11

Bug description

Importing a CSV through the client injection wizard loses the "Export the log" feature as soon as the import produces even one failed line.

What happens:

  1. I upload a valid CSV file to a model and run the injection. Here, PHP output a warning "Undefined array key "filename" at clientinjection.form.php line 75"
  2. Some rows fail (bad values, duplicates, whatever). The result screen correctly shows them and offers "Export the log" so I can fix the CSV and re-import.
  3. Clicking "Export the log" downloads nothing — the request just dies with a server error (HTTP 500 on front/export.csv.php). There is no way to recover the list of rejected lines; the only option is to re-run the whole import and read errors on screen, line by line.
Relevant log output
Logs during the upload:

[2026-09-22 12:52:54] glpi.WARNING:   *** Warning: Undefined array key "filename" at clientinjection.form.php line 75
   Backtrace :
   ...datainjection/front/clientinjection.form.php:75
   ...Glpi/Controller/LegacyFileLoadController.php:64 require()
   ./vendor/symfony/http-kernel/HttpKernel.php:181    Glpi\Controller\LegacyFileLoadController->__invoke()
   ./vendor/symfony/http-kernel/HttpKernel.php:76     Symfony\Component\HttpKernel\HttpKernel->handleRaw()
   ./vendor/symfony/http-kernel/Kernel.php:208        Symfony\Component\HttpKernel\HttpKernel->handle()
   ./src/Glpi/Kernel/Kernel.php:201                   Symfony\Component\HttpKernel\Kernel->handle()
   ./public/index.php:78                              Glpi\Kernel\Kernel->handle()

[2026-09-22 12:52:54] glpi.WARNING:   *** Warning: Trying to access array offset on null at clientinjection.form.php line 75
   Backtrace :
   ...datainjection/front/clientinjection.form.php:75
   ...Glpi/Controller/LegacyFileLoadController.php:64 require()
   ./vendor/symfony/http-kernel/HttpKernel.php:181    Glpi\Controller\LegacyFileLoadController->__invoke()
   ./vendor/symfony/http-kernel/HttpKernel.php:76     Symfony\Component\HttpKernel\HttpKernel->handleRaw()
   ./vendor/symfony/http-kernel/Kernel.php:208        Symfony\Component\HttpKernel\HttpKernel->handle()
   ./src/Glpi/Kernel/Kernel.php:201                   Symfony\Component\HttpKernel\Kernel->handle()
   ./public/index.php:78                              Glpi\Kernel\Kernel->handle()

Logs of the error obtained by clicking "Export the log"

[2026-09-22 12:55:46] glpi.WARNING:   *** Warning: fopen(/var/glpi/files/_plugins/datainjection/): Failed to open stream: Is a directory at filesystem.php line 399
   Backtrace :
   ...ngmachine/safe/generated/8.2/filesystem.php:399
   ...datainjection/inc/clientinjection.class.php:349 Safe\fopen()
   ./plugins/datainjection/front/export.csv.php:33    PluginDatainjectionClientInjection::exportErrorsInCSV()
   ...Glpi/Controller/LegacyFileLoadController.php:64 require()
   ./vendor/symfony/http-kernel/HttpKernel.php:181    Glpi\Controller\LegacyFileLoadController->__invoke()
   ./vendor/symfony/http-kernel/HttpKernel.php:76     Symfony\Component\HttpKernel\HttpKernel->handleRaw()
   ./vendor/symfony/http-kernel/Kernel.php:208        Symfony\Component\HttpKernel\HttpKernel->handle()
   ./src/Glpi/Kernel/Kernel.php:201                   Symfony\Component\HttpKernel\Kernel->handle()
   ./public/index.php:78                              Glpi\Kernel\Kernel->handle()

[2026-09-22 12:55:46] glpi.CRITICAL:   *** Uncaught PHP Exception Safe\Exceptions\FilesystemException: "An error occurred" at FilesystemException.php line 9
   Backtrace :
   .../generated/Exceptions/FilesystemException.php:9
   ...ngmachine/safe/generated/8.2/filesystem.php:402 Safe\Exceptions\FilesystemException::createFromPhpError()
   ...datainjection/inc/clientinjection.class.php:349 Safe\fopen()
   ./plugins/datainjection/front/export.csv.php:33    PluginDatainjectionClientInjection::exportErrorsInCSV()
   ...Glpi/Controller/LegacyFileLoadController.php:64 require()
   ./vendor/symfony/http-kernel/HttpKernel.php:181    Glpi\Controller\LegacyFileLoadController->__invoke()
   ./vendor/symfony/http-kernel/HttpKernel.php:76     Symfony\Component\HttpKernel\HttpKernel->handleRaw()
   ./vendor/symfony/http-kernel/Kernel.php:208        Symfony\Component\HttpKernel\HttpKernel->handle()
   ./src/Glpi/Kernel/Kernel.php:201                   Symfony\Component\HttpKernel\Kernel->handle()
   ./public/index.php:78                              Glpi\Kernel\Kernel->handle()
Page URL

error occurs on /plugins/datainjection/front/export.csv.php (/plugins/datainjection/front/clientinjection.form.php on upload step outputs the warning)

Steps To reproduce
  1. Go to Administration > Data injection (client injection), pick a ready-to-use CSV model.
  2. Upload a valid CSV matching the model (with at least one row that will fail injection, so error lines exist).
  3. Check the GLPI PHP error log → "Undefined array key "filename"" at clientinjection.form.php line 75 (file_name stored as null in session).
  4. Run the injection, then click "Export the log".
  5. See error: fopen(.../files/plugins/datainjection/): Failed to open stream: Is a directory → uncaught TypeError in fputcsv() → HTTP 500, no CSV download.
Your GLPI setup information

No response

Anything else?

Root cause is the unset($_FILES['filename']); in readUploadedFile() combined with the re-read at clientinjection.form.php:75.

Suggested fix: capture the name before the unset and pass it back, e.g. in clientinjection.form.php do $uploaded_filename = $_FILES['filename']['name']; before processUploadedFile(), then $_SESSION['datainjection']['file_name'] = $uploaded_filename; — or have readUploadedFile() return the original name (it already captures it in $original_filename internally) instead of reaching into $_FILES again.

Lingua principale
PHP
Stelle
76
Fork
62
Merge medio
18h 52m
PR unite (30g)
15

Preparare l'ambiente

Non abbiamo ancora controllato i file di configurazione di questo progetto. Parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di pluginsGLPI/datainjection

Tutte le issue di pluginsGLPI/datainjection

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.